mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
29 lines
700 B
Swift
29 lines
700 B
Swift
// RUN: %target-run-simple-swift
|
|
// REQUIRES: executable_test
|
|
|
|
import StdlibUnittest
|
|
import Swift
|
|
|
|
// Also import modules which are used by StdlibUnittest internally. This
|
|
// workaround is needed to link all required libraries in case we compile
|
|
// StdlibUnittest with -sil-serialize-all.
|
|
#if _runtime(_ObjC)
|
|
import ObjectiveC
|
|
#endif
|
|
|
|
let RepeatTests = TestSuite("Repeat")
|
|
RepeatTests.test("Attributes") {
|
|
let r = repeatElement("repeat", count: 42)
|
|
expectEqual(r.count, 42)
|
|
expectEqual(r.startIndex, 0)
|
|
expectEqual(r.endIndex, 42)
|
|
expectEqual(r.repeatedValue, "repeat")
|
|
}
|
|
|
|
RepeatTests.test("Non-negative count") {
|
|
expectCrashLater()
|
|
repeatElement("repeat", count: -42)
|
|
}
|
|
|
|
runAllTests()
|