mirror of
https://github.com/dolthub/dolt.git
synced 2026-02-10 18:49:02 -06:00
26 lines
724 B
Bash
26 lines
724 B
Bash
#!/usr/bin/env bats
|
|
load $BATS_TEST_DIRNAME/helper/common.bash
|
|
|
|
setup() {
|
|
setup_common
|
|
dolt table create -s=`batshelper 1pk5col-ints.schema` test
|
|
}
|
|
|
|
teardown() {
|
|
teardown_common
|
|
}
|
|
|
|
@test "run a query in sql shell" {
|
|
skiponwindows "Works on Windows command prompt but not the WSL terminal used during bats"
|
|
run bash -c "echo 'select * from test;' | dolt sql"
|
|
[ $status -eq 0 ]
|
|
[[ "$output" =~ "pk" ]] || false
|
|
}
|
|
|
|
@test "bad sql in sql shell should error" {
|
|
run dolt sql <<< "This is bad sql"
|
|
[ $status -eq 1 ]
|
|
run dolt sql <<< "select * from test; This is bad sql; insert into test (pk) values (666); select * from test;"
|
|
[ $status -eq 1 ]
|
|
[[ ! "$output" =~ "666" ]] || false
|
|
} |