3 test_description
='Simple test cases for "stg redo"'
7 # Ignore our own output files.
8 cat >> .git
/info
/exclude
<<EOF
12 test_expect_success
'Initialize StGit stack with three patches' '
18 git commit -a -m p1 &&
20 git commit -a -m p2 &&
22 git commit -a -m p3 &&
26 cat > expected.txt
<<EOF
31 test_expect_success
'Pop one patch ...' '
33 test "$(echo $(stg series))" = "+ p1 > p2 - p3" &&
34 test_cmp expected.txt a
37 cat > expected.txt
<<EOF
43 test_expect_success
'... undo it ...' '
45 test "$(echo $(stg series))" = "+ p1 + p2 > p3" &&
46 test_cmp expected.txt a
49 cat > expected.txt
<<EOF
54 test_expect_success
'... and redo' '
56 test "$(echo $(stg series))" = "+ p1 > p2 - p3" &&
57 test_cmp expected.txt a
60 cat > expected.txt
<<EOF
63 test_expect_success
'Pop three patches ...' '
68 test "$(echo $(stg series))" = "- p1 - p2 - p3" &&
69 test_cmp expected.txt a
72 cat > expected.txt
<<EOF
78 test_expect_success
'... undo it ...' '
82 test "$(echo $(stg series))" = "+ p1 + p2 > p3" &&
83 test_cmp expected.txt a
86 cat > expected.txt
<<EOF
90 test_expect_success
'... redo the first two pops ...' '
92 test "$(echo $(stg series))" = "> p1 - p2 - p3" &&
93 test_cmp expected.txt a
96 cat > expected.txt
<<EOF
99 test_expect_success
'... and the remaining one' '
101 test "$(echo $(stg series))" = "- p1 - p2 - p3" &&
102 test_cmp expected.txt a
105 cat > expected.txt
<<EOF
108 test_expect_success
'Redo past end of history' '
109 command_error stg redo &&
110 test "$(echo $(stg series))" = "- p1 - p2 - p3" &&
111 test_cmp expected.txt a