Permalink
Browse files

test

  • Loading branch information...
1 parent fde542c commit 3b4166766df8eea399917079fec3dd9a242d716c @isaacs committed Mar 31, 2013
Showing with 25 additions and 0 deletions.
  1. +25 −0 test.js
View
25 test.js
@@ -0,0 +1,25 @@
+// vim: set softtabstop=3 shiftwidth=3:
+var HttpDuplex = require ('./client.js')
+var fs = require ('fs')
+var input = fs . createReadStream (__filename)
+var http = require ('http')
+var assert = require ('assert')
+
+var server = http . createServer (function (req, res) {
+ req . pipe (res)
+ server . close ()
+})
+
+server . listen (1337, function () {
+ var req = HttpDuplex ({ port: 1337, method: 'POST' })
+ input . pipe (req)
+ var result = ''
+ req . setEncoding ('utf8')
+ req . on ('data', function (c) {
+ result += c
+ })
+ req . on ('end', function () {
+ assert . equal (result, fs . readFileSync (__filename, 'utf8'))
+ console . log ('ok')
+ })
+})

1 comment on commit 3b41667

stagas commented on 3b41667 Apr 1, 2013

Clearly a reaction to being forced to use Google code style in your day job.

Please sign in to comment.