aboutsummaryrefslogtreecommitdiff
path: root/ext/wasm/SQLTester/SQLTester.run.mjs
diff options
context:
space:
mode:
authorstephan <stephan@noemail.net>2023-08-29 20:01:01 +0000
committerstephan <stephan@noemail.net>2023-08-29 20:01:01 +0000
commitaa150477961c57bc0c873faf95f0bc600fc73af6 (patch)
tree6ab70c041e2a73e4004bb119a30ee6619c308e2f /ext/wasm/SQLTester/SQLTester.run.mjs
parent69a55ca17dc711a9b75eb738ab32336936d69fd7 (diff)
downloadsqlite-aa150477961c57bc0c873faf95f0bc600fc73af6.tar.gz
sqlite-aa150477961c57bc0c873faf95f0bc600fc73af6.zip
JS SQLTestRunner can now run the Java impl's core-most sanity tests, missing only support for directives.
FossilOrigin-Name: 5e798369375ce1b0c9cdf831f835d931fbd562ff7b4db09a06d1bdca2ac1b975
Diffstat (limited to 'ext/wasm/SQLTester/SQLTester.run.mjs')
-rw-r--r--ext/wasm/SQLTester/SQLTester.run.mjs53
1 files changed, 43 insertions, 10 deletions
diff --git a/ext/wasm/SQLTester/SQLTester.run.mjs b/ext/wasm/SQLTester/SQLTester.run.mjs
index dc8eaa0c1..36d1ab5dc 100644
--- a/ext/wasm/SQLTester/SQLTester.run.mjs
+++ b/ext/wasm/SQLTester/SQLTester.run.mjs
@@ -25,14 +25,46 @@ log("ns =",ns);
out("Hi there. ").outln("SQLTester is ostensibly ready.");
let ts = new ns.TestScript('/foo.test', ns.Util.utf8Encode(
-`# comment line
---print Starting up...
---null NIL
---new :memory:
---testcase 0.0.1
-select '0.0.1';
-#--result 0.0.1
---print done
+`
+--close all
+--oom
+--db 0
+--new my.db
+--null zilch
+--testcase 1.0
+SELECT 1, null;
+--result 1 zilch
+--glob *zil*
+--notglob *ZIL*
+SELECT 1, 2;
+intentional error;
+--run
+--testcase json-1
+SELECT json_array(1,2,3)
+--json [1,2,3]
+--testcase tableresult-1
+ select 1, 'a';
+ select 2, 'b';
+--tableresult
+ # [a-z]
+ 2 b
+--end
+--testcase json-block-1
+ select json_array(1,2,3);
+ select json_object('a',1,'b',2);
+--json-block
+ [1,2,3]
+ {"a":1,"b":2}
+--end
+--testcase col-names-on
+--column-names 1
+ select 1 as 'a', 2 as 'b';
+--result a 1 b 2
+--testcase col-names-off
+--column-names 0
+ select 1 as 'a', 2 as 'b';
+--result 1 2
+--close
`));
const sqt = new ns.SQLTester();
@@ -41,11 +73,12 @@ try{
sqt.openDb('/foo.db', true);
log( 'sqt.getCurrentDb()', sqt.getCurrentDb() );
sqt.verbosity(0);
- affirm( 'NIL' !== sqt.nullValue() );
+ affirm( 'zilch' !== sqt.nullValue() );
ts.run(sqt);
- affirm( 'NIL' === sqt.nullValue() );
+ affirm( 'zilch' === sqt.nullValue() );
}finally{
sqt.reset();
}
log( 'sqt.getCurrentDb()', sqt.getCurrentDb() );
+log( "Metrics:", sqt.metrics );