Files
dolt/integration-tests/bats/sql-use.expect
Zach Musgrave 073346a402 Fixed test
2023-02-27 18:06:09 -08:00

63 lines
1.3 KiB
Plaintext

#!/usr/bin/expect
set timeout 3
spawn dolt sql
# This script uses undefined variables in the failure case so that
# error output includes the line of the failed test expectation
expect {
"*doltsql> " { send -- "use `doltsql/test`;\r"; }
timeout { puts "$TESTFAILURE"; }
}
expect {
"*doltsql/test> " { send -- "show tables;\r"; }
timeout { puts "$TESTFAILURE"; }
}
expect {
"*doltsql/test> " { send -- "use information_schema;\r"; }
timeout { puts "$TESTFAILURE"; }
}
expect {
"*information_schema> " { send -- "show tables;\r"; }
timeout { puts "$TESTFAILURE"; }
}
expect {
"*information_schema> " { send -- "CREATE DATABASE mydb;\r"; }
timeout { puts "$TESTFAILURE"; }
}
expect {
"*information_schema> " { send -- "use db1;\r"; }
timeout { puts "$TESTFAILURE"; }
}
expect {
-re "|.*db1.*|\r.*db1> " { send -- "select database();\r"; }
timeout { puts "$TESTFAILURE"; }
}
expect {
"*db1>" { send -- "use db2;\r"; }
timeout { puts "$TESTFAILURE"; }
}
expect {
"*db2> " { send -- "select database();\r"; }
timeout { puts "$TESTFAILURE"; }
}
expect {
-re "|.*db2.*|.*\rdb2>" { send -- "use mydb;\r"; }
timeout { puts "$TESTFAILURE"; }
}
expect {
"mydb> " { send -- "exit ;\r"; }
timeout { puts "$TESTFAILURE"; }
}