Skip to content

Commit 58bfcbe

Browse files
authored
Merge pull request #71742 from kubamracek/embedded-lazy
[embedded] Add a test exercising lazy collections
2 parents 1c03d5b + 0aa7bf2 commit 58bfcbe

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

test/embedded/lazy-collections.swift

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// RUN: %target-run-simple-swift(-parse-as-library -enable-experimental-feature Embedded -runtime-compatibility-version none -wmo -Xfrontend -disable-objc-interop) | %FileCheck %s
2+
3+
// REQUIRES: swift_in_compiler
4+
// REQUIRES: executable_test
5+
// REQUIRES: optimized_stdlib
6+
// REQUIRES: OS=macosx || OS=linux-gnu
7+
8+
@main
9+
struct Main {
10+
static func main() {
11+
[1, 2, 3].lazy.filter { $0 % 2 == 0 }.forEach { print($0, terminator: " ") }
12+
print("")
13+
// CHECK: 2
14+
15+
[1, 2, 3].lazy.map { $0 * 2 }.forEach { print($0, terminator: " ") }
16+
print("")
17+
// CHECK: 2 4 6
18+
}
19+
}

0 commit comments

Comments
 (0)