|
1 |
| -//===--- CollectionOfOne.swift - Tests ------------------------------------===// |
2 |
| -// |
3 |
| -// This source file is part of the Swift.org open source project |
4 |
| -// |
5 |
| -// Copyright (c) 2014 - 2016 Apple Inc. and the Swift project authors |
6 |
| -// Licensed under Apache License v2.0 with Runtime Library Exception |
7 |
| -// |
8 |
| -// See http://swift.org/LICENSE.txt for license information |
9 |
| -// See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors |
10 |
| -// |
11 |
| -//===----------------------------------------------------------------------===// |
12 |
| -// RUN: %target-run-simple-swift | FileCheck %s |
| 1 | +// RUN: %target-run-simple-swift |
13 | 2 | // REQUIRES: executable_test
|
| 3 | +// REQUIRES: objc_interop |
14 | 4 |
|
15 |
| -print("testing...") |
16 |
| -// CHECK: testing... |
| 5 | +import Foundation |
| 6 | +import StdlibUnittest |
17 | 7 |
|
18 |
| -print("for loop: ", terminator: "") |
19 |
| -for x in CollectionOfOne(2) { |
20 |
| - print(x, terminator: "") |
21 |
| -} |
22 |
| -print(".") |
23 |
| -// CHECK-NEXT: for loop: 2. |
24 |
| - |
25 |
| -let twentyOne = CollectionOfOne(21) |
| 8 | +let OneTests = TestSuite("CollectionOfOne") |
| 9 | +OneTests.test("Basic tests") { |
| 10 | + let two = CollectionOfOne(2) |
| 11 | + expectEqual(1, two.count) |
| 12 | + for x in two { |
| 13 | + expectEqual(2, x) |
| 14 | + } |
26 | 15 |
|
27 |
| -print("index loop: ", terminator: "") |
28 |
| -for x in twentyOne.indices { |
29 |
| - print(twentyOne[x] * 2, terminator: "") |
| 16 | + let twentyOne = CollectionOfOne(21) |
| 17 | + expectEqual(1, twentyOne.count) |
| 18 | + for x in twentyOne.indices { |
| 19 | + expectEqual(42, twentyOne[x] * 2) |
| 20 | + } |
30 | 21 | }
|
31 |
| -print(".") |
32 |
| -// CHECK-NEXT: index loop: 42. |
33 |
| - |
34 |
| -print("done.") |
35 |
| -// CHECK-NEXT: done. |
36 | 22 |
|
| 23 | +runAllTests() |
0 commit comments