aboutsummaryrefslogtreecommitdiff
path: root/tests/history.test
blob: e0ff0e2ef59fe5dfd8ef63208c26438709acc107 (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
source [file dirname [info script]]/testing.tcl

needs cmd {history save}
needs expr "jim::lineedit" {$jim::lineedit}

test history-1.1 {history usage} -body {
	history
} -returnCodes error -result {wrong # args: should be "history command ..."
Use "history -help ?command?" for help}

test history-1.2 {history -help} -body {
	history -help
} -result {Usage: "history command ... ", where command is one of: add, completion, getline, hints, keep, load, save, show}

test history-1.2 {history add} {
	history add line1
	history add "line2 next"
	set name tmp.[pid]
	history save $name
	set f [open $name]
	set lines [split [string trimright [read $f]] \n]
} {line1 {line2 next}}

test history-1.3 {history load} {
	history load $name
} {}

test history-1.4 {history completion usage} -body {
	history completion
} -returnCodes error -match glob -result {wrong # args: should be "history completion *"}

test history-1.5 {history completion} {
	history completion command
} {}

test history-1.6 {history completion} {
	history completion {}
} {}

test history-1.7 {history hints} {
	history hints command
} {}

test history-1.8 {history hints} {
	history hints {}
} {}

catch {
	file delete $name
}

# Can't really test history add, show, setcompletion

testreport