Skip to content

Commit a626c6b

Browse files
committed
Test: more coverage for deinits
1 parent af9ce5f commit a626c6b

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

test/Interpreter/moveonly_swiftskell.swift

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@
1414
// RUN: -module-name E -o %t/E %target-rpath(%t)
1515
// RUN: %target-codesign %t/E
1616
// RUN: %target-codesign %t/%target-library-name(Swiftskell)
17-
// RUN: %target-run %t/E %t/%target-library-name(Swiftskell) | %FileCheck %s
17+
// RUN: %target-run %t/E %t/%target-library-name(Swiftskell) \
18+
// RUN: | %FileCheck %s --implicit-check-not destroy
1819

1920
// REQUIRES: executable_test
2021

@@ -27,6 +28,8 @@ struct File: ~Copyable, Show {
2728
self.id = id
2829
}
2930
func show() -> String { return id.show() }
31+
32+
deinit { print("destroying file \(id)") }
3033
}
3134

3235

@@ -43,11 +46,24 @@ func testListBasic() {
4346
check(items.length() == 5)
4447
check(!items.isEmpty)
4548

49+
items = List<File>(length: 5) { .init($0) }
50+
// CHECK: destroying file 4
51+
// CHECK: destroying file 3
52+
// CHECK: destroying file 2
53+
// CHECK: destroying file 1
54+
// CHECK: destroying file 0
55+
4656
items = items.reverse()
4757
check(items.length() == 5)
4858
print(items.show()) // CHECK: [4, 3, 2, 1, 0, ]
4959

5060
items = .empty
61+
// CHECK: destroying file 0
62+
// CHECK: destroying file 1
63+
// CHECK: destroying file 2
64+
// CHECK: destroying file 3
65+
// CHECK: destroying file 4
66+
5167
check(items.length() == 0)
5268
check(items.isEmpty)
5369

0 commit comments

Comments
 (0)