Tests redirect to err file when grepping stderr
[stgit.git] / t / t1500-float.sh
bloba1c5c5cfcb870c4d34d44b3cc975c7f8fca3706e
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 'Initialize the StGit repository' '
13 test_commit_bulk --message="p%s" 7 &&
14 stg init &&
15 stg uncommit -n 7 &&
16 stg pop &&
17 test "$(echo $(stg series --applied --noprefix))" = "p1 p2 p3 p4 p5 p6" &&
18 test "$(echo $(stg series --unapplied --noprefix))" = "p7"
21 test_expect_success 'Float p1 to top' '
22 stg float p1 &&
23 test "$(echo $(stg series --applied --noprefix))" = "p2 p3 p4 p5 p6 p1"
26 test_expect_success 'Float p1 to top (noop)' '
27 stg float p1 &&
28 test "$(echo $(stg series --applied --noprefix))" = "p2 p3 p4 p5 p6 p1"
31 test_expect_success 'Float p2 p3 to top' '
32 stg float p2 p3 &&
33 test "$(echo $(stg series --applied --noprefix))" = "p4 p5 p6 p1 p2 p3"
36 test_expect_success 'Float p5 p1 to top' '
37 stg float p5 p1 &&
38 test "$(echo $(stg series --applied --noprefix))" = "p4 p6 p2 p3 p5 p1"
41 test_expect_success 'Float p5 to top' '
42 stg float p5 &&
43 test "$(echo $(stg series --applied --noprefix))" = "p4 p6 p2 p3 p1 p5"
46 test_expect_success 'Float p7 p6 to top' '
47 stg float p7 p6 &&
48 test "$(echo $(stg series --applied --noprefix))" = "p4 p2 p3 p1 p5 p7 p6"
51 cat > series.txt <<EOF
59 EOF
60 test_expect_success 'Float with series file' '
61 stg float --series series.txt &&
62 test "$(echo $(stg series --applied --noprefix))" = "p1 p2 p3 p4 p5 p6 p7"
65 cat > rev-series.txt <<EOF
73 EOF
74 test_expect_success 'Float with series from stdin' '
75 cat rev-series.txt | stg float -s - &&
76 test "$(echo $(stg series --applied --noprefix))" = "p7 p6 p5 p4 p3 p2 p1"
79 test_expect_success 'Attempt float with empty series' '
80 echo "" |
81 command_error stg float -s - 2>err &&
82 grep -e "No patches to float" err
85 test_expect_success 'Attempt float with series file and arguments' '
86 command_error stg float --series series.txt p1 2>err &&
87 grep -e "<patches> cannot be used with --series" err
90 test_expect_success 'Attempt float with no series file and no arguments' '
91 command_error stg float 2>err &&
92 grep -e "incorrect number of arguments" err
95 test_expect_success 'Series with bogus patch name' '
96 printf "p1\np2\np3\nBOGUS\np4\np5\np6\np7\n" |
97 command_error stg float --series=- 2>& 1 |
98 grep -e "Unknown patch name: BOGUS"
101 test_done