Skip to content

Commit bb7823c

Browse files
committed
[embedded] Fix test command in test/embedded/dependencies.swift, add classes usage
1 parent f8d4526 commit bb7823c

File tree

1 file changed

+25
-3
lines changed

1 file changed

+25
-3
lines changed

test/embedded/dependencies.swift

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// RUN: %empty-directory(%t)
2-
// RUN: %target-swift-frontend -enable-experimental-feature Embedded %s -c -o %t/a.o
2+
// RUN: %target-swift-frontend -parse-as-library -enable-experimental-feature Embedded %s -c -o %t/a.o
33

44
// RUN: grep DEP\: %s | sed 's#// DEP\: ##' | sort > %t/allowed-dependencies.txt
55

@@ -9,7 +9,7 @@
99
// RUN: %llvm-nm --undefined-only --format=just-symbols %t/a.o | sort | tee %t/actual-dependencies.txt
1010

1111
// Fail if there is any entry in actual-dependencies.txt that's not in allowed-dependencies.txt
12-
// RUN: test -z `comm -13 %t/allowed-dependencies.txt %t/actual-dependencies.txt`
12+
// RUN: test -z "`comm -13 %t/allowed-dependencies.txt %t/actual-dependencies.txt`"
1313

1414
// DEP: ___stack_chk_fail
1515
// DEP: ___stack_chk_guard
@@ -43,4 +43,26 @@ public func print(_ s: StaticString, terminator: StaticString = "\n") {
4343
}
4444
}
4545

46-
print("Hello Embedded Swift!") // CHECK: Hello Embedded Swift!
46+
class MyClass {
47+
func foo() { print("MyClass.foo") }
48+
}
49+
50+
class MySubClass: MyClass {
51+
override func foo() { print("MySubClass.foo") }
52+
}
53+
54+
@main
55+
struct Main {
56+
static var objects: [MyClass] = []
57+
static func main() {
58+
print("Hello Embedded Swift!")
59+
// CHECK: Hello Embedded Swift!
60+
objects.append(MyClass())
61+
objects.append(MySubClass())
62+
for o in objects {
63+
o.foo()
64+
}
65+
// CHECK: MyClass.foo
66+
// CHECK: MySubClass.foo
67+
}
68+
}

0 commit comments

Comments
 (0)