Release 0.19
[stgit.git] / t / t1500-float.sh
bloba45652e9d6611e54043b673395f2e24efccbd211
1 #!/bin/sh
3 # Copyright (c) 2006 Robin Rosenberg
6 test_description='Test floating a number of patches to the top of the stack
10 . ./test-lib.sh
12 test_expect_success \
13 'Initialize the StGIT repository' \
14 'stg init &&
15 stg new A -m "a" && echo A >a.txt && stg add a.txt && stg refresh &&
16 stg new B -m "b" && echo B >b.txt && stg add b.txt && stg refresh &&
17 stg new C -m "c" && echo C >c.txt && stg add c.txt && stg refresh &&
18 stg new D -m "d" && echo D >d.txt && stg add d.txt && stg refresh &&
19 stg new E -m "e" && echo E >e.txt && stg add e.txt && stg refresh &&
20 stg new F -m "f" && echo F >f.txt && stg add f.txt && stg refresh &&
21 stg new G -m "g" && echo G >g.txt && stg add g.txt && stg refresh &&
22 stg pop &&
23 test "$(echo $(stg series --applied --noprefix))" = "A B C D E F"
26 test_expect_success \
27 'Float A to top' \
28 'stg float A &&
29 test "$(echo $(stg series --applied --noprefix))" = "B C D E F A"
31 test_expect_success \
32 'Float A to top (noop)' \
33 'stg float A &&
34 test "$(echo $(stg series --applied --noprefix))" = "B C D E F A"
36 test_expect_success \
37 'Float B C to top' \
38 'stg float B C &&
39 test "$(echo $(stg series --applied --noprefix))" = "D E F A B C"
41 test_expect_success \
42 'Float E A to top' \
43 'stg float E A &&
44 test "$(echo $(stg series --applied --noprefix))" = "D F B C E A"
46 test_expect_success \
47 'Float E to top' \
48 'stg float E &&
49 test "$(echo $(stg series --applied --noprefix))" = "D F B C A E"
51 test_expect_success \
52 'Float G F to top' \
53 'stg float G F &&
54 test "$(echo $(stg series --applied --noprefix))" = "D B C A E G F"
57 cat > series.txt <<EOF
65 EOF
66 test_expect_success \
67 'Float with series file' \
68 'stg float --series series.txt &&
69 test "$(echo $(stg series --applied --noprefix))" = "A B C D E F G"
72 cat > rev-series.txt <<EOF
80 EOF
81 test_expect_success \
82 'Float with series from stdin' \
83 'cat rev-series.txt | stg float -s - &&
84 test "$(echo $(stg series --applied --noprefix))" = "G F E D C B A"
86 test_expect_success \
87 'Attempt float with empty series' \
88 'echo "" |
89 command_error stg float -s - 2>&1 |
90 grep -e "No patches to float"
92 test_expect_success \
93 'Attempt float with series file and arguments' \
94 'command_error stg float --series series.txt A 2>&1 |
95 grep -e "<patches> cannot be used with --series"
97 test_expect_success \
98 'Attempt float with no series file and no arguments' \
99 'command_error stg float 2>&1 |
100 grep -e "incorrect number of arguments"
103 test_done