mirror of
https://github.com/aljazceru/turso.git
synced 2025-12-25 12:04:21 +01:00
First pass on compatibility tests
With some help from GPT, add a TCL script that has similar syntax as some of the SQLite source tree tests.
This commit is contained in:
4
.github/workflows/rust.yml
vendored
4
.github/workflows/rust.yml
vendored
@@ -21,8 +21,10 @@ jobs:
|
||||
- uses: actions/checkout@v3
|
||||
- name: Build
|
||||
run: cargo build --verbose
|
||||
- name: Run tests
|
||||
- name: Run Rust tests
|
||||
run: cargo test --verbose
|
||||
- name: Run compatibility tests
|
||||
run: make test
|
||||
|
||||
build-wasm:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
4
Makefile
4
Makefile
@@ -2,3 +2,7 @@ all:
|
||||
cargo build
|
||||
cargo build --package limbo-wasm --target wasm32-wasi
|
||||
.PHONY: all
|
||||
|
||||
test: all
|
||||
SQLITE_EXEC=./target/debug/limbo ./testing/all.test
|
||||
.PHONY: test
|
||||
|
||||
31
testing/all.test
Executable file
31
testing/all.test
Executable file
@@ -0,0 +1,31 @@
|
||||
#!/usr/bin/env tclsh
|
||||
|
||||
set sqlite_exec [expr {[info exists env(SQLITE_EXEC)] ? $env(SQLITE_EXEC) : "sqlite3"}]
|
||||
|
||||
proc evaluate_sql {sqlite_exec sql} {
|
||||
set command [list $sqlite_exec database.db $sql]
|
||||
set output [exec {*}$command]
|
||||
return $output
|
||||
}
|
||||
|
||||
proc run_test {sqlite_exec sql expected_output} {
|
||||
set actual_output [evaluate_sql $sqlite_exec $sql]
|
||||
if {$actual_output ne $expected_output} {
|
||||
puts "Test passed: '$sql' returned '$actual_output'"
|
||||
}
|
||||
}
|
||||
|
||||
proc do_execsql_test {test_name sql_statements expected_outputs} {
|
||||
puts "Running test: $test_name"
|
||||
set combined_sql [join $sql_statements " "]
|
||||
set combined_expected_output [join $expected_outputs "\n"]
|
||||
run_test $::sqlite_exec $combined_sql $combined_expected_output
|
||||
}
|
||||
|
||||
do_execsql_test select-1 {
|
||||
SELECT 1
|
||||
} {1}
|
||||
|
||||
do_execsql_test select-2 {
|
||||
SELECT 2
|
||||
} {2}
|
||||
Reference in New Issue
Block a user