diff --git a/Makefile b/Makefile index b4885d14..0a3bd679 100644 --- a/Makefile +++ b/Makefile @@ -14,7 +14,7 @@ node-command := xargs -n 1 -I file node file $(params) .PHONY : test test-connection test-integration bench test-native build/default/binding.node test: test-unit -test-all: test-unit test-integration test-native +test-all: test-unit test-integration test-native test-binary bench: @find benchmark -name "*-bench.js" | $(node-command) @@ -28,6 +28,9 @@ test-unit: test-connection: @node script/test-connection.js $(params) +test-connection-binary: + @node script/test-connection.js $(params) --binary true + test-native: build/default/binding.node @echo "***Testing native bindings***" @find test/native -name "*-tests.js" | $(node-command) @@ -36,3 +39,7 @@ test-native: build/default/binding.node test-integration: test-connection @echo "***Testing Pure Javascript***" @find test/integration -name "*-tests.js" | $(node-command) + +test-binary: test-connection-binary + @echo "***Testing Pure Javascript (binary)***" + @find test/integration -name "*-tests.js" | $(node-command) --binary true diff --git a/test/integration/client/empty-query-tests.js b/test/integration/client/empty-query-tests.js index 475acf79..3eb207c4 100644 --- a/test/integration/client/empty-query-tests.js +++ b/test/integration/client/empty-query-tests.js @@ -5,11 +5,11 @@ test("empty query message handling", function() { assert.emits(client, 'drain', function() { client.end(); }); - client.query(""); + client.query({text: "", binary: false}); }); test('callback supported', assert.calls(function() { - client.query("", function(err, result) { + client.query({text: "", binary: false}, function(err, result) { assert.isNull(err); assert.empty(result.rows); }) diff --git a/test/integration/client/error-handling-tests.js b/test/integration/client/error-handling-tests.js index 4f1cb0cf..0a855238 100644 --- a/test/integration/client/error-handling-tests.js +++ b/test/integration/client/error-handling-tests.js @@ -30,7 +30,7 @@ test('error handling', function(){ var client = createErorrClient(); - var q = client.query("CREATE TEMP TABLE boom(age integer); INSERT INTO boom (age) VALUES (28);"); + var q = client.query({text: "CREATE TEMP TABLE boom(age integer); INSERT INTO boom (age) VALUES (28);", binary: false}); test("when query is parsing", function() { diff --git a/test/integration/client/simple-query-tests.js b/test/integration/client/simple-query-tests.js index da573d43..2edabd73 100644 --- a/test/integration/client/simple-query-tests.js +++ b/test/integration/client/simple-query-tests.js @@ -37,7 +37,7 @@ test("simple query interface", function() { test("multiple simple queries", function() { var client = helper.client(); - client.query("create temp table bang(id serial, name varchar(5));insert into bang(name) VALUES('boom');") + client.query({ text: "create temp table bang(id serial, name varchar(5));insert into bang(name) VALUES('boom');", binary: false }) client.query("insert into bang(name) VALUES ('yes');"); var query = client.query("select name from bang"); assert.emits(query, 'row', function(row) { @@ -51,9 +51,9 @@ test("multiple simple queries", function() { test("multiple select statements", function() { var client = helper.client(); - client.query("create temp table boom(age integer); insert into boom(age) values(1); insert into boom(age) values(2); insert into boom(age) values(3)"); - client.query("create temp table bang(name varchar(5)); insert into bang(name) values('zoom');"); - var result = client.query("select age from boom where age < 2; select name from bang"); + client.query({text: "create temp table boom(age integer); insert into boom(age) values(1); insert into boom(age) values(2); insert into boom(age) values(3)", binary: false}); + client.query({text: "create temp table bang(name varchar(5)); insert into bang(name) values('zoom');", binary: false}); + var result = client.query({text: "select age from boom where age < 2; select name from bang", binary: false}); assert.emits(result, 'row', function(row) { assert.strictEqual(row['age'], 1); assert.emits(result, 'row', function(row) { diff --git a/test/integration/client/type-coercion-tests.js b/test/integration/client/type-coercion-tests.js index c8f39991..fab12c6d 100644 --- a/test/integration/client/type-coercion-tests.js +++ b/test/integration/client/type-coercion-tests.js @@ -79,6 +79,13 @@ var types = [{ values: ['13:12:12.321', null] }]; +// ignore some tests in binary mode +if (helper.config.binary) { + types = types.filter(function(type) { + return !(type.name in {'real':1, 'timetz':1, 'time':1}); + }); +} + var valueCount = 0; types.forEach(function(type) { valueCount += type.values.length; diff --git a/test/integration/connection-pool/unique-name-tests.js b/test/integration/connection-pool/unique-name-tests.js index 6893fbd7..a92a0041 100644 --- a/test/integration/connection-pool/unique-name-tests.js +++ b/test/integration/connection-pool/unique-name-tests.js @@ -6,6 +6,7 @@ helper.pg.defaults.password = helper.args.password; helper.pg.defaults.database = helper.args.database; helper.pg.defaults.port = helper.args.port; helper.pg.defaults.host = helper.args.host; +helper.pg.defaults.binary = helper.args.binary; helper.pg.defaults.poolIdleTimeout = 100; var moreArgs = {};