Files
swift-mirror/test/Sema/enum_raw_representable_migrate.swift
Dmitri Hrybenko 3b04d1b013 tests: reorganize tests so that they actually use the target platform
Most tests were using %swift or similar substitutions, which did not
include the target triple and SDK.  The driver was defaulting to the
host OS.  Thus, we could not run the tests when the standard library was
not built for OS X.

Swift SVN r24504
2015-01-19 06:52:49 +00:00

15 lines
768 B
Swift

// RUN: %target-parse-verify-swift
// Test Fix-Its to migrate fromRaw/toRaw to the failable initializer
// and rawValue property, respectively.
enum Color : Int {
case Red = 0, Green = 1, Blue = 2
}
let color: Color = Color.fromRaw(1)! // expected-error{{static method 'fromRaw' has been replaced with a failable initializer 'init(rawValue:)'}}{{25-34=(rawValue: }}
let i = color.toRaw() // expected-error{{method 'fromRaw' has been replaced with a property 'rawValue'}}{{15-22=rawValue}}
let i2 = Color.fromRaw(2)!.toRaw()
// expected-error @-1{{static method 'fromRaw' has been replaced with a failable initializer 'init(rawValue:)'}}{{15-24=(rawValue: }}
// expected-error @-2{{method 'fromRaw' has been replaced with a property 'rawValue'}}{{28-35=rawValue}}