Commit 4267d542 by King Koopa

Replaced process.nextTick with setImmediate in profile.test

parent a21226a1
...@@ -36,8 +36,9 @@ ...@@ -36,8 +36,9 @@
"url": "git://github.com/mapbox/node-sqlite3.git" "url": "git://github.com/mapbox/node-sqlite3.git"
}, },
"dependencies": { "dependencies": {
"nan": "1.1.2",
"node-pre-gyp": "0.5.13", "node-pre-gyp": "0.5.13",
"nan": "1.1.2" "set-immediate": "0.1.1"
}, },
"bundledDependencies": [ "bundledDependencies": [
"node-pre-gyp" "node-pre-gyp"
......
var sqlite3 = require('..'); var sqlite3 = require('..');
var assert = require('assert'); var assert = require('assert');
require('set-immediate');
describe('profiling', function() { describe('profiling', function() {
var create = false; var create = false;
...@@ -14,6 +15,7 @@ describe('profiling', function() { ...@@ -14,6 +15,7 @@ describe('profiling', function() {
if (sql.match(/^SELECT/)) { if (sql.match(/^SELECT/)) {
assert.ok(!select); assert.ok(!select);
assert.equal(sql, "SELECT * FROM foo"); assert.equal(sql, "SELECT * FROM foo");
console.log('profile select');
select = true; select = true;
} }
else if (sql.match(/^CREATE/)) { else if (sql.match(/^CREATE/)) {
...@@ -31,7 +33,7 @@ describe('profiling', function() { ...@@ -31,7 +33,7 @@ describe('profiling', function() {
assert.ok(!create); assert.ok(!create);
db.run("CREATE TABLE foo (id int)", function(err) { db.run("CREATE TABLE foo (id int)", function(err) {
if (err) throw err; if (err) throw err;
process.nextTick(function() { setImmediate(function() {
assert.ok(create); assert.ok(create);
done(); done();
}); });
...@@ -43,10 +45,10 @@ describe('profiling', function() { ...@@ -43,10 +45,10 @@ describe('profiling', function() {
assert.ok(!select); assert.ok(!select);
db.run("SELECT * FROM foo", function(err) { db.run("SELECT * FROM foo", function(err) {
if (err) throw err; if (err) throw err;
process.nextTick(function() { setImmediate(function() {
assert.ok(select); assert.ok(select);
done(); done();
}); }, 0);
}); });
}); });
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment