Permalink
Browse files

Fix writing empty netstring

  • Loading branch information...
1 parent 41dbf25 commit bfc0c2cc7f0d9613ee891647e27b7ca5ccd61906 @josh josh committed with Sep 28, 2010
Showing with 2 additions and 1 deletion.
  1. +1 −1 lib/ns.js
  2. +1 −0 test/test.js
View
@@ -126,7 +126,7 @@ var nsWrite = function(pay, payStart, payEnd, buf, bufOff) {
payEnd = (payEnd === undefined) ? pay.length : payEnd;
bufOff = bufOff || 0;
- if (payStart < 0 || payStart >= pay.length) {
+ if (payStart < 0 || payStart > pay.length) {
throw new Error('payStart is out of bounds');
}
View
@@ -127,6 +127,7 @@ var ns = require('../lib/ns');
ts.addTests({
'simple' : function(as) {
+ as.equal(ns.nsWrite(''), '0:,');
as.equal(ns.nsWrite('abc'), '3:abc,');
as.equal(ns.nsWrite('a'), '1:a,');
},

0 comments on commit bfc0c2c

Please sign in to comment.