Skip to content

Commit 9ac03b7

Browse files
committed
[test] Introduced tests of the playground transform and defer and nested functions.
1 parent 0a9a4e7 commit 9ac03b7

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

test/PlaygroundTransform/defer.swift

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// RUN: %empty-directory(%t)
2+
// RUN: cp %s %t/main.swift
3+
// RUN: %target-build-swift -Xfrontend -playground -Xfrontend -debugger-support -o %t/main %S/Inputs/PlaygroundsRuntime.swift %t/main.swift
4+
// RUN: %target-run %t/main | %FileCheck %s
5+
// RUN: %target-build-swift -Xfrontend -pc-macro -Xfrontend -playground -Xfrontend -debugger-support -o %t/main %S/Inputs/PlaygroundsRuntime.swift %S/Inputs/SilentPCMacroRuntime.swift %t/main.swift
6+
// RUN: %target-run %t/main | %FileCheck %s
7+
// REQUIRES: executable_test
8+
func foo() {
9+
defer {
10+
2
11+
}
12+
1
13+
}
14+
foo()
15+
// CHECK: {{.*}} $builtin_log_scope_entry
16+
// CHECK-NEXT: {{.*}} $builtin_log[='1']
17+
// CHECK-NEXT: {{.*}} $builtin_log_scope_exit
18+
// CHECK-NEXT: {{.*}} $builtin_log_scope_entry
19+
// CHECK-NEXT: {{.*}} $builtin_log[='2']
20+
// CHECK-NEXT: {{.*}} $builtin_log_scope_exit

0 commit comments

Comments
 (0)