1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65
|
#!/bin/sh
#
# Copyright (c) 2007 Karl Hasselström
#
test_description='Test "stg new".'
. ./test-lib.sh
test_expect_success \
'Initialize the StGIT repository' '
stg init
'
test_expect_success \
'Too many arguments' '
command_error stg new foo extra_arg 2>&1 |
grep -e "incorrect number of arguments"
'
test_expect_success \
'Create a named patch' '
stg new foo -m foobar &&
[ $(stg series --applied -c) -eq 1 ]
'
test_expect_success \
'Create a patch without giving a name' '
stg new -m yo &&
[ "$(echo $(stg top))" = "yo" ] &&
[ $(stg series --applied -c) -eq 2 ]
'
test_expect_success \
'Attempt to create patch with duplicate name' '
command_error stg new foo -m "duplicate foo" 2>&1 |
grep -e "foo: patch already exists"
'
test_expect_success \
'Attempt new with conflicts' '
stg new -m p0 &&
echo "something" > file.txt &&
stg add file.txt &&
stg refresh &&
stg new -m p1 &&
echo "something else" > file.txt &&
stg refresh &&
stg pop &&
stg new -m p2 &&
echo "something different" > file.txt &&
stg refresh &&
conflict stg push p1 &&
command_error stg new -m p3 2>&1 |
grep -e "Cannot create a new patch -- resolve conflicts first" &&
stg reset --hard
'
test_expect_success \
'Save template' '
stg new --save-template new-tmpl.txt &&
test -e new-tmpl.txt
'
test_done
|