Skip to content

Commit 12c7cea

Browse files
committed
test: make the StdlibUnittest.Common pass on Windows
This adjusts the paths in the test to support the Linux and Windows path separators. Loosen the test to accept the interleaved stdout output on Windows.
1 parent 8db65b3 commit 12c7cea

File tree

1 file changed

+17
-15
lines changed

1 file changed

+17
-15
lines changed

validation-test/StdlibUnittest/Common.swift

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,7 @@ TestSuiteWithSetUp.test("passes") {
353353

354354
// CHECK: [ RUN ] TestSuiteWithSetUp.fails
355355
// CHECK: stdout>>> setUp
356-
// CHECK-NEXT: stdout>>> check failed at {{.*}}/StdlibUnittest/Common.swift, line
356+
// CHECK-NEXT: stdout>>> check failed at {{.*}}{{[/\\]}}StdlibUnittest{{[/\\]}}Common.swift, line
357357
// CHECK: stdout>>> test body
358358
// CHECK: [ FAIL ] TestSuiteWithSetUp.fails
359359
TestSuiteWithSetUp.test("fails") {
@@ -366,7 +366,7 @@ TestSuiteWithSetUp.test("fails") {
366366
// CHECK: [ OK ] TestSuiteWithSetUp.passesFails/parameterized/0
367367
// CHECK: [ RUN ] TestSuiteWithSetUp.passesFails/parameterized/1
368368
// CHECK: stdout>>> setUp
369-
// CHECK-NEXT: stdout>>> check failed at {{.*}}/StdlibUnittest/Common.swift, line
369+
// CHECK-NEXT: stdout>>> check failed at {{.*}}{{[/\\]}}StdlibUnittest{{[/\\]}}Common.swift, line
370370
// CHECK: stdout>>> test body
371371
// CHECK: [ FAIL ] TestSuiteWithSetUp.passesFails/parameterized/1
372372
TestSuiteWithSetUp.test("passesFails/parameterized")
@@ -398,7 +398,7 @@ TestSuiteWithTearDown.test("passes") {
398398
// CHECK: [ RUN ] TestSuiteWithTearDown.fails
399399
// CHECK: stdout>>> test body
400400
// CHECK: stdout>>> tearDown
401-
// CHECK-NEXT: stdout>>> check failed at {{.*}}/StdlibUnittest/Common.swift, line
401+
// CHECK-NEXT: stdout>>> check failed at {{.*}}{{[/\\]}}StdlibUnittest{{[/\\]}}Common.swift, line
402402
// CHECK: [ FAIL ] TestSuiteWithTearDown.fails
403403
TestSuiteWithTearDown.test("fails") {
404404
print("test body")
@@ -412,7 +412,7 @@ TestSuiteWithTearDown.test("fails") {
412412
// CHECK: [ RUN ] TestSuiteWithTearDown.passesFails/parameterized/1
413413
// CHECK: stdout>>> test body
414414
// CHECK: stdout>>> tearDown
415-
// CHECK-NEXT: stdout>>> check failed at {{.*}}/StdlibUnittest/Common.swift, line
415+
// CHECK-NEXT: stdout>>> check failed at {{.*}}{{[/\\]}}StdlibUnittest{{[/\\]}}Common.swift, line
416416
// CHECK: [ FAIL ] TestSuiteWithTearDown.passesFails/parameterized/1
417417
TestSuiteWithTearDown.test("passesFails/parameterized")
418418
.forEach(in: [1010, 2020]) {
@@ -437,7 +437,7 @@ AssertionsTestSuite.test("expectFailure/Pass") {
437437
}
438438
}
439439
// CHECK: [ RUN ] Assertions.expectFailure/Pass
440-
// CHECK-NEXT: stdout>>> check failed at {{.*}}/StdlibUnittest/Common.swift, line
440+
// CHECK-NEXT: stdout>>> check failed at {{.*}}{{[/\\]}}StdlibUnittest{{[/\\]}}Common.swift, line
441441
// CHECK: stdout>>> expected: 1 (of type Swift.Int)
442442
// CHECK: stdout>>> actual: 2 (of type Swift.Int)
443443
// CHECK: [ OK ] Assertions.expectFailure/Pass
@@ -451,7 +451,7 @@ AssertionsTestSuite.test("expectFailure/UXPass")
451451
}
452452
}
453453
// CHECK: [ RUN ] Assertions.expectFailure/UXPass ({{X}}FAIL: [Custom(reason: test)])
454-
// CHECK-NEXT: stdout>>> check failed at {{.*}}/StdlibUnittest/Common.swift, line
454+
// CHECK-NEXT: stdout>>> check failed at {{.*}}{{[/\\]}}StdlibUnittest{{[/\\]}}Common.swift, line
455455
// CHECK: stdout>>> expected: 1 (of type Swift.Int)
456456
// CHECK: stdout>>> actual: 2 (of type Swift.Int)
457457
// CHECK: [ UXPASS ] Assertions.expectFailure/UXPass
@@ -462,7 +462,7 @@ AssertionsTestSuite.test("expectFailure/Fail") {
462462
}
463463
}
464464
// CHECK: [ RUN ] Assertions.expectFailure/Fail
465-
// CHECK-NEXT: stdout>>> check failed at {{.*}}/StdlibUnittest/Common.swift, line
465+
// CHECK-NEXT: stdout>>> check failed at {{.*}}{{[/\\]}}StdlibUnittest{{[/\\]}}Common.swift, line
466466
// CHECK: stdout>>> expected: true
467467
// CHECK: stdout>>> running `body` should produce an expected failure
468468
// CHECK: [ FAIL ] Assertions.expectFailure/Fail
@@ -475,7 +475,7 @@ AssertionsTestSuite.test("expectFailure/XFail")
475475
}
476476
}
477477
// CHECK: [ RUN ] Assertions.expectFailure/XFail ({{X}}FAIL: [Custom(reason: test)])
478-
// CHECK-NEXT: stdout>>> check failed at {{.*}}/StdlibUnittest/Common.swift, line
478+
// CHECK-NEXT: stdout>>> check failed at {{.*}}{{[/\\]}}StdlibUnittest{{[/\\]}}Common.swift, line
479479
// CHECK: stdout>>> expected: true
480480
// CHECK: stdout>>> running `body` should produce an expected failure
481481
// CHECK: [ XFAIL ] Assertions.expectFailure/XFail
@@ -488,10 +488,10 @@ AssertionsTestSuite.test("expectFailure/AfterFailure/Fail") {
488488
}
489489
}
490490
// CHECK: [ RUN ] Assertions.expectFailure/AfterFailure/Fail
491-
// CHECK-NEXT: stdout>>> check failed at {{.*}}/StdlibUnittest/Common.swift, line
491+
// CHECK-NEXT: stdout>>> check failed at {{.*}}{{[/\\]}}StdlibUnittest{{[/\\]}}Common.swift, line
492492
// CHECK: stdout>>> expected: 1 (of type Swift.Int)
493493
// CHECK: stdout>>> actual: 2 (of type Swift.Int)
494-
// CHECK: stdout>>> check failed at {{.*}}/StdlibUnittest/Common.swift, line
494+
// CHECK: stdout>>> check failed at {{.*}}{{[/\\]}}StdlibUnittest{{[/\\]}}Common.swift, line
495495
// CHECK: stdout>>> expected: 3 (of type Swift.Int)
496496
// CHECK: stdout>>> actual: 4 (of type Swift.Int)
497497
// CHECK: [ FAIL ] Assertions.expectFailure/AfterFailure/Fail
@@ -506,10 +506,10 @@ AssertionsTestSuite.test("expectFailure/AfterFailure/XFail")
506506
}
507507
}
508508
// CHECK: [ RUN ] Assertions.expectFailure/AfterFailure/XFail ({{X}}FAIL: [Custom(reason: test)])
509-
// CHECK-NEXT: stdout>>> check failed at {{.*}}/StdlibUnittest/Common.swift, line
509+
// CHECK-NEXT: stdout>>> check failed at {{.*}}{{[/\\]}}StdlibUnittest{{[/\\]}}Common.swift, line
510510
// CHECK: stdout>>> expected: 1 (of type Swift.Int)
511511
// CHECK: stdout>>> actual: 2 (of type Swift.Int)
512-
// CHECK: stdout>>> check failed at {{.*}}/StdlibUnittest/Common.swift, line
512+
// CHECK: stdout>>> check failed at {{.*}}{{[/\\]}}StdlibUnittest{{[/\\]}}Common.swift, line
513513
// CHECK: stdout>>> expected: 3 (of type Swift.Int)
514514
// CHECK: stdout>>> actual: 4 (of type Swift.Int)
515515
// CHECK: [ XFAIL ] Assertions.expectFailure/AfterFailure/XFail
@@ -518,7 +518,7 @@ AssertionsTestSuite.test("expectUnreachable") {
518518
expectUnreachable()
519519
}
520520
// CHECK: [ RUN ] Assertions.expectUnreachable
521-
// CHECK-NEXT: stdout>>> check failed at {{.*}}/StdlibUnittest/Common.swift, line
521+
// CHECK-NEXT: stdout>>> check failed at {{.*}}{{[/\\]}}StdlibUnittest{{[/\\]}}Common.swift, line
522522
// CHECK: stdout>>> this code should not be executed
523523
// CHECK: [ FAIL ] Assertions.expectUnreachable
524524

