Files
dolt/integration-tests/bats/sql-vertical-format.expect
2023-03-31 16:11:34 -07:00

51 lines
1021 B
Plaintext

#!/usr/bin/expect
set timeout 3
spawn dolt sql
# This test uses an undefined var for its failure case, which gives
# the line number of the failure in the output.
expect {
"> " { send "show tables\\G\r"; }
timeout { puts "$TEST_FAILURE" }
}
expect {
"*: one_pk*" { send "DELIMITER $$\r"; }
timeout { puts "$TEST_FAILURE" }
}
expect {
"> " { send "show tables$$\r"; }
timeout { puts "$TEST_FAILURE" }
}
expect {
"*| one_pk*" { send "show tables\\g\r"; }
timeout { puts "$TEST_FAILURE" }
}
expect {
"*: one_pk*" { send "DELIMITER ;\r"; }
timeout { puts "$TEST_FAILURE" }
}
expect {
"> " { send "SELECT COUNT(*) FROM one_pk\\G\r"; }
timeout { puts "$TEST_FAILURE" }
}
expect {
"*COUNT(\\*): 4*" { send "SELECT JSON_OBJECT('id', 87, 'name', 'carrot')\\G\r"; }
timeout { puts "$TEST_FAILURE" }
}
expect {
"*JSON_OBJECT('id', 87, 'name', 'carrot'): {\"id\": 87, \"name\": \"carrot\"}*" { exit 0 ; }
timeout { puts "$TEST_FAILURE" }
failed { puts "$TEST_FAILURE" }
}
expect eof