3 test_description
='Simple test cases for "stg undo"'
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 &&
27 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
42 test_expect_success
'... and undo it' '
44 test "$(echo $(stg series))" = "+ p1 > p2 - p3" &&
45 test_cmp expected.txt a
48 cat > expected.txt
<<EOF
51 test_expect_success
'Pop two patches ...' '
54 test "$(echo $(stg series))" = "- p1 - p2 - p3" &&
55 test_cmp expected.txt a
58 cat > expected.txt
<<EOF
63 test_expect_success
'... and undo it' '
66 test "$(echo $(stg series))" = "+ p1 > p2 - p3" &&
67 test_cmp expected.txt a
70 cat > expected.txt
<<EOF
75 test_expect_success
'Undo past end of history' '
76 command_error stg undo -n 100 &&
77 test "$(echo $(stg series))" = "+ p1 > p2 - p3" &&
78 test_cmp expected.txt a