Skip to content

Commit bc06bb0

Browse files
committed
Submit the macros "builtin" tests
1 parent c957330 commit bc06bb0

File tree

2 files changed

+6
-23
lines changed

2 files changed

+6
-23
lines changed

test/Macros/builtin_macros.swift

Lines changed: 0 additions & 22 deletions
This file was deleted.

test/Macros/macro_external_exec.swift

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// RUN: %empty-directory(%t)
22
// RUN: %target-build-swift -I %swift-host-lib-dir -L %swift-host-lib-dir -emit-library -o %t/%target-library-name(MacroDefinition) -module-name=MacroDefinition %S/Inputs/syntax_macro_definitions.swift -g -no-toolchain-stdlib-rpath
33
// RUNx: %target-swift-frontend -dump-ast -enable-experimental-feature Macros -load-plugin-library %t/%target-library-name(MacroDefinition) -I %swift-host-lib-dir %s -module-name MacroUser 2>&1 | %FileCheck --check-prefix CHECK-AST %s
4-
// RUN: %target-build-swift -enable-experimental-feature Macros -load-plugin-library %t/%target-library-name(MacroDefinition) -I %swift-host-lib-dir -L %swift-host-lib-dir %s -o %t/main -module-name MacroUser
4+
// RUN: %target-build-swift -enable-experimental-feature Macros -enable-experimental-feature Macros -load-plugin-library %t/%target-library-name(MacroDefinition) -I %swift-host-lib-dir -L %swift-host-lib-dir %s -o %t/main -module-name MacroUser
55
// RUN: %target-run %t/main | %FileCheck %s
66
// REQUIRES: executable_test
77

@@ -10,10 +10,15 @@
1010

1111
macro customFileID: String = MacroDefinition.FileIDMacro
1212
macro stringify<T>(_ value: T) -> (T, String) = MacroDefinition.StringifyMacro
13+
macro fileID<T: _ExpressibleByStringLitera>: T = MacroDefinition.FileIDMacro
1314

1415
func testFileID(a: Int, b: Int) {
1516
// CHECK: MacroUser/macro_external_exec.swift
1617
print("Result is \(#customFileID)")
18+
19+
// CHECK: Builtin result is MacroUser/macro_external_exec.swift
20+
// CHECK-AST: macro_expansion_expr type='String'{{.*}}name=line
21+
print("Builtin result is \(#fileID)")
1722
}
1823

1924
testFileID(a: 1, b: 2)

0 commit comments

Comments
 (0)