3 # Copyright (c) 2008 Onno Kortmann
4 # Parts taken from the other test scripts
8 test_description
='stg rename test
10 Tests some parts of the stg rename command.'
15 test_expect_success
'Rename in empty' '
16 command_error stg rename foo 2>err &&
17 grep -e "No applied top patch to rename exists" err
20 test_expect_success
'Rename single top-most' '
26 test_expect_success
'Rename non-existing' '
27 command_error stg rename neithersuchpatch norsuchpatch
30 test_expect_success
'Rename with two arguments' '
36 test_expect_success
'Rename with too many arguments' '
37 command_error stg rename foo bar baz 2>err &&
38 grep -e "incorrect number of arguments" err
41 test_expect_success
'Rename to existing name' '
42 command_error stg rename foo baz 2>err &&
43 grep -e "Patch already exists: \"baz\"" err
46 test_expect_success
'Rename to same name' '
47 command_error stg rename foo foo 2>err &&
48 grep -e "New patch name same as old: \"foo\"" err
51 test_expect_success
'Rename top-most when others exist' '
55 test_expect_success
'Rename to invalid patch name: space' '
56 command_error stg rename bar "bar fo" 2>err &&
57 grep -e "Invalid patch name: \"bar fo\"" err
60 test_expect_success
'Rename to invalid patch name: colon' '
61 command_error stg rename bar "bar:fo" 2>err &&
62 grep -e "Invalid patch name: \"bar:fo\"" err
65 test_expect_failure
'Rename to patch name with slash' '
66 stg rename bar bar/fo &&
70 test_expect_success
'Rename hidden' '
74 test "$(echo $(stg series --all))" = "> foo ! pub"