Skip to content

Commit 2bbe513

Browse files
Shapovalov KirillShapovalov Kirill
authored andcommitted
Fix test_functions_recreate console output
1 parent ac2d435 commit 2bbe513

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

test/test_functions_recreate.js

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
exports.test = function(sql, assert) {
22
// Test 1: Create a database, Register single function, close database, repeat 1000 times
3+
34
for (var i = 1; i <= 1000; i++)
45
{
6+
let lastStep=(i==1000);
57
let db = new sql.Database();
68
function add() {return i;}
79
try
@@ -14,15 +16,17 @@ exports.test = function(sql, assert) {
1416
}
1517
var result = db.exec("SELECT TestFunction"+i+"()");
1618
var result_str = result[0]["values"][0][0];
17-
assert.equal(result_str, i, "Test 1: Recreate database "+i+"th times and register function");
19+
if((result_str!=i)||(lastStep))
20+
assert.equal(result_str, i, "Test 1: Recreate database "+i+"th times and register function");
1821
db.close();
1922
}
2023

21-
// Test 2: Create a database, Register same function 1000 times, close database, repeat
24+
// Test 2: Create a database, Register same function 1000 times, close database
2225
{
2326
let db = new sql.Database();
2427
for (var i = 1; i <= 1000; i++)
2528
{
29+
let lastStep=(i==1000);
2630
function add() {return i;}
2731
try
2832
{
@@ -34,7 +38,8 @@ exports.test = function(sql, assert) {
3438
}
3539
var result = db.exec("SELECT TestFunction()");
3640
var result_str = result[0]["values"][0][0];
37-
assert.equal(result_str, i, "Test 2: Reregister function "+i+"th times");
41+
if((result_str!=i)||(lastStep))
42+
assert.equal(result_str, i, "Test 2: Reregister function "+i+"th times");
3843
}
3944
db.close();
4045
}
@@ -46,7 +51,7 @@ if (module == require.main) {
4651
const sql_loader = require('./load_sql_lib');
4752
sql_loader(target_file).then((sql)=>{
4853
require('test').run({
49-
'test functions recreeate': function(assert){
54+
'test creating multiple functions': function(assert){
5055
exports.test(sql, assert);
5156
}
5257
});

0 commit comments

Comments
 (0)