add test for parsing double encoded utf8

This commit is contained in:
Erik 2016-01-29 13:06:56 -05:00
parent 8d22de967e
commit fe3599d1fe

View File

@ -74,4 +74,18 @@ class SocketEngineTest: XCTestCase {
engine.parseEngineMessage("afafafda", fromPolling: false)
waitForExpectationsWithTimeout(3, handler: nil)
}
func testEngineDecodesUTF8Properly() {
let expectation = expectationWithDescription("Engine Decodes utf8")
client.on("stringTest") {data, ack in
if let str = data[0] as? String {
assert(str == "lïne one\nlīne \rtwo", "Failed string test")
expectation.fulfill()
}
}
engine.parsePollingMessage("41:42[\"stringTest\",\"lïne one\\nlīne \\rtwo\"]")
waitForExpectationsWithTimeout(3, handler: nil)
}
}