Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit d33dcdd

Browse files
committed
domain reload test runner can run test by index
1 parent 56fafe3 commit d33dcdd

1 file changed

Lines changed: 16 additions & 7 deletions

File tree

tests/domain_tests/TestRunner.cs

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,7 @@ def after_reload():
355355
356356
assert before_reload_called is True
357357
if not after_reload_called:
358-
assert called is True
358+
assert called is True
359359
after_reload_called = True
360360
361361
called = False
@@ -771,7 +771,7 @@ def before_reload():
771771
772772
def after_reload():
773773
try:
774-
bar = sys.my_cls()
774+
bar = sys.my_cls()
775775
except TypeError:
776776
print('Caught expected exception')
777777
else:
@@ -1167,7 +1167,7 @@ public static int Main()
11671167
}}
11681168
catch (Exception e)
11691169
{{
1170-
Console.WriteLine(e.StackTrace);
1170+
Console.Error.WriteLine(e.StackTrace);
11711171
throw;
11721172
}}
11731173
return 0;
@@ -1181,18 +1181,27 @@ public static int Main()
11811181

11821182
public static int Main(string[] args)
11831183
{
1184-
TestCase testCase;
11851184
if (args.Length < 1)
11861185
{
1187-
testCase = Cases[0];
1186+
foreach (var testCase in Cases)
1187+
{
1188+
Run(testCase);
1189+
Console.WriteLine();
1190+
}
11881191
}
11891192
else
11901193
{
11911194
string testName = args[0];
11921195
Console.WriteLine($"-- Looking for domain reload test case {testName}");
1193-
testCase = Cases.First(c => c.Name == testName);
1196+
var testCase = int.TryParse(testName, out var index) ? Cases[index] : Cases.First(c => c.Name == testName);
1197+
Run(testCase);
11941198
}
11951199

1200+
return 0;
1201+
}
1202+
1203+
static void Run(TestCase testCase)
1204+
{
11961205
Console.WriteLine($"-- Running domain reload test case: {testCase.Name}");
11971206

11981207
SetupTestFolder(testCase.Name);
@@ -1230,7 +1239,7 @@ public static int Main(string[] args)
12301239
// folder behind to debug failing tests.
12311240
TeardownTestFolder();
12321241

1233-
return 0;
1242+
Console.WriteLine($"-- PASSED: {testCase.Name}");
12341243
}
12351244

12361245
static void SetupTestFolder(string testCaseName)

0 commit comments

Comments
 (0)