mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Rename ErrorType to ErrorProtocol
This commit is contained in:
committed by
Max Moiseev
parent
99d3f96c6d
commit
feacbc4433
27
test/Interpreter/enum_ErrorProtocol.swift
Normal file
27
test/Interpreter/enum_ErrorProtocol.swift
Normal file
@@ -0,0 +1,27 @@
|
||||
// RUN: %target-run-simple-swift
|
||||
// REQUIRES: executable_test
|
||||
|
||||
import StdlibUnittest
|
||||
|
||||
enum ClericalErrorDomain: ErrorProtocol {
|
||||
case MisplacedDocument(name: String)
|
||||
case AccidentallyErasedTape(fromMinute: Double, toMinute: Double)
|
||||
}
|
||||
|
||||
enum EmptyErrorDomain: ErrorProtocol {}
|
||||
|
||||
var EnumErrorProtocol = TestSuite("Enum ErrorProtocol derivation")
|
||||
|
||||
EnumErrorProtocol.test("default codes") {
|
||||
let a: ClericalErrorDomain = .MisplacedDocument(name: "check-in times.doc")
|
||||
let b: ClericalErrorDomain
|
||||
= .AccidentallyErasedTape(fromMinute: 5, toMinute: 23.5)
|
||||
expectEqual(a._domain, "main.ClericalErrorDomain")
|
||||
expectEqual(b._domain, "main.ClericalErrorDomain")
|
||||
|
||||
expectEqual(a._code, 0)
|
||||
expectEqual(b._code, 1)
|
||||
}
|
||||
|
||||
runAllTests()
|
||||
|
||||
Reference in New Issue
Block a user