Skip to content

Commit 8c71832

Browse files
committed
Start testing FileCheck
1 parent 703893c commit 8c71832

File tree

2 files changed

+50
-0
lines changed

2 files changed

+50
-0
lines changed
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
import LLVM
2+
import XCTest
3+
import Foundation
4+
5+
class FileCheckSpec : XCTestCase {
6+
func testImplicitCheckNot() {
7+
XCTAssert(fileCheckOutput(of: .stdout, withPrefixes: ["CHECK-NOTCHECK"]) {
8+
// CHECK-NOTCHECK: error: NOTCHECK-NOT: string occurred!
9+
// CHECK-NOTCHECK-NEXT: warning:
10+
// CHECK-NOTCHECK-NEXT: note: NOTCHECK-NOT: pattern specified here
11+
// CHECK-NOTCHECK-NEXT: IMPLICIT-CHECK-NOT: warning:
12+
XCTAssertFalse(fileCheckOutput(of: .stdout, withPrefixes: ["NOTCHECK"], checkNot: ["warning:"], options: [.disableColors]) {
13+
// NOTCHECK: error:
14+
print("error:")
15+
// NOTCHECK: error:
16+
print("error:")
17+
// NOTCHECK: error:
18+
print("error:")
19+
// NOTCHECK: error:
20+
print("error:")
21+
print("warning:")
22+
})
23+
})
24+
25+
XCTAssert(fileCheckOutput(of: .stdout, withPrefixes: ["CHECK-NOTCHECK-MID"]) {
26+
// CHECK-NOTCHECK-MID: error: NOTCHECK-MID-NOT: string occurred!
27+
// CHECK-NOTCHECK-MID-NEXT: warning:
28+
// CHECK-NOTCHECK-MID-NEXT: note: NOTCHECK-MID-NOT: pattern specified here
29+
// CHECK-NOTCHECK-MID-NEXT: IMPLICIT-CHECK-NOT: warning:
30+
XCTAssertFalse(fileCheckOutput(of: .stdout, withPrefixes: ["NOTCHECK-MID"], checkNot: ["warning:"], options: [.disableColors]) {
31+
// NOTCHECK-MID: error:
32+
print("error:")
33+
// NOTCHECK-MID: error:
34+
print("error:")
35+
print("warning:")
36+
// NOTCHECK-MID: error:
37+
print("error:")
38+
// NOTCHECK-MID: error:
39+
print("error:")
40+
})
41+
})
42+
}
43+
44+
#if !os(macOS)
45+
static var allTests = testCase([
46+
("testImplicitCheckNot", testImplicitCheckNot),
47+
])
48+
#endif
49+
}

Tests/LinuxMain.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,6 @@ XCTMain([
88
ConstantSpec.allTests,
99
IRExceptionSpec.allTests,
1010
IROperationSpec.allTests,
11+
FileCheckSpec.allTests,
1112
])
1213
#endif

0 commit comments

Comments
 (0)