Skip to content

Commit 749c3c4

Browse files
committed
add history-/history-cases-test, using readline
1 parent b6956d9 commit 749c3c4

File tree

2 files changed

+98
-0
lines changed

2 files changed

+98
-0
lines changed

test/prompt/history-cases-test

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
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 Jonas Fonseca o [master] WIP: Upgrade to 0.4-SNAPSHOT and
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 first_line
30+
echo second_line
31+
save-display $HOME/two.screen
32+
echo keys_two
33+
quit
34+
" \
35+
--script=':echo first_line
36+
:echo second_line' \
37+
<<EOF
38+
2014-03-01 17:26 Jonas Fonseca o [master] WIP: Upgrade to 0.4-SNAPSHOT and
39+
[main] ee912870202200a0b9cf4fd86ba57243212d341e - commit 1 of 48 2%
40+
EOF
41+
42+
test_case three \
43+
--before='rm -f -- "$HOME/.tig_history"' \
44+
--tigrc='set history-size = 10' \
45+
--assert-equals=".tig_history"="echo first_line
46+
echo second_line
47+
save-display $HOME/three.screen
48+
quit
49+
" \
50+
--script=':echo first_line
51+
:echo second_line' <<EOF
52+
2014-03-01 17:26 Jonas Fonseca o [master] WIP: Upgrade to 0.4-SNAPSHOT and
53+
[main] ee912870202200a0b9cf4fd86ba57243212d341e - commit 1 of 48 2%
54+
EOF
55+
56+
test_case four \
57+
--before='rm -f -- "$HOME/.tig_history"' \
58+
--tigrc='set history-size = 10' \
59+
--keystrokes=':echo keys_four\r:quit\r' \
60+
--assert-equals=".tig_history"='echo keys_four
61+
quit
62+
' \
63+
<<EOF
64+
2014-03-01 17:26 Jonas Fonseca o [master] WIP: Upgrade to 0.4-SNAPSHOT and
65+
[main] ee912870202200a0b9cf4fd86ba57243212d341e - commit 1 of 48 2%
66+
EOF
67+
68+
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)