forked from swiftlang/swift
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCollectionOfOne.swift
36 lines (30 loc) · 1000 Bytes
/
CollectionOfOne.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
//===--- CollectionOfOne.swift - Tests ------------------------------------===//
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2014 - 2015 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See http://swift.org/LICENSE.txt for license information
// See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
//
//===----------------------------------------------------------------------===//
// RUN: %target-run-simple-swift | FileCheck %s
// REQUIRES: executable_test
print("testing...")
// CHECK: testing...
print("for loop: ", terminator: "")
for x in CollectionOfOne(2) {
print(x, terminator: "")
}
print(".")
// CHECK-NEXT: for loop: 2.
let twentyOne = CollectionOfOne(21)
print("index loop: ", terminator: "")
for x in twentyOne.indices {
print(twentyOne[x] * 2, terminator: "")
}
print(".")
// CHECK-NEXT: index loop: 42.
print("done.")
// CHECK-NEXT: done.