Debian Codegraph @

test/qrf02.test

raw
1 # 2025-11-05
2 #
3 # The author disclaims copyright to this source code. In place of
4 # a legal notice, here is a blessing:
5 #
6 # May you do good and not evil.
7 # May you find forgiveness for yourself and forgive others.
8 # May you share freely, never taking more than you give.
9 #
10 #***********************************************************************
11 #
12 # Test cases for the Query Result Formatter (QRF)
13 #
14 # These tests are for EXPLAIN and EXPLAIN QUERY PLAN formatting, the
15 # output of which can change when enhancments are made to the query
16 # planner. So expect to have to modify the expected results of these
17 # test cases in the future.
18 #
19
20 set testdir [file dirname $argv0]
21 source $testdir/tester.tcl
22 set testprefix qrf02
23
24 do_execsql_test 1.0 {
25 CREATE TABLE t1(a);
26 INSERT INTO t1 VALUES(1);
27 }
28
29 set result [db format {EXPLAIN SELECT * FROM t1}]
30 do_test 1.10 {
31 set result
32 } {/*addr opcode p1 p2 p3 p4 p5 comment
33 ---- ------------- ---- ---- ---- ------------- -- -------------
34 0 Init */}
35 regsub -all {\d+} $result {N} result2
36 do_test 1.11 {
37 set result2
38 } "/.*\nN Rewind .*\nN Column .*/"
39
40 do_test 1.20 {
41 set result "\n[db format {EXPLAIN QUERY PLAN SELECT * FROM t1}]"
42 } {
43 QUERY PLAN
44 `--SCAN t1
45 }
46
47 finish_test