|
3 | 3 |
|
4 | 4 | namespace NRT.Tests |
5 | 5 | { |
6 | | - [SceneTree] |
7 | | - public partial class Main : Node |
8 | | - { |
9 | | - [GodotOverride] |
10 | | - private void OnReady() |
11 | | - { |
12 | | - // Setup |
13 | | - var nullableWithNull = TestWithNullableNRT.Instantiate(); |
14 | | - var nullableWithNotNull = TestWithNullableNRT.Instantiate("not null", "not null"); |
15 | | - var nonNullableWithEmpty = TestWithNonNullableNRT.Instantiate(); // (should not compile with null/default) |
16 | | - var nonNullableWithNotEmpty = TestWithNonNullableNRT.Instantiate("not empty", "not empty"); |
| 6 | + [SceneTree] |
| 7 | + public partial class Main : Node |
| 8 | + { |
| 9 | + [GodotOverride] |
| 10 | + private void OnReady() |
| 11 | + { |
| 12 | + // Setup |
| 13 | + var nullableWithNull = TestWithNullableNRT.Instantiate(); |
| 14 | + var nullableWithNotNull = TestWithNullableNRT.Instantiate("not null", "not null"); |
| 15 | + var nonNullableWithEmpty = TestWithNonNullableNRT.Instantiate(); // (should not compile with null/default) |
| 16 | + var nonNullableWithNotEmpty = TestWithNonNullableNRT.Instantiate("not empty", "not empty"); |
17 | 17 |
|
18 | | - TestInstantiate(); |
19 | | - TestNotify(); |
20 | | - TestNotifyWithAction(); |
| 18 | + TestInstantiate(); |
| 19 | + TestNotify(); |
| 20 | + TestNotifyWithAction(); |
21 | 21 |
|
22 | | - // Teardown |
23 | | - nullableWithNull.Free(); |
24 | | - nullableWithNotNull.Free(); |
25 | | - nonNullableWithEmpty.Free(); |
26 | | - nonNullableWithNotEmpty.Free(); |
| 22 | + // Teardown |
| 23 | + nullableWithNull.Free(); |
| 24 | + nullableWithNotNull.Free(); |
| 25 | + nonNullableWithEmpty.Free(); |
| 26 | + nonNullableWithNotEmpty.Free(); |
27 | 27 |
|
28 | | - GD.Print("TEST PASS OK"); |
| 28 | + GD.Print("TEST PASS OK"); |
29 | 29 |
|
30 | | - GetTree().Quit(); |
| 30 | + GetTree().Quit(); |
31 | 31 |
|
32 | | - void TestInstantiate() |
33 | | - { |
34 | | - nullableWithNull.InstantiateValue1.Should().Be(null); |
35 | | - nullableWithNull.InstantiateValue2.Should().Be(default); |
36 | | - nullableWithNotNull.InstantiateValue1.Should().Be("not null"); |
37 | | - nullableWithNotNull.InstantiateValue2.Should().Be("not null"); |
38 | | - nonNullableWithEmpty.InstantiateValue1.Should().Be(string.Empty); |
39 | | - nonNullableWithEmpty.InstantiateValue2.Should().Be(default!); |
40 | | - nonNullableWithNotEmpty.InstantiateValue1.Should().Be("not empty"); |
41 | | - nonNullableWithNotEmpty.InstantiateValue2.Should().Be("not empty"); |
42 | | - } |
| 32 | + void TestInstantiate() |
| 33 | + { |
| 34 | + nullableWithNull.InstantiateValue1.Should().Be(null); |
| 35 | + nullableWithNull.InstantiateValue2.Should().Be(default); |
| 36 | + nullableWithNotNull.InstantiateValue1.Should().Be("not null"); |
| 37 | + nullableWithNotNull.InstantiateValue2.Should().Be("not null"); |
| 38 | + nonNullableWithEmpty.InstantiateValue1.Should().Be(string.Empty); |
| 39 | + nonNullableWithEmpty.InstantiateValue2.Should().Be(default!); |
| 40 | + nonNullableWithNotEmpty.InstantiateValue1.Should().Be("not empty"); |
| 41 | + nonNullableWithNotEmpty.InstantiateValue2.Should().Be("not empty"); |
| 42 | + } |
43 | 43 |
|
44 | | - void TestNotify() |
45 | | - { |
46 | | - nullableWithNull.NotifyTest.Should().Be(null); |
47 | | - nullableWithNotNull.NotifyTest.Should().Be(null); |
48 | | - nonNullableWithEmpty.NotifyTest.Should().Be(string.Empty); |
49 | | - nonNullableWithNotEmpty.NotifyTest.Should().Be(string.Empty); |
| 44 | + void TestNotify() |
| 45 | + { |
| 46 | + nullableWithNull.NotifyTest.Should().Be(null); |
| 47 | + nullableWithNotNull.NotifyTest.Should().Be(null); |
| 48 | + nonNullableWithEmpty.NotifyTest.Should().Be(string.Empty); |
| 49 | + nonNullableWithNotEmpty.NotifyTest.Should().Be(string.Empty); |
50 | 50 |
|
51 | | - nullableWithNull.NotifyTest = null; |
52 | | - nullableWithNotNull.NotifyTest = "not null"; |
53 | | - nonNullableWithEmpty.NotifyTest = string.Empty; // (should not compile with null) |
54 | | - nonNullableWithNotEmpty.NotifyTest = "not empty"; |
| 51 | + nullableWithNull.NotifyTest = null; |
| 52 | + nullableWithNotNull.NotifyTest = "not null"; |
| 53 | + nonNullableWithEmpty.NotifyTest = string.Empty; // (should not compile with null) |
| 54 | + nonNullableWithNotEmpty.NotifyTest = "not empty"; |
55 | 55 |
|
56 | | - nullableWithNull.NotifyTest.Should().Be(null); |
57 | | - nullableWithNotNull.NotifyTest.Should().Be("not null"); |
58 | | - nonNullableWithEmpty.NotifyTest.Should().Be(string.Empty); |
59 | | - nonNullableWithNotEmpty.NotifyTest.Should().Be("not empty"); |
60 | | - } |
| 56 | + nullableWithNull.NotifyTest.Should().Be(null); |
| 57 | + nullableWithNotNull.NotifyTest.Should().Be("not null"); |
| 58 | + nonNullableWithEmpty.NotifyTest.Should().Be(string.Empty); |
| 59 | + nonNullableWithNotEmpty.NotifyTest.Should().Be("not empty"); |
| 60 | + } |
61 | 61 |
|
62 | | - void TestNotifyWithAction() |
63 | | - { |
64 | | - nullableWithNull.NotifyActionValue.Should().Be(null); |
65 | | - nullableWithNotNull.NotifyActionValue.Should().Be(null); |
66 | | - nonNullableWithEmpty.NotifyActionValue.Should().Be(string.Empty); |
67 | | - nonNullableWithNotEmpty.NotifyActionValue.Should().Be(string.Empty); |
| 62 | + void TestNotifyWithAction() |
| 63 | + { |
| 64 | + nullableWithNull.NotifyActionValue.Should().Be(null); |
| 65 | + nullableWithNotNull.NotifyActionValue.Should().Be(null); |
| 66 | + nonNullableWithEmpty.NotifyActionValue.Should().Be(string.Empty); |
| 67 | + nonNullableWithNotEmpty.NotifyActionValue.Should().Be(string.Empty); |
68 | 68 |
|
69 | | - nullableWithNull.NotifyTestWithAction.Should().Be(null); |
70 | | - nullableWithNotNull.NotifyTestWithAction.Should().Be(null); |
71 | | - nonNullableWithEmpty.NotifyTestWithAction.Should().Be(string.Empty); |
72 | | - nonNullableWithNotEmpty.NotifyTestWithAction.Should().Be(string.Empty); |
| 69 | + nullableWithNull.NotifyTestWithAction.Should().Be(null); |
| 70 | + nullableWithNotNull.NotifyTestWithAction.Should().Be(null); |
| 71 | + nonNullableWithEmpty.NotifyTestWithAction.Should().Be(string.Empty); |
| 72 | + nonNullableWithNotEmpty.NotifyTestWithAction.Should().Be(string.Empty); |
73 | 73 |
|
74 | | - nullableWithNull.NotifyTestWithAction = null; |
75 | | - nullableWithNotNull.NotifyTestWithAction = "not null"; |
76 | | - nonNullableWithEmpty.NotifyTestWithAction = string.Empty; // (should not compile with null) |
77 | | - nonNullableWithNotEmpty.NotifyTestWithAction = "not empty"; |
| 74 | + nullableWithNull.NotifyTestWithAction = null; |
| 75 | + nullableWithNotNull.NotifyTestWithAction = "not null"; |
| 76 | + nonNullableWithEmpty.NotifyTestWithAction = string.Empty; // (should not compile with null) |
| 77 | + nonNullableWithNotEmpty.NotifyTestWithAction = "not empty"; |
78 | 78 |
|
79 | | - nullableWithNull.NotifyTestWithAction.Should().Be(null); |
80 | | - nullableWithNotNull.NotifyTestWithAction.Should().Be("not null"); |
81 | | - nonNullableWithEmpty.NotifyTestWithAction.Should().Be(string.Empty); |
82 | | - nonNullableWithNotEmpty.NotifyTestWithAction.Should().Be("not empty"); |
| 79 | + nullableWithNull.NotifyTestWithAction.Should().Be(null); |
| 80 | + nullableWithNotNull.NotifyTestWithAction.Should().Be("not null"); |
| 81 | + nonNullableWithEmpty.NotifyTestWithAction.Should().Be(string.Empty); |
| 82 | + nonNullableWithNotEmpty.NotifyTestWithAction.Should().Be("not empty"); |
83 | 83 |
|
84 | | - nullableWithNull.NotifyActionValue.Should().Be(null); |
85 | | - nullableWithNotNull.NotifyActionValue.Should().Be("not null"); |
86 | | - nonNullableWithEmpty.NotifyActionValue.Should().Be(string.Empty); |
87 | | - nonNullableWithNotEmpty.NotifyActionValue.Should().Be("not empty"); |
88 | | - } |
89 | | - } |
90 | | - } |
| 84 | + nullableWithNull.NotifyActionValue.Should().Be(null); |
| 85 | + nullableWithNotNull.NotifyActionValue.Should().Be("not null"); |
| 86 | + nonNullableWithEmpty.NotifyActionValue.Should().Be(string.Empty); |
| 87 | + nonNullableWithNotEmpty.NotifyActionValue.Should().Be("not empty"); |
| 88 | + } |
| 89 | + } |
| 90 | + } |
91 | 91 | } |
0 commit comments