From 42e27e857cd59aa4b4895e44b975deebf52abedd Mon Sep 17 00:00:00 2001 From: Guillermo Rauch Date: Sat, 3 Sep 2011 13:26:22 -0700 Subject: [PATCH] Added unicode tests. --- support/test-runner/app.js | 10 ++++++++++ test/socket.test.js | 15 +++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/support/test-runner/app.js b/support/test-runner/app.js index 540ef72a9..167430ae3 100644 --- a/support/test-runner/app.js +++ b/support/test-runner/app.js @@ -296,4 +296,14 @@ suite('socket.test.js', function () { }); }); + server('test sending unicode', function (io) { + io.sockets.on('connection', function (socket) { + socket.on('message', function (msg) { + if (msg.test == "\u2028") { + socket.emit('done'); + } + }); + }); + }); + }); diff --git a/test/socket.test.js b/test/socket.test.js index 79a2fdc1b..53c967e45 100644 --- a/test/socket.test.js +++ b/test/socket.test.js @@ -336,6 +336,21 @@ socket.send('\n'); + socket.on('done', function () { + socket.disconnect(); + next(); + }); + }, + + 'test sending unicode': function (next) { + var socket = create(); + + socket.on('error', function (msg) { + throw new Error(msg || 'Received an error'); + }); + + socket.json.send({ test: "\u2028" }); + socket.on('done', function () { socket.disconnect(); next();