Junio C Hamano | 93cfa7c | 2010-01-26 11:58:00 -0800 | [diff] [blame] | 1 | #!/bin/sh |
| 2 | |
| 3 | test_description='various @{whatever} syntax tests' |
Ævar Arnfjörð Bjarmason | 7a98d9a | 2022-04-13 22:01:47 +0200 | [diff] [blame] | 4 | |
| 5 | TEST_PASSES_SANITIZE_LEAK=true |
Junio C Hamano | 93cfa7c | 2010-01-26 11:58:00 -0800 | [diff] [blame] | 6 | . ./test-lib.sh |
| 7 | |
| 8 | test_expect_success 'setup' ' |
| 9 | test_commit one && |
| 10 | test_commit two |
| 11 | ' |
| 12 | |
| 13 | check_at() { |
| 14 | echo "$2" >expect && |
| 15 | git log -1 --format=%s "$1" >actual && |
| 16 | test_cmp expect actual |
| 17 | } |
| 18 | |
| 19 | test_expect_success '@{0} shows current' ' |
| 20 | check_at @{0} two |
| 21 | ' |
| 22 | |
| 23 | test_expect_success '@{1} shows old' ' |
| 24 | check_at @{1} one |
| 25 | ' |
| 26 | |
| 27 | test_expect_success '@{now} shows current' ' |
| 28 | check_at @{now} two |
| 29 | ' |
| 30 | |
Junio C Hamano | 6c647af | 2010-01-27 10:54:22 -0800 | [diff] [blame] | 31 | test_expect_success '@{2001-09-17} (before the first commit) shows old' ' |
| 32 | check_at @{2001-09-17} one |
Junio C Hamano | 93cfa7c | 2010-01-26 11:58:00 -0800 | [diff] [blame] | 33 | ' |
| 34 | |
| 35 | test_expect_success 'silly approxidates work' ' |
Jeff King | 8e52dc3 | 2010-01-28 03:52:18 -0500 | [diff] [blame] | 36 | check_at @{3.hot.dogs.on.2001-09-17} one |
Junio C Hamano | 93cfa7c | 2010-01-26 11:58:00 -0800 | [diff] [blame] | 37 | ' |
| 38 | |
| 39 | test_expect_success 'notice misspelled upstream' ' |
| 40 | test_must_fail git log -1 --format=%s @{usptream} |
| 41 | ' |
| 42 | |
| 43 | test_expect_success 'complain about total nonsense' ' |
| 44 | test_must_fail git log -1 --format=%s @{utter.bogosity} |
| 45 | ' |
| 46 | |
| 47 | test_done |