diff options
author | Brendan Ashworth <brendan.ashworth@me.com> | 2015-08-18 11:11:28 -0700 |
---|---|---|
committer | Brendan Ashworth <brendan.ashworth@me.com> | 2015-08-20 00:48:37 -0700 |
commit | 04722d14cae0a9f2f593374f9a8833c6d49f8a21 (patch) | |
tree | fc0ad653ee424ef010935f8d3b60889ad588af95 /test | |
parent | 8f58fb92fff904a6ca58fd0df9ee5a1816e5b84e (diff) | |
download | android-node-v8-04722d14cae0a9f2f593374f9a8833c6d49f8a21.tar.gz android-node-v8-04722d14cae0a9f2f593374f9a8833c6d49f8a21.tar.bz2 android-node-v8-04722d14cae0a9f2f593374f9a8833c6d49f8a21.zip |
test: improve test-net-pingpong
This includes the following changes:
- a more strict data check rather than a regex
- reduced number of annoying log calls
The most important of the changes is the annoying log calls, which
speeds up the test execution from about 0m1.130s to 0m0.481s on my
machine.
PR-URL: https://github.com/nodejs/node/pull/2429
Reviewed-By: Rich Trott <rtrott@gmail.com>
Diffstat (limited to 'test')
-rw-r--r-- | test/parallel/test-net-pingpong.js | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/test/parallel/test-net-pingpong.js b/test/parallel/test-net-pingpong.js index 9a0c8af5b0..be7dfa4359 100644 --- a/test/parallel/test-net-pingpong.js +++ b/test/parallel/test-net-pingpong.js @@ -27,20 +27,17 @@ function pingPongTest(port, host) { // than one message. assert.ok(0 <= socket.bufferSize && socket.bufferSize <= 4); - console.log('server got: ' + data); assert.equal(true, socket.writable); assert.equal(true, socket.readable); assert.equal(true, count <= N); - if (/PING/.exec(data)) { - socket.write('PONG', function() { - sentPongs++; - console.error('sent PONG'); - }); - } + assert.equal(data, 'PING'); + + socket.write('PONG', function() { + sentPongs++; + }); }); socket.on('end', function() { - console.error(socket); assert.equal(true, socket.allowHalfOpen); assert.equal(true, socket.writable); // because allowHalfOpen assert.equal(false, socket.readable); @@ -73,8 +70,6 @@ function pingPongTest(port, host) { }); client.on('data', function(data) { - console.log('client got: ' + data); - assert.equal('PONG', data); count += 1; |