Files
swift-mirror/test/1_stdlib/DictionaryUnchecked.swift
Graham Batty 83b4384fac Update test flags for linux failures and support.
Also removed the sdk 'feature' in favour of the more specific
objc_interop.

Swift SVN r24856
2015-01-30 21:31:48 +00:00

33 lines
760 B
Swift

// RUN: mkdir -p %t
// RUN: %target-build-swift %s -o %t/a.out -Ounchecked
//
// RUN: %target-run %t/a.out
// XFAIL: linux
import StdlibUnittest
var DictionaryUnchecked = TestSuite("DictionaryUnchecked")
DictionaryUnchecked.test("noCseOnInit") {
@inline(never)
func createDict() -> Dictionary<Int, Bool> {
// CSE should not be able to combine both Dictionary.init() calls.
// This did happen and resulted in a crash because Dictionary.init()
// was defined with @effects(readnone).
// But this was wrong because it actually reads the array buffer (from
// the literal).
var Dict: Dictionary<Int, Bool> = [:]
Dict = [:]
Dict[0] = true
return Dict
}
let Dict = createDict()
expectTrue(Dict[0]!)
}
runAllTests()