aboutsummaryrefslogtreecommitdiff
path: root/tests/jimsh.test
blob: a02ed9f43dd9b3fa2d8681a16a4eb704c227f79f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
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