dimanche 8 février 2015

Printable protocol for enum doesn't work in unit tests

It seems that println ignores Printable protocol not only in Playground but in unit tests too. Is it true or I do something wrong?


Here is my code snippet:



class ExampleTests: XCTestCase {

enum Directions: Printable {
case North

var description: String {
get {
switch self {
case .North:
return "North"
}
}
}
}

override func setUp() {
let direction = Directions.North
println(direction)
super.setUp()
}
}


In console I see (Enum Value) instead of North.


I could not find the answer in the relevant question into so and tried to google it as well.


Note. If I move this code into my ViewController, it'll work fine. Looks weird for me.


Aucun commentaire:

Enregistrer un commentaire