@@ -80,6 +80,28 @@ final class PreprocessorTests: SyntaxHighlighterTestCase {
8080 ] )
8181 }
8282
83+ func testWarningDirective( ) {
84+ let components = highlighter. highlight ( #"#warning("Hey!")"# )
85+
86+ XCTAssertEqual ( components, [
87+ . token( " #warning " , . preprocessing) ,
88+ . plainText( " ( " ) ,
89+ . token( #""Hey!""# , . string) ,
90+ . plainText( " ) " )
91+ ] )
92+ }
93+
94+ func testErrorDirective( ) {
95+ let components = highlighter. highlight ( #"#error("No!")"# )
96+
97+ XCTAssertEqual ( components, [
98+ . token( " #error " , . preprocessing) ,
99+ . plainText( " ( " ) ,
100+ . token( #""No!""# , . string) ,
101+ . plainText( " ) " )
102+ ] )
103+ }
104+
83105 func testAllTestsRunOnLinux( ) {
84106 XCTAssertTrue ( TestCaseVerifier . verifyLinuxTests ( ( type ( of: self ) ) . allTests) )
85107 }
@@ -91,7 +113,9 @@ extension PreprocessorTests {
91113 ( " testPreprocessing " , testPreprocessing) ,
92114 ( " testSelector " , testSelector) ,
93115 ( " testFunctionAttribute " , testFunctionAttribute) ,
94- ( " testAvailabilityCheck " , testAvailabilityCheck)
116+ ( " testAvailabilityCheck " , testAvailabilityCheck) ,
117+ ( " testWarningDirective " , testWarningDirective) ,
118+ ( " testErrorDirective " , testErrorDirective)
95119 ]
96120 }
97121}
0 commit comments