Skip to content

Commit 8dab39b

Browse files
committed
add history-/history-cases-test, using readline
1 parent 1d3a245 commit 8dab39b

File tree

2 files changed

+81
-0
lines changed

2 files changed

+81
-0
lines changed

test/prompt/history-cases-test

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
#!/bin/sh
2+
3+
. libtest.sh
4+
. libgit.sh
5+
6+
export LINES=3
7+
export COLUMNS=80
8+
9+
test_require readline
10+
11+
in_work_dir create_repo_from_tgz "$base_dir/files/scala-js-benchmarks.tgz"
12+
13+
test_case one \
14+
--before='rm -f -- "$HOME/.tig_history"' \
15+
--tigrc='set history-size = 10' \
16+
--keystrokes=':echo keys_one\r:quit\r' \
17+
--assert-equals=".tig_history"='echo keys_one
18+
quit
19+
' \
20+
<<EOF
21+
2014-03-01 17:26 -0500 Jonas Fonseca o [master] WIP: Upgrade to 0.4-SNAPSHO
22+
[main] ee912870202200a0b9cf4fd86ba57243212d341e - commit 1 of 48 2%
23+
EOF
24+
25+
test_case two \
26+
--before='rm -f -- "$HOME/.tig_history"' \
27+
--tigrc='set history-size = 10' \
28+
--keystrokes=':echo keys_two\r:quit\r' \
29+
--assert-equals=".tig_history"="echo keys_two
30+
quit
31+
" \
32+
--script=':echo first_line
33+
:echo second_line' \
34+
<<EOF
35+
2014-03-01 17:26 -0500 Jonas Fonseca o [master] WIP: Upgrade to 0.4-SNAPSHO
36+
[main] ee912870202200a0b9cf4fd86ba57243212d341e - commit 1 of 48 2%
37+
EOF
38+
39+
test_case three \
40+
--before='rm -f -- "$HOME/.tig_history"' \
41+
--tigrc='set history-size = 10' \
42+
--keystrokes=':echo keys_four\r:quit\r' \
43+
--assert-equals=".tig_history"='echo keys_four
44+
quit
45+
' \
46+
<<EOF
47+
2014-03-01 17:26 -0500 Jonas Fonseca o [master] WIP: Upgrade to 0.4-SNAPSHO
48+
[main] ee912870202200a0b9cf4fd86ba57243212d341e - commit 1 of 48 2%
49+
EOF
50+
51+
run_test_cases

test/prompt/history-test

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#!/bin/sh
2+
3+
. libtest.sh
4+
. libgit.sh
5+
6+
export LINES=3
7+
export COLUMNS=80
8+
9+
test_require readline
10+
11+
in_work_dir create_repo_from_tgz "$base_dir/files/scala-js-benchmarks.tgz"
12+
13+
tigrc <<EOF
14+
set history-size = 3
15+
EOF
16+
17+
keystrokes ':none'
18+
keystrokes -append -keysym 'Enter'
19+
keystrokes -append ':quit'
20+
keystrokes -append -keysym 'Enter'
21+
22+
test_tig
23+
24+
assert_equals stderr <<EOF
25+
EOF
26+
27+
assert_equals "$HOME/.tig_history" <<EOF
28+
none
29+
quit
30+
EOF

0 commit comments

Comments
 (0)