riscv-openocd-wch/jimtcl/tests/jimsh.test

57 lines
1.5 KiB
Plaintext

source [file dirname [info script]]/testing.tcl
needs constraint jim
test jimsh-1.1 {jimsh --help} -body {
exec [info nameofexecutable] --help
} -match glob -result {jimsh version *Usage: *}
test jimsh-1.2 {jimsh -} {
exec [info nameofexecutable] - << {puts $(1 + 2)}
} {3}
test jimsh-1.3 {jimsh - arg list} jim {
exec [info nameofexecutable] - arg list << {puts [join $argv]}
} {arg list}
test jimsh-1.4 {jimsh -e} {
exec [info nameofexecutable] -e {expr {4 + 5}}
} {9}
test jimsh-1.4 {jimsh -e with args} {
exec [info nameofexecutable] -e {set argv} arg1 arg2
} {arg1 arg2}
test jimsh-1.5 {jimsh --version} {
exec [info nameofexecutable] --version
} [info version]
test jimsh-1.6 {jimsh -e with error} -body {
exec [info nameofexecutable] -e blah
} -returnCodes error -result {invalid command name "blah"}
test jimsh-1.7 {jimsh prompt} -body {
exec [info nameofexecutable] << "set x 3\nincr x\nexit \$x\n"
} -returnCodes error -match glob -result {Welcome to Jim version *
. 3
. 4
. }
test jimsh-1.8 {jimsh prompt - error} -body {
exec [info nameofexecutable] << "blah\n"
} -match glob -result {Welcome to Jim version *
. invalid command name "blah"
\[error\] . }
test jimsh-1.9 {jimsh prompt - error} -body {
exec [info nameofexecutable] << "throw 99\n"
} -match glob -result {Welcome to Jim version *
. \[99\] . }
test jimsh-1.10 {jimsh prompt - continuation} -body {
exec [info nameofexecutable] << "set x {\nabc\n}\n"
} -match glob -result "Welcome to Jim version *\n. {> {> \nabc\n\n. "
testreport