forked from game-ci/unity-test-runner
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
fb62d36
commit 1cba302
Showing
31 changed files
with
807 additions
and
807 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
#!/usr/bin/env bash | ||
#!/usr/bin/env bash | ||
|
||
if [ -z "${GIT_PRIVATE_TOKEN}" ] | ||
then | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
# | ||
# | ||
# Note: Non default ignore file, as this only tests Builder script. | ||
# | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
interface CommonAttributes { | ||
interface CommonAttributes { | ||
id: string; | ||
result: string; | ||
asserts: string; | ||
|
16 changes: 8 additions & 8 deletions
16
unity-package-with-correct-tests/com.fake.notarealpackage/Editor/TimerFeature.meta
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
12 changes: 6 additions & 6 deletions
12
...age-with-correct-tests/com.fake.notarealpackage/Editor/fake.notarealpackage.Editor.asmdef
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"name": "fake.notarealpackage.Editor", | ||
"references": [ | ||
"fake.notarealpackage.Runtime" | ||
] | ||
} | ||
{ | ||
"name": "fake.notarealpackage.Editor", | ||
"references": [ | ||
"fake.notarealpackage.Runtime" | ||
] | ||
} |
16 changes: 8 additions & 8 deletions
16
unity-package-with-correct-tests/com.fake.notarealpackage/Runtime/TimerFeature/Scripts.meta
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
36 changes: 18 additions & 18 deletions
36
...-with-correct-tests/com.fake.notarealpackage/Runtime/TimerFeature/Scripts/BasicCounter.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,18 @@ | ||
using System; | ||
|
||
public class BasicCounter | ||
{ | ||
public const int MaxCount = 10; | ||
|
||
public BasicCounter(int count = 0) | ||
{ | ||
Count = count; | ||
} | ||
|
||
public void Increment() | ||
{ | ||
Count = Math.Min(MaxCount, Count + 1); | ||
} | ||
|
||
public int Count { get; private set; } | ||
} | ||
using System; | ||
|
||
public class BasicCounter | ||
{ | ||
public const int MaxCount = 10; | ||
|
||
public BasicCounter(int count = 0) | ||
{ | ||
Count = count; | ||
} | ||
|
||
public void Increment() | ||
{ | ||
Count = Math.Min(MaxCount, Count + 1); | ||
} | ||
|
||
public int Count { get; private set; } | ||
} |
34 changes: 17 additions & 17 deletions
34
...th-correct-tests/com.fake.notarealpackage/Runtime/TimerFeature/Scripts/SampleComponent.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,17 @@ | ||
using UnityEngine; | ||
|
||
public class SampleComponent : MonoBehaviour | ||
{ | ||
public BasicCounter Counter; | ||
|
||
void Start() | ||
{ | ||
Counter = new BasicCounter(5); | ||
} | ||
|
||
// Update is called once per frame | ||
void Update() | ||
{ | ||
Counter.Increment(); | ||
} | ||
} | ||
using UnityEngine; | ||
|
||
public class SampleComponent : MonoBehaviour | ||
{ | ||
public BasicCounter Counter; | ||
|
||
void Start() | ||
{ | ||
Counter = new BasicCounter(5); | ||
} | ||
|
||
// Update is called once per frame | ||
void Update() | ||
{ | ||
Counter.Increment(); | ||
} | ||
} |
36 changes: 18 additions & 18 deletions
36
...ith-correct-tests/com.fake.notarealpackage/Runtime/TimerFeature/Scripts/TimerComponent.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,18 @@ | ||
using UnityEngine; | ||
|
||
public class TimerComponent : MonoBehaviour | ||
{ | ||
public BasicCounter Counter = new BasicCounter(); | ||
public float Timer = 1f; | ||
|
||
void Update() | ||
{ | ||
Timer -= Time.deltaTime; | ||
|
||
if (Timer > 0) | ||
return; | ||
|
||
Counter.Increment(); | ||
Timer = 1f; | ||
} | ||
} | ||
using UnityEngine; | ||
|
||
public class TimerComponent : MonoBehaviour | ||
{ | ||
public BasicCounter Counter = new BasicCounter(); | ||
public float Timer = 1f; | ||
|
||
void Update() | ||
{ | ||
Timer -= Time.deltaTime; | ||
|
||
if (Timer > 0) | ||
return; | ||
|
||
Counter.Increment(); | ||
Timer = 1f; | ||
} | ||
} |
6 changes: 3 additions & 3 deletions
6
...e-with-correct-tests/com.fake.notarealpackage/Runtime/fake.notarealpackage.Runtime.asmdef
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
{ | ||
"name": "fake.notarealpackage.Runtime" | ||
} | ||
{ | ||
"name": "fake.notarealpackage.Runtime" | ||
} |
76 changes: 38 additions & 38 deletions
76
unity-package-with-correct-tests/com.fake.notarealpackage/Tests/Editor/SampleEditModeTest.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,38 @@ | ||
using System.Collections; | ||
using System.Collections.Generic; | ||
using NUnit.Framework; | ||
using UnityEngine; | ||
using UnityEngine.TestTools; | ||
|
||
namespace Tests | ||
{ | ||
public class SampleEditModeTest | ||
{ | ||
[Test] | ||
public void TestIncrement() | ||
{ | ||
// Given | ||
var counter = new BasicCounter(0); | ||
|
||
// When | ||
counter.Increment(); | ||
|
||
// Then | ||
Assert.AreEqual(1, counter.Count); | ||
} | ||
|
||
[Test] | ||
public void TestMaxCount() | ||
{ | ||
// Given | ||
var counter = new BasicCounter(BasicCounter.MaxCount); | ||
|
||
// When | ||
counter.Increment(); | ||
|
||
// Then | ||
Assert.AreEqual(BasicCounter.MaxCount, counter.Count); | ||
} | ||
|
||
} | ||
} | ||
using System.Collections; | ||
using System.Collections.Generic; | ||
using NUnit.Framework; | ||
using UnityEngine; | ||
using UnityEngine.TestTools; | ||
|
||
namespace Tests | ||
{ | ||
public class SampleEditModeTest | ||
{ | ||
[Test] | ||
public void TestIncrement() | ||
{ | ||
// Given | ||
var counter = new BasicCounter(0); | ||
|
||
// When | ||
counter.Increment(); | ||
|
||
// Then | ||
Assert.AreEqual(1, counter.Count); | ||
} | ||
|
||
[Test] | ||
public void TestMaxCount() | ||
{ | ||
// Given | ||
var counter = new BasicCounter(BasicCounter.MaxCount); | ||
|
||
// When | ||
counter.Increment(); | ||
|
||
// Then | ||
Assert.AreEqual(BasicCounter.MaxCount, counter.Count); | ||
} | ||
|
||
} | ||
} |
26 changes: 13 additions & 13 deletions
26
...rrect-tests/com.fake.notarealpackage/Tests/Editor/fake.notarealpackage.EditorTests.asmdef
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,14 @@ | ||
{ | ||
"name": "fake.notarealpackage.EditorTests", | ||
"references": [ | ||
"fake.notarealpackage.Runtime", | ||
"fake.notarealpackage.Editor" | ||
], | ||
"optionalUnityReferences": [ | ||
"TestAssemblies" | ||
], | ||
"includePlatforms": [ | ||
"Editor" | ||
], | ||
"excludePlatforms": [] | ||
{ | ||
"name": "fake.notarealpackage.EditorTests", | ||
"references": [ | ||
"fake.notarealpackage.Runtime", | ||
"fake.notarealpackage.Editor" | ||
], | ||
"optionalUnityReferences": [ | ||
"TestAssemblies" | ||
], | ||
"includePlatforms": [ | ||
"Editor" | ||
], | ||
"excludePlatforms": [] | ||
} |
62 changes: 31 additions & 31 deletions
62
...-package-with-correct-tests/com.fake.notarealpackage/Tests/Runtime/SampleComponentTest.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,31 @@ | ||
using System.Collections; | ||
using NUnit.Framework; | ||
using UnityEngine; | ||
using UnityEngine.TestTools; | ||
|
||
namespace Tests | ||
{ | ||
public class SampleComponentTest | ||
{ | ||
private GameObject target; | ||
private SampleComponent component; | ||
|
||
[SetUp] | ||
public void Setup() | ||
{ | ||
target = GameObject.Instantiate(new GameObject()); | ||
component = target.AddComponent<SampleComponent>(); | ||
} | ||
|
||
[UnityTest] | ||
public IEnumerator TestIncrementOnUpdateAfterNextFrame() | ||
{ | ||
// Save the current value, since it was updated after component Start() method called | ||
var count = component.Counter.Count; | ||
|
||
// Skip frame and assert the new value | ||
yield return null; | ||
Assert.AreEqual(count + 1, component.Counter.Count); | ||
} | ||
} | ||
} | ||
using System.Collections; | ||
using NUnit.Framework; | ||
using UnityEngine; | ||
using UnityEngine.TestTools; | ||
|
||
namespace Tests | ||
{ | ||
public class SampleComponentTest | ||
{ | ||
private GameObject target; | ||
private SampleComponent component; | ||
|
||
[SetUp] | ||
public void Setup() | ||
{ | ||
target = GameObject.Instantiate(new GameObject()); | ||
component = target.AddComponent<SampleComponent>(); | ||
} | ||
|
||
[UnityTest] | ||
public IEnumerator TestIncrementOnUpdateAfterNextFrame() | ||
{ | ||
// Save the current value, since it was updated after component Start() method called | ||
var count = component.Counter.Count; | ||
|
||
// Skip frame and assert the new value | ||
yield return null; | ||
Assert.AreEqual(count + 1, component.Counter.Count); | ||
} | ||
} | ||
} |
Oops, something went wrong.