Re: How to re-use setups in multiple tests?

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: Johannes Schindelin <Johannes.Schindelin@...>
Cc: <git@...>
Date: Monday, October 1, 2007 - 8:16 am

In this case the first test rebases the branch created in setup (it's
testing the rebase merge strategy), the second test should do the same
thing, except check there is a warning if a --message option is
passed.

I suppose I could find the old pre-rebase head and work with that, but
that doesn't seem that clean to me.

Here's the code (non-working):

#!/bin/sh

test_description='merge-rebase backend test'

. ./test-lib.sh

test_expect_success setup '
        echo hello >a &&
        git add a &&
        test_tick && git commit -m initial &&

        git checkout -b branch &&
        echo hello >b &&
        git add b &&
        test_tick && git commit -m onbranch &&

        git checkout master &&
        echo update >a &&
        git add a &&
        test_tick && git commit -m update
'

test_expect_success 'merging using rebase does not create merge
commit' '
        git checkout branch &&
        git merge -s rebase master &&

        ( git log --pretty=oneline ) >actual &&
        (
                echo "4db7a5a013e67aa623d1fd294e8d46e89b3ace8f
onbranch"
                echo "893371811dbd13e85c098b72d1ab42bcfd24c2db update"
                echo "0e960b10429bf3f1e168ee2cc7d531ac7c622580
initial"
        ) >expected &&
        git diff -w -u expected actual
'

test_expect_success 'merging using rebase with message gives warning'
'
        #doesn't work because the branch has already been rebased and
is therefore up to date
        git checkout branch &&
        git merge -m "a message" -s rebase master 2>&1 expected &&
        (
                echo "warning: Message is not used for rebase merge
strategy"
        ) >expected &&
        git diff -w -u expected actual
'

test_done


-Tom

On 10/1/07, Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote:
-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
How to re-use setups in multiple tests?, Tom Clarke, (Mon Oct 1, 6:27 am)
Re: How to re-use setups in multiple tests?, Johannes Schindelin, (Mon Oct 1, 7:45 am)
Re: How to re-use setups in multiple tests?, Tom Clarke, (Mon Oct 1, 8:16 am)
Re: How to re-use setups in multiple tests?, Johannes Schindelin, (Mon Oct 1, 8:39 am)
Re: How to re-use setups in multiple tests?, Tom Clarke, (Mon Oct 1, 8:46 am)
Re: How to re-use setups in multiple tests?, Karl , (Mon Oct 1, 9:40 am)