Skip to content

Commit 82a163e

Browse files
committed
[Test] Add an executable test
1 parent ba481f3 commit 82a163e

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
// RUN: %target-run-simple-swift
2+
3+
// REQUIRES: executable_test
4+
5+
@propertyWrapper
6+
struct Foo {
7+
private var _storage: [Int] = []
8+
9+
init(wrappedValue value: [Int]) {
10+
self._storage = value
11+
}
12+
13+
var wrappedValue: [Int] {
14+
get { _storage }
15+
set { _storage = newValue }
16+
}
17+
}
18+
19+
class Bar {
20+
@Foo var someArray = [1, 2, 3] {
21+
willSet {
22+
print(newValue)
23+
}
24+
25+
didSet {
26+
print(oldValue)
27+
}
28+
}
29+
}
30+
31+
let bar = Bar()
32+
// CHECK: [4, 2, 3]
33+
// CHECK: [1, 2, 3]
34+
bar.someArray[0] = 4

0 commit comments

Comments
 (0)