Skip to content

Commit 2690691

Browse files
authored
Merge pull request #63760 from bnbarham/add-sg-macro-test
[SymbolGraph] Add a test to ensure macros are output
2 parents 3022812 + a2e85e7 commit 2690691

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

test/SymbolGraph/Symbols/Macro.swift

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
// FIXME: Swift parser is not enabled on non-MacOS yet
2+
// REQUIRES: OS=macosx
3+
4+
// REQUIRES: executable_test
5+
6+
// RUN: %empty-directory(%t)
7+
8+
// Build the plugin
9+
// RUN: %target-build-swift %S/../../Macros/Inputs/syntax_macro_definitions.swift -emit-library -o %t/%target-library-name(MacroDefinition) -module-name=MacroDefinition -swift-version 5 -I %swift-host-lib-dir -L %swift-host-lib-dir -g -no-toolchain-stdlib-rpath
10+
11+
// RUN: %target-build-swift %s -module-name Macro -emit-module -emit-module-path %t -swift-version 5 -enable-experimental-feature Macros -load-plugin-library %t/%target-library-name(MacroDefinition) -I %swift-host-lib-dir
12+
// RUN: %target-swift-symbolgraph-extract -module-name Macro -I %t -pretty-print -output-dir %t
13+
// RUN: %FileCheck %s --input-file %t/Macro.symbols.json
14+
// RUN: %FileCheck %s --input-file %t/Macro.symbols.json --check-prefix MISSING
15+
16+
@freestanding(expression)
17+
public macro customFileID() -> String = #externalMacro(module: "MacroDefinition", type: "FileIDMacro")
18+
19+
@attached(peer)
20+
public macro addCompletionHandler() = #externalMacro(module: "MacroDefinition", type: "AddCompletionHandler")
21+
22+
@freestanding(expression)
23+
macro moduleCustomFileID() -> String = #externalMacro(module: "MacroDefinition", type: "FileIDMacro")
24+
25+
// CHECK-DAG: "precise": "s:5Macro20addCompletionHandleryycfm"
26+
// CHECK-DAG: "precise": "s:5Macro12customFileIDSSycfm"
27+
28+
// MISSING-NOT: moduleCustomFileID

0 commit comments

Comments
 (0)