You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// Macro implementations build for the host, so the corresponding module is not available when cross-compiling. Cross-compiled tests may still make use of the macro itself in end-to-end tests.
8
+
#if canImport(SKSampleMacroMacros)
9
+
import SKSampleMacroMacros
10
+
11
+
lettestMacros:[String:Macro.Type]=[
12
+
"stringify":StringifyMacro.self,
13
+
]
14
+
#endif
15
+
16
+
finalclass SKSampleMacroTests:XCTestCase{
17
+
func testMacro()throws{
18
+
#if canImport(SKSampleMacroMacros)
19
+
assertMacroExpansion(
20
+
"""
21
+
#stringify(a + b)
22
+
""",
23
+
expandedSource:"""
24
+
(a + b, "a + b")
25
+
""",
26
+
macros: testMacros
27
+
)
28
+
#else
29
+
throwXCTSkip("macros are only supported when running tests for the host platform")
30
+
#endif
31
+
}
32
+
33
+
func testMacroWithStringLiteral()throws{
34
+
#if canImport(SKSampleMacroMacros)
35
+
assertMacroExpansion(
36
+
#"""
37
+
#stringify("Hello, \(name)")
38
+
"""#,
39
+
expandedSource:#"""
40
+
("Hello, \(name)", #""Hello, \(name)""#)
41
+
"""#,
42
+
macros: testMacros
43
+
)
44
+
#else
45
+
throw XCTSkip("macros are only supported when running tests for the host platform")
0 commit comments