Skip to content

Commit fe3599d

Browse files
committed
add test for parsing double encoded utf8
1 parent 8d22de9 commit fe3599d

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

SocketIO-MacTests/SocketEngineTest.swift

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,4 +74,18 @@ class SocketEngineTest: XCTestCase {
7474
engine.parseEngineMessage("afafafda", fromPolling: false)
7575
waitForExpectationsWithTimeout(3, handler: nil)
7676
}
77+
78+
func testEngineDecodesUTF8Properly() {
79+
let expectation = expectationWithDescription("Engine Decodes utf8")
80+
81+
client.on("stringTest") {data, ack in
82+
if let str = data[0] as? String {
83+
assert(str == "lïne one\nlīne \rtwo", "Failed string test")
84+
expectation.fulfill()
85+
}
86+
}
87+
88+
engine.parsePollingMessage("41:42[\"stringTest\",\"lïne one\\nlīne \\rtwo\"]")
89+
waitForExpectationsWithTimeout(3, handler: nil)
90+
}
7791
}

0 commit comments

Comments
 (0)