Skip to content

Commit af5f647

Browse files
committed
Add unit tests verifying that the move only types are omitted by the Playground Transform.
1 parent d459ec8 commit af5f647

File tree

3 files changed

+70
-0
lines changed

3 files changed

+70
-0
lines changed
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
// RUN: %empty-directory(%t)
2+
// RUN: cp %s %t/main.swift
3+
// RUN: %target-build-swift -whole-module-optimization -module-name PlaygroundSupport -emit-module-path %t/PlaygroundSupport.swiftmodule -parse-as-library -c -o %t/PlaygroundSupport.o %S/Inputs/SilentPCMacroRuntime.swift %S/Inputs/PlaygroundsRuntime.swift
4+
// RUN: %target-build-swift -Xfrontend -playground -o %t/main -I=%t %t/PlaygroundSupport.o %t/main.swift
5+
// RUN: %target-codesign %t/main
6+
// RUN: %target-run %t/main | %FileCheck %s
7+
// RUN: %target-build-swift -Xfrontend -pc-macro -Xfrontend -playground -o %t/main2 -I=%t %t/PlaygroundSupport.o %t/main.swift -module-name main
8+
// RUN: %target-codesign %t/main2
9+
// RUN: %target-run %t/main2 | %FileCheck %s
10+
// REQUIRES: executable_test
11+
12+
import PlaygroundSupport
13+
14+
struct A: ~Copyable {}
15+
16+
var a: A
17+
a = A()
18+
19+
struct B {}
20+
21+
var b: B
22+
b = B()
23+
// note: a should not be logged (at least until move-only types can be passed to the generic logging functions)
24+
// CHECK: [{{.*}}] __builtin_log[b='B()']
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
// RUN: %empty-directory(%t)
2+
// RUN: cp %s %t/main.swift
3+
// RUN: %target-build-swift -whole-module-optimization -module-name PlaygroundSupport -emit-module-path %t/PlaygroundSupport.swiftmodule -parse-as-library -c -o %t/PlaygroundSupport.o %S/Inputs/SilentPCMacroRuntime.swift %S/Inputs/PlaygroundsRuntime.swift
4+
// RUN: %target-build-swift -Xfrontend -playground -o %t/main -I=%t %t/PlaygroundSupport.o %t/main.swift
5+
// RUN: %target-codesign %t/main
6+
// RUN: %target-run %t/main | %FileCheck %s
7+
// RUN: %target-build-swift -Xfrontend -pc-macro -Xfrontend -playground -o %t/main2 -I=%t %t/PlaygroundSupport.o %t/main.swift -module-name main
8+
// RUN: %target-codesign %t/main2
9+
// RUN: %target-run %t/main2 | %FileCheck %s
10+
// REQUIRES: executable_test
11+
12+
import PlaygroundSupport
13+
14+
struct A: ~Copyable {}
15+
16+
let a = A()
17+
18+
struct B {}
19+
20+
let b = B()
21+
// note: a should not be logged (at least until move-only types can be passed to the generic logging functions)
22+
// CHECK: [{{.*}}] __builtin_log[b='B()']
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
// RUN: %empty-directory(%t)
2+
// RUN: cp %s %t/main.swift
3+
// RUN: %target-build-swift -whole-module-optimization -module-name PlaygroundSupport -emit-module-path %t/PlaygroundSupport.swiftmodule -parse-as-library -c -o %t/PlaygroundSupport.o %S/Inputs/SilentPCMacroRuntime.swift %S/Inputs/PlaygroundsRuntime.swift
4+
// RUN: %target-build-swift -Xfrontend -playground -o %t/main -I=%t %t/PlaygroundSupport.o %t/main.swift
5+
// RUN: %target-codesign %t/main
6+
// RUN: %target-run %t/main | %FileCheck %s
7+
// RUN: %target-build-swift -Xfrontend -pc-macro -Xfrontend -playground -o %t/main2 -I=%t %t/PlaygroundSupport.o %t/main.swift -module-name main
8+
// RUN: %target-codesign %t/main2
9+
// RUN: %target-run %t/main2 | %FileCheck %s
10+
// REQUIRES: executable_test
11+
12+
import PlaygroundSupport
13+
14+
struct A: ~Copyable {}
15+
16+
func f(_ a: consuming A) -> A {
17+
return a
18+
}
19+
20+
f(A())
21+
// note: a should not be logged (at least until move-only types can be passed to the generic logging functions)
22+
// CHECK: [{{.*}}] __builtin_log_scope_entry
23+
// CHECK-NEXT: [{{.*}}] __builtin_log_scope_exit
24+
// CHECK-NOT: __builtin_log

0 commit comments

Comments
 (0)