1 #!/bin/sh
3 test_description='previous branch syntax @{-n}'
5 . ./test-lib.sh
7 test_expect_success 'branch -d @{-1}' '
8 test_commit A &&
9 git checkout -b junk &&
10 git checkout - &&
11 test "$(git symbolic-ref HEAD)" = refs/heads/master &&
12 git branch -d @{-1} &&
13 test_must_fail git rev-parse --verify refs/heads/junk
14 '
16 test_expect_success 'branch -d @{-12} when there is not enough switches yet' '
17 git reflog expire --expire=now &&
18 git checkout -b junk2 &&
19 git checkout - &&
20 test "$(git symbolic-ref HEAD)" = refs/heads/master &&
21 test_must_fail git branch -d @{-12} &&
22 git rev-parse --verify refs/heads/master
23 '
25 test_done