lnav/test/test_sql_anno.sh
Timothy Stack a27198e8ca [regex101] add an integration with regex101
... and a pile of other changes
2022-04-30 13:06:01 -07:00

44 lines
1.1 KiB
Bash

#! /bin/bash
# basic query
run_cap_test ./drive_sql_anno "SELECT * FROM FOO"
# no help for keyword flag
run_cap_test ./drive_sql_anno "TABLE"
# nested function calls
run_cap_test ./drive_sql_anno "SELECT foo(bar())"
# nested function calls
run_cap_test ./drive_sql_anno "SELECT foo(bar())" 2
# caret in keyword whitespace
run_cap_test ./drive_sql_anno "SELECT lower(abc)" 9
# caret in function whitespace
run_cap_test ./drive_sql_anno "SELECT lower( abc )" 14
# caret in unfinished function call
run_cap_test ./drive_sql_anno "SELECT lower(abc" 16
# caret on the outer function
run_cap_test ./drive_sql_anno "SELECT instr(lower(abc), '123')" 9
# caret on a nested function
run_cap_test ./drive_sql_anno "SELECT instr(lower(abc), '123')" 15
# caret on a flag
run_cap_test ./drive_sql_anno "SELECT instr(lower(abc), '123') FROM bar" 30
# multiple help hits
run_cap_test ./drive_sql_anno "CREATE" 2
# string vs ident
run_cap_test ./drive_sql_anno "SELECT 'hello, world!' FROM \"my table\""
# math
run_cap_test ./drive_sql_anno "SELECT (1 + 2) AS three"
# subqueries
run_cap_test ./drive_sql_anno "SELECT * FROM (SELECT foo, bar FROM baz)"