#!/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