以下测试中的第3个失败:
specify { (0.6*2).should eql(1.2) }
specify { (0.3*3).should eql(0.3*3) }
specify { (0.3*3).should eql(0.9) } # this one fails
Run Code Online (Sandbox Code Playgroud)
这是为什么?这是浮点问题还是ruby或rspec问题?
以下代码编译错误: Error:(112, 20) type '(String, Int)' does not conform to protocol 'AnyObject'
func myMethode() {
aMethodeThatICanNotChange {
let a = ("John",7)
return a // Error:(112, 20) type '(String, Int)' does not conform to protocol 'AnyObject'
}
}
func aMethodeThatICanNotChange(closure: () -> AnyObject) {
// do something with closure
}
Run Code Online (Sandbox Code Playgroud)
如何将元组转换/转换为AnyObject?