@@ -582,7 +582,8 @@ AssertionsTestSuite.test("expectTrapping(_: Bound, in: RangeProtocol)") {
582582
expectTrapping(0, in: 1..<10)
583583
}
584584
// CHECK: [ RUN ] Assertions.expectTrapping(_: Bound, in: RangeProtocol)
585-
// CHECK-NEXT: stdout>>> check failed at {{.*}}.swift, line [[@LINE-3]]
585+
// stderr>>> CRASHED: SIGABRT
586+
// CHECK: stdout>>> check failed at {{.*}}.swift, line [[@LINE-4]]
586587
// CHECK: stdout>>> 0 in 1..<10{{$}}
587588
// CHECK: the test crashed unexpectedly
588589
// CHECK: [ FAIL ] Assertions.expectTrapping(_: Bound, in: RangeProtocol)
@@ -591,7 +592,8 @@ AssertionsTestSuite.test("expectTrapping(_: RangeProtocol, in: RangeProtocol)")
591592
expectTrapping(0..<5, in: 1..<10)
592593
}
593594
// CHECK: [ RUN ] Assertions.expectTrapping(_: RangeProtocol, in: RangeProtocol)
594-
// CHECK-NEXT: stdout>>> check failed at {{.*}}.swift, line [[@LINE-3]]
595+
// stderr>>> CRASHED: SIGABRT
596+
// CHECK: stdout>>> check failed at {{.*}}.swift, line [[@LINE-4]]
595597
// CHECK: stdout>>> 0..<5 in 1..<10{{$}}
596598
// CHECK: the test crashed unexpectedly
597599
// CHECK: [ FAIL ] Assertions.expectTrapping(_: RangeProtocol, in: RangeProtocol)

0 commit comments

Comments
 (0)