From 012d2a13f544d1fbe4bbbacfabd8ee837fb3c3c5 Mon Sep 17 00:00:00 2001 From: brianc Date: Thu, 30 Sep 2010 22:48:50 -0500 Subject: [PATCH] parsing a single row description --- lib/index.js | 4 ++-- test/parser-tests.js | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/index.js b/lib/index.js index 68494645..19cd6ea6 100644 --- a/lib/index.js +++ b/lib/index.js @@ -191,12 +191,12 @@ p.parseT = function() { msg.fieldCount = this.readInt16(); msg.fields = []; for(var i = 0; i < msg.fieldCount; i++){ - msg.fields[i] = this.parseRow(); + msg.fields[i] = this.parseField(); } return msg; }; -p.parseRow = function() { +p.parseField = function() { var row = { name: this.parseCString(), tableID: this.readInt32(), diff --git a/test/parser-tests.js b/test/parser-tests.js index eebc6905..dbfdccbb 100644 --- a/test/parser-tests.js +++ b/test/parser-tests.js @@ -97,6 +97,7 @@ test('Parser on single messages', function() { assert.equal(result.fields.length, 0); }); + var oneRowDescBuff = new BufferList() .addInt16(1) .addCString('id') //field name @@ -105,15 +106,14 @@ test('Parser on single messages', function() { .addInt32(3) //objectId of field's data type .addInt16(4) //datatype size .addInt32(5) //type modifier - .addInt32(0) //format code, 0 => text + .addInt16(0) //format code, 0 => text .join(true,'T'); - console.log(oneRowDescBuff); test('parses single row description',function() { var result = new Parser(oneRowDescBuff).parse()[0]; assert.same(result, { name: 'RowDescription', id: 'T', - length: 29, + length: 27, fieldCount: 1 }); });