| 1 |
# 2025-11-12 |
| 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 |
# TESTRUNNER: shell |
| 12 |
# |
| 13 |
# Test cases for the command-line shell using the newly renovated |
| 14 |
# ".testcase" and ".check" commands. |
| 15 |
# |
| 16 |
|
| 17 |
set testdir [file dirname $argv0] |
| 18 |
source $testdir/tester.tcl |
| 19 |
set CLI [test_cli_invocation] |
| 20 |
|
| 21 |
# Run an instance of the CLI on the file $name. |
| 22 |
# Capture the number of test cases and the number of |
| 23 |
# errors and increment the counts. |
| 24 |
# |
| 25 |
proc do_clitest {name} { |
| 26 |
set mapping [list <NAME> $::testdir/$name <CLI> $::CLI] |
| 27 |
set script [string map $mapping { |
| 28 |
catch {exec <CLI> :memory: ".read <NAME>" 2>@stdout} res |
| 29 |
set ntest 0 |
| 30 |
set nerr 999 |
| 31 |
regexp {(\d+) tests? run with (\d+) errors?} $res all ntest nerr |
| 32 |
set_test_counter count [expr {[set_test_counter count]+$ntest-1}] |
| 33 |
set_test_counter errors [expr {[set_test_counter errors]+$nerr}] |
| 34 |
if {$nerr==0} {set res "error count: 0"} |
| 35 |
set res |
| 36 |
}] |
| 37 |
# puts $script |
| 38 |
do_test shellB-$name $script {error count: 0} |
| 39 |
} |
| 40 |
|
| 41 |
do_clitest modeA.sql |
| 42 |
do_clitest dblwidth-a.sql |
| 43 |
do_clitest vt100-a.sql |
| 44 |
do_clitest regexp1.sql |
| 45 |
do_clitest imposter1.sql |
| 46 |
ifcapable vtab { |
| 47 |
do_clitest dotcmd01.sql |
| 48 |
do_clitest import01.sql |
| 49 |
do_clitest intck01.sql |
| 50 |
} |
| 51 |
do_clitest fptest01.sql |
| 52 |
|
| 53 |
finish_test |