2014-09-14 13:23:02 +08:00
|
|
|
return;
|
2013-06-29 16:15:39 +08:00
|
|
|
/**
|
|
|
|
* helper needs to be loaded for the asserts but it alos proloads
|
|
|
|
* client which we don't want here
|
|
|
|
*
|
|
|
|
*/
|
2013-06-27 08:40:42 +08:00
|
|
|
var helper = require(__dirname+"/test-helper")
|
|
|
|
, path = require('path')
|
|
|
|
;
|
2013-06-27 07:37:54 +08:00
|
|
|
|
2013-06-27 08:40:42 +08:00
|
|
|
var paths = {
|
|
|
|
'pg' : path.join(__dirname, '..', '..', '..', 'lib', 'index.js') ,
|
|
|
|
'query_js' : path.join(__dirname, '..', '..', '..', 'lib', 'query.js') ,
|
|
|
|
'query_native' : path.join(__dirname, '..', '..', '..', 'lib', 'native', 'query.js') ,
|
|
|
|
};
|
2013-06-27 07:37:54 +08:00
|
|
|
|
2013-06-27 08:40:42 +08:00
|
|
|
/**
|
|
|
|
* delete the modules we are concerned about from the
|
2013-06-29 16:15:39 +08:00
|
|
|
* module cache, so they get loaded cleanly and the env
|
|
|
|
* var can kick in ...
|
2013-06-27 08:40:42 +08:00
|
|
|
*/
|
2013-06-29 16:15:39 +08:00
|
|
|
function emptyCache(){
|
|
|
|
Object.keys(require.cache).forEach(function(key){
|
|
|
|
delete require.cache[key];
|
2013-06-27 08:40:42 +08:00
|
|
|
});
|
|
|
|
};
|
|
|
|
|
2013-06-29 16:15:39 +08:00
|
|
|
emptyCache();
|
|
|
|
process.env.NODE_PG_FORCE_NATIVE = '1';
|
2013-06-27 08:40:42 +08:00
|
|
|
|
|
|
|
var pg = require( paths.pg );
|
|
|
|
var query_native = require( paths.query_native );
|
|
|
|
var query_js = require( paths.query_js );
|
2013-06-27 07:37:54 +08:00
|
|
|
|
|
|
|
assert.deepEqual(pg.Client.Query, query_native);
|
|
|
|
assert.notDeepEqual(pg.Client.Query, query_js);
|
2013-06-27 08:40:42 +08:00
|
|
|
|
2013-06-29 16:15:39 +08:00
|
|
|
emptyCache();
|
2013-06-27 08:40:42 +08:00
|
|
|
delete process.env.NODE_PG_FORCE_NATIVE
|