lnav/test/test_sql_fs_func.sh
Timothy Stack 411ea1fbee [help] show help text for SQL functions
Defect Number:
    Reviewed By:
   Testing Done:
2017-03-31 07:01:11 -07:00

144 lines
2.8 KiB
Bash

#! /bin/bash
run_test ./drive_sql "select basename('')"
check_output "basename('') is not '.'" <<EOF
Row 0:
Column basename(''): .
EOF
run_test ./drive_sql "select basename('/')"
check_output "basename('/') is not '/'" <<EOF
Row 0:
Column basename('/'): /
EOF
run_test ./drive_sql "select basename('//')"
check_output "basename('//') is not '/'" <<EOF
Row 0:
Column basename('//'): /
EOF
run_test ./drive_sql "select basename('/foo')"
check_output "basename('/foo') is not 'foo'" <<EOF
Row 0:
Column basename('/foo'): foo
EOF
run_test ./drive_sql "select basename('foo/bar')"
check_output "basename('foo/bar') is not 'bar'" <<EOF
Row 0:
Column basename('foo/bar'): bar
EOF
run_test ./drive_sql "select basename('/foo/')"
check_output "basename('/foo/') is not 'foo'" <<EOF
Row 0:
Column basename('/foo/'): foo
EOF
run_test ./drive_sql "select basename('/foo///')"
check_output "basename('/foo///') is not 'foo'" <<EOF
Row 0:
Column basename('/foo///'): foo
EOF
run_test ./drive_sql "select basename('foo')"
check_output "basename('foo') is not 'foo'" <<EOF
Row 0:
Column basename('foo'): foo
EOF
run_test ./drive_sql "select dirname('')"
check_output "dirname('') is not '.'" <<EOF
Row 0:
Column dirname(''): .
EOF
run_test ./drive_sql "select dirname('foo')"
check_output "dirname('foo') is not '.'" <<EOF
Row 0:
Column dirname('foo'): .
EOF
run_test ./drive_sql "select dirname('foo///')"
check_output "dirname('foo///') is not '.'" <<EOF
Row 0:
Column dirname('foo///'): .
EOF
run_test ./drive_sql "select dirname('/foo/bar')"
check_output "dirname('/foo/bar') is not '/foo'" <<EOF
Row 0:
Column dirname('/foo/bar'): /foo
EOF
run_test ./drive_sql "select dirname('/')"
check_output "dirname('/') is not '/'" <<EOF
Row 0:
Column dirname('/'): /
EOF
run_test ./drive_sql "select dirname('/foo')"
check_output "dirname('/foo') is not '/'" <<EOF
Row 0:
Column dirname('/foo'): /
EOF
run_test ./drive_sql "select dirname('/foo//')"
check_output "dirname('/foo//') is not '/'" <<EOF
Row 0:
Column dirname('/foo//'): /
EOF
run_test ./drive_sql "select dirname('foo//')"
check_output "dirname('foo//') is not '.'" <<EOF
Row 0:
Column dirname('foo//'): .
EOF
run_test ./drive_sql "select joinpath()"
check_output "joinpath() is not ''" <<EOF
Row 0:
Column joinpath(): (null)
EOF
run_test ./drive_sql "select joinpath('foo')"
check_output "joinpath('foo') is not ''" <<EOF
Row 0:
Column joinpath('foo'): foo
EOF
run_test ./drive_sql "select joinpath('foo', 'bar', 'baz')"
check_output "joinpath('foo', 'bar', 'baz') is not ''" <<EOF
Row 0:
Column joinpath('foo', 'bar', 'baz'): foo/bar/baz
EOF
run_test ./drive_sql "select joinpath('foo', 'bar', 'baz', '/root')"
check_output "joinpath('foo', 'bar', 'baz', '/root') is not ''" <<EOF
Row 0:
Column joinpath('foo', 'bar', 'baz', '/root'): /root
EOF