mirror of
https://github.com/dolthub/dolt.git
synced 2026-01-29 03:08:47 -06:00
Verify that a prompt can be an empty string using expect
This commit is contained in:
32
integration-tests/bats/sql-shell-empty-prompt.expect
Executable file
32
integration-tests/bats/sql-shell-empty-prompt.expect
Executable file
@@ -0,0 +1,32 @@
|
||||
#!/usr/bin/expect -f
|
||||
|
||||
set timeout 5
|
||||
spawn dolt sql
|
||||
|
||||
expect {
|
||||
"> " { send "select 23;\r"; }
|
||||
timeout { exit 1; }
|
||||
}
|
||||
|
||||
expect {
|
||||
"| 23 |" { }
|
||||
timeout { exit 1; }
|
||||
}
|
||||
expect {
|
||||
"| 23 |" { }
|
||||
timeout { exit 1; }
|
||||
}
|
||||
|
||||
expect {
|
||||
"> " { send "exit;\r"; }
|
||||
timeout { exit 1; }
|
||||
}
|
||||
|
||||
expect {
|
||||
eof { }
|
||||
timeout { exit 1; }
|
||||
}
|
||||
|
||||
set waitval [wait -i $spawn_id]
|
||||
set exval [lindex $waitval 3]
|
||||
exit $exval
|
||||
@@ -71,7 +71,20 @@ teardown() {
|
||||
$BATS_TEST_DIRNAME/sql-works-after-failing-query.expect
|
||||
}
|
||||
|
||||
@test "sql-shell: empty DB in prompt is OK" {
|
||||
skiponwindows "Need to install expect and make this script work on windows."
|
||||
if [ "$SQL_ENGINE" = "remote-engine" ]; then
|
||||
skip "Presently sql command will not connect to remote server due to lack of lock file where there are not DBs."
|
||||
fi
|
||||
# ignore common setup. Use an empty db with no server.
|
||||
rm -rf .dolt
|
||||
mkdir emptyDb
|
||||
cd emptyDb
|
||||
$BATS_TEST_DIRNAME/sql-shell-empty-prompt.expect
|
||||
}
|
||||
|
||||
@test "sql-shell: delimiter" {
|
||||
|
||||
skiponwindows "Need to install expect and make this script work on windows."
|
||||
mkdir doltsql
|
||||
cd doltsql
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#!/usr/bin/expect
|
||||
#!/usr/bin/expect -f
|
||||
|
||||
set timeout 1
|
||||
spawn dolt sql
|
||||
@@ -15,3 +15,4 @@ expect {
|
||||
"pid 0 is already in use" { exit 1 }
|
||||
" 1 " { exit 0 }
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user