mirror of
https://github.com/aljazceru/turso.git
synced 2025-12-20 09:54:19 +01:00
`BTreeTable::to_sql` makes us incompatible with SQLite by losing e.g. the original whitespace provided during the CREATE TABLE command. For now let's fix our tests by regex-replacing every CREATE TABLE in the entire repo to have exactly 1 space after the table name in the CREATE TABLE statement.
44 lines
1.3 KiB
Tcl
44 lines
1.3 KiB
Tcl
#!/usr/bin/env tclsh
|
|
|
|
set testdir [file dirname $argv0]
|
|
source $testdir/tester.tcl
|
|
|
|
do_execsql_test_on_specific_db {:memory:} default-value-text {
|
|
CREATE TABLE t1 (x INTEGER PRIMARY KEY, y TEXT DEFAULT 'default_value');
|
|
INSERT INTO t1 (x) VALUES (1);
|
|
SELECT y FROM t1 WHERE x = 1;
|
|
} {default_value}
|
|
|
|
do_execsql_test_on_specific_db {:memory:} default-value-integer {
|
|
CREATE TABLE t2 (x INTEGER PRIMARY KEY, y INTEGER DEFAULT 42);
|
|
INSERT INTO t2 (x) VALUES (1);
|
|
SELECT y FROM t2 WHERE x = 1;
|
|
} {42}
|
|
|
|
do_execsql_test_on_specific_db {:memory:} default-value-real {
|
|
CREATE TABLE t3 (x INTEGER PRIMARY KEY, y REAL DEFAULT 3.14);
|
|
INSERT INTO t3 (x) VALUES (1);
|
|
SELECT y FROM t3 WHERE x = 1;
|
|
} {3.14}
|
|
|
|
do_execsql_test_on_specific_db {:memory:} default-value-null {
|
|
CREATE TABLE t5 (x INTEGER PRIMARY KEY, y TEXT DEFAULT NULL);
|
|
INSERT INTO t5 (x) VALUES (1);
|
|
SELECT y FROM t5 WHERE x = 1;
|
|
} {}
|
|
|
|
do_execsql_test_on_specific_db {:memory:} default-value-boolean {
|
|
CREATE TABLE t6 (x INTEGER PRIMARY KEY, y BOOLEAN DEFAULT 1);
|
|
INSERT INTO t6 (x) VALUES (1);
|
|
SELECT y FROM t6 WHERE x = 1;
|
|
} {1}
|
|
|
|
do_execsql_test_on_specific_db {:memory:} default-value-function {
|
|
CREATE TABLE t7 (x INTEGER PRIMARY KEY, y INTEGER DEFAULT (ABS(-5)));
|
|
INSERT INTO t7 (x) VALUES (1);
|
|
SELECT y FROM t7 WHERE x = 1;
|
|
} {5}
|
|
|
|
|
|
|