Re: [RTC/PATCH] Add 'update-branch' hook
- From
Ilya Bobyr <ilya.bobyr@gmail.com>
- Date
- Apr 21, 2014, 21:17 UTC
- Message-ID
- <53558AD0.3010602@gmail.com>
- In-Reply-To
- <1398047016-21643-1-git-send-email-felipe.contreras@gmail.com>
On 4/20/2014 7:23 PM, Felipe Contreras wrote:
Show 27 quoted lines
> [...]
>
> diff --git a/t/t5408-update-branch-hook.sh b/t/t5408-update-branch-hook.sh
> new file mode 100755
> index 0000000..d921c0e
> --- /dev/null
> +++ b/t/t5408-update-branch-hook.sh
> @@ -0,0 +1,39 @@
> +#!/bin/sh
> +
> +test_description='Test the update-branch hook'
> +
> +. ./test-lib.sh
> +
> +setup () {
> + mkdir -p .git/hooks &&
> + cat > .git/hooks/update-branch <<-'EOF' &&
> + #!/bin/sh
> + echo $@ > .git/update-branch.args
> + EOF
> + chmod +x .git/hooks/update-branch &&
> + echo one > content &&
> + git add content &&
> + git commit -a -m one
> +}
> +
> +setupAccording to t/README `setup` should be inside an assertion just as any other test:
Show 12 quoted lines
> Do's, don'ts & things to keep in mind > ------------------------------------- > > Here are a few examples of things you probably should and shouldn't do > when writing tests. > > Do: > > - Put all code inside test_expect_success and other assertions. > > Even code that isn't a test per se, but merely some setup code > should be inside a test assertion.