Skip to content

Commit 9433c39

Browse files
committed
Merge pull request #2894 from frootloops/collection-of-one
2 parents 8782b71 + 13f83a0 commit 9433c39

File tree

1 file changed

+17
-30
lines changed

1 file changed

+17
-30
lines changed

test/1_stdlib/CollectionOfOne.swift

Lines changed: 17 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,23 @@
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
132
// REQUIRES: executable_test
3+
// REQUIRES: objc_interop
144

15-
print("testing...")
16-
// CHECK: testing...
5+
import Foundation
6+
import StdlibUnittest
177

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+
}
2615

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+
}
3021
}
31-
print(".")
32-
// CHECK-NEXT: index loop: 42.
33-
34-
print("done.")
35-
// CHECK-NEXT: done.
3622

23+
runAllTests()

0 commit comments

Comments
 (0)