From 730355040d8da52671c4103606bcf1d4671c4bf2 Mon Sep 17 00:00:00 2001 From: brianc Date: Wed, 30 May 2012 22:50:12 -0500 Subject: [PATCH] add failing test for #131 --- test/integration/gh-issues/131.js | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 test/integration/gh-issues/131.js diff --git a/test/integration/gh-issues/131.js b/test/integration/gh-issues/131.js new file mode 100644 index 00000000..74f35c12 --- /dev/null +++ b/test/integration/gh-issues/131.js @@ -0,0 +1,19 @@ +var helper = require(__dirname + "/../test-helper"); +var pg = helper.pg; + +test('parsing array results', function() { + pg.connect(helper.config, assert.calls(function(err, client) { + assert.isNull(err); + client.query("CREATE TEMP TABLE why(names text[], numbors integer[], decimals double precision[])"); + client.query('INSERT INTO why(names, numbors, decimals) VALUES(\'{"aaron", "brian","a b c" }\', \'{1, 2, 3}\', \'{.1, 0.05, 3.654}\')').on('error', console.log); + test('decimals', function() { + client.query('SELECT decimals FROM why', assert.success(function(result) { + assert.lengthIs(result.rows[0].decimals, 3); + assert.equal(result.rows[0].decimals[0], 0.1); + assert.equal(result.rows[0].decimals[1], 0.05); + assert.equal(result.rows[0].decimals[2], 3.654); + pg.end(); + })) + }) + })) +})