Files
swift-mirror/test/1_stdlib/Repeat.swift
2016-01-22 18:41:19 -08:00

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()