Permalink
Browse files

Small improvements in run-reallyasync-tests.js

  • Loading branch information...
1 parent 4e5f20f commit 325353dccf8f33f8d2e3bad467395b1643e81db4 @Sannis committed Aug 17, 2010
Showing with 8 additions and 9 deletions.
  1. +8 −9 tests/run-reallyasync-tests.js
@@ -22,7 +22,6 @@ var conn = mysql_libmysqlclient.createConnection(cfg.host, cfg.user, cfg.passwor
i;
var irc = cfg.insert_rows_count;
-irc = 50;
res = conn.query("DROP TABLE IF EXISTS " + cfg.test_table + ";");
res = conn.query("CREATE TABLE " + cfg.test_table +
@@ -35,33 +34,33 @@ if (!res) {
process.exit(1);
}
-sys.debug("Before 'for' loop");
+sys.puts("Start");
for (i = 0; i < irc; i += 1)
{
random_number = Math.round(Math.random() * 1000000);
random_boolean = (Math.random() > 0.5) ? 1 : 0;
- sys.debug("Before queryAsync #" + (i + 1));
+ sys.puts("\033[1ABefore queryAsync #" + (i + 1));
(function () {
var j = i;
conn.queryAsync("INSERT INTO " + cfg.test_table +
" (random_number, random_boolean) VALUES ('" + random_number +
"', '" + random_boolean + "');", function (result) {
- sys.debug("Callback #" + (j + 1));
+ sys.puts("\033[1ACallback #" + (j + 1));
});
- })();
+ })();
}
-sys.debug("After 'for' loop");
+sys.puts("Finish");
process.on('exit', function () {
- sys.puts("process.exit()");
+ sys.puts("onExit");
last_insert_id = conn.lastInsertId();
if (last_insert_id !== irc) {
- sys.debug(last_insert_id + " !== " + irc);
+ sys.puts("\033[31mFAIL: " + last_insert_id + " !== " + irc + "\033[39m");
} else {
- sys.debug("last_insert_id == irc");
+ sys.puts("\033[32mOK: last_insert_id == irc\033[39m");
}
conn.close();
});

0 comments on commit 325353d

Please sign in to comment.