tests: Add many new additional tests for code coverage
[jimtcl.git] / tests / history.test
blob178a107228e575b5f1faaef2ae91ceca752cc780
1 source [file dirname [info script]]/testing.tcl
3 needs cmd history
5 test history-1.1 {history usage} -body {
6         history
7 } -returnCodes error -result {wrong # args: should be "history command ..."
8 Use "history -help ?command?" for help}
10 test history-1.2 {history -help} -body {
11         history -help
12 } -result {Usage: "history command ... ", where command is one of: getline, completion, load, save, add, show}
14 test history-1.2 {history add} {
15         history add line1
16         history add "line2 next"
17         set name tmp.[pid]
18         history save $name
19         set f [open $name]
20         set lines [split [string trimright [read $f]] \n]
21 } {line1 {line2 next}}
23 test history-1.3 {history load} {
24         history load $name
25 } {}
27 test history-1.4 {history completion usage} -body {
28         history completion
29 } -returnCodes error -result {wrong # args: should be "history completion command"}
31 test history-1.5 {history completion} {
32         history completion command
33 } {}
35 test history-1.6 {history completion} {
36         history completion {}
37 } {}
39 file delete $name
41 # Can't really tests history add, show, setcompletion
43 testreport