| 1 | #!/bin/sh |
| 2 | # |
| 3 | # Copyright (c) 2008 Onno Kortmann |
| 4 | # Parts taken from the other test scripts |
| 5 | # in this directory. |
| 6 | # |
| 7 | |
| 8 | test_description='stg rename test |
| 9 | |
| 10 | Tests some parts of the stg rename command.' |
| 11 | |
| 12 | . ./test-lib.sh |
| 13 | stg init |
| 14 | |
| 15 | test_expect_success 'Rename in empty' ' |
| 16 | ! stg rename foo |
| 17 | ' |
| 18 | |
| 19 | test_expect_success 'Rename single top-most' ' |
| 20 | stg new -m foo && |
| 21 | stg rename bar |
| 22 | ' |
| 23 | # bar |
| 24 | |
| 25 | test_expect_success 'Rename non-existing' ' |
| 26 | ! stg rename neithersuchpatch norsuchpatch |
| 27 | ' |
| 28 | |
| 29 | test_expect_success 'Rename with two arguments' ' |
| 30 | stg new -m baz && |
| 31 | stg rename bar foo |
| 32 | ' |
| 33 | # foo,baz |
| 34 | |
| 35 | test_expect_success 'Rename to existing name' ' |
| 36 | ! stg rename foo baz |
| 37 | ' |
| 38 | |
| 39 | test_expect_success 'Rename to same name' ' |
| 40 | ! stg rename foo foo |
| 41 | ' |
| 42 | |
| 43 | test_expect_success 'Rename top-most when others exist' ' |
| 44 | stg rename bar |
| 45 | ' |
| 46 | |
| 47 | test_done |