chiark / gitweb /
New test: try "stg refresh" in a subdirectory
[stgit] / t / t1203-pop.sh
1 #!/bin/sh
2 # Copyright (c) 2007 Karl Hasselström
3 test_description='Test the pop command'
4 . ./test-lib.sh
5
6 test_expect_success \
7     'Initialize the StGIT repository' \
8     'stg init'
9
10 test_expect_success \
11     'Create ten patches' '
12     for i in 0 1 2 3 4 5 6 7 8 9; do
13         stg new p$i -m p$i;
14     done &&
15     [ "$(echo $(stg applied))" = "p0 p1 p2 p3 p4 p5 p6 p7 p8 p9" ] &&
16     [ "$(echo $(stg unapplied))" = "" ]
17 '
18
19 test_expect_success \
20     'Pop half the patches' '
21     stg pop -n 5 &&
22     [ "$(echo $(stg applied))" = "p0 p1 p2 p3 p4" ] &&
23     [ "$(echo $(stg unapplied))" = "p5 p6 p7 p8 p9" ]
24 '
25
26 test_expect_success \
27     'Pop the remaining patches' '
28     stg pop -a &&
29     [ "$(echo $(stg applied))" = "" ] &&
30     [ "$(echo $(stg unapplied))" = "p0 p1 p2 p3 p4 p5 p6 p7 p8 p9" ]
31 '
32
33 test_done