Memorialize Python 3.7 support
[stgit.git] / t / t1700-goto.sh
blob325e515a1c972b75cad2dc618025db42a369a641
1 #!/bin/sh
3 # Copyright (c) 2006 Ilpo Järvinen
6 test_description='Test "stg goto"'
8 . ./test-lib.sh
10 test_expect_success 'Initialize stgit repository' '
11 stg init &&
12 for i in 1 2 3 4 5; do
13 stg new p$i -m "patch $i" &&
14 echo $i > file$i &&
15 stg add file$i &&
16 stg refresh
17 done
20 test_expect_success 'Test invalid number of arguments' '
21 command_error stg goto 2>&1 |
22 grep -e "incorrect number of arguments"
25 test_expect_success 'Goto current patch' '
26 stg goto $(stg top) &&
27 test "$(echo $(stg top))" = "p5"
30 test_expect_success 'Attempt goto invalid patch' '
31 command_error stg goto p999 2>&1 |
32 grep -e "Patch \"p999\" does not exist"
35 test_expect_success 'Goto a patch' '
36 stg goto p3 &&
37 test "$(echo $(stg series --applied --noprefix))" = "p1 p2 p3" &&
38 test "$(echo $(stg series --unapplied --noprefix))" = "p4 p5"
41 test_expect_success 'Refuse to go to a hidden patch' '
42 stg new h0 -m "hidden patch" &&
43 stg hide h0 &&
44 command_error stg goto h0 2>&1 | grep -e "Cannot goto a hidden patch" &&
45 test "$(echo $(stg series --hidden --noprefix))" = "h0" &&
46 test "$(echo $(stg series --applied --noprefix))" = "p1 p2 p3" &&
47 test "$(echo $(stg series --unapplied --noprefix))" = "p4 p5"
50 test_expect_success 'Goto with merge check' '
51 stg goto --merged p5 &&
52 test "$(echo $(stg series --applied --noprefix))" = "p1 p2 p3 p4 p5" &&
53 test "$(echo $(stg series --unapplied --noprefix))" = ""
56 test_expect_success 'Goto with ambiguous patch substring' '
57 stg goto 1 &&
58 command_error stg goto p 2>&1 |
59 grep "Ambiguous patch name \"p\""
62 test_done