| 1 | #!/bin/sh |
| 2 | |
| 3 | test_description='various @{whatever} syntax tests' |
| 4 | |
| 5 | . ./test-lib.sh |
| 6 | |
| 7 | test_expect_success 'setup' ' |
| 8 | test_commit one && |
| 9 | test_commit two |
| 10 | ' |
| 11 | |
| 12 | check_at() { |
| 13 | echo "$2" >expect && |
| 14 | git log -1 --format=%s "$1" >actual && |
| 15 | test_cmp expect actual |
| 16 | } |
| 17 | |
| 18 | test_expect_success '@{0} shows current' ' |
| 19 | check_at @{0} two |
| 20 | ' |
| 21 | |
| 22 | test_expect_success '@{1} shows old' ' |
| 23 | check_at @{1} one |
| 24 | ' |
| 25 | |
| 26 | test_expect_success '@{now} shows current' ' |
| 27 | check_at @{now} two |
| 28 | ' |
| 29 | |
| 30 | test_expect_success '@{2001-09-17} (before the first commit) shows old' ' |
| 31 | check_at @{2001-09-17} one |
| 32 | ' |
| 33 | |
| 34 | test_expect_success 'silly approxidates work' ' |
| 35 | check_at @{3.hot.dogs.on.2001-09-17} one |
| 36 | ' |
| 37 | |
| 38 | test_expect_success 'notice misspelled upstream' ' |
| 39 | test_must_fail git log -1 --format=%s @{usptream} |
| 40 | ' |
| 41 | |
| 42 | test_expect_success 'complain about total nonsense' ' |
| 43 | test_must_fail git log -1 --format=%s @{utter.bogosity} |
| 44 | ' |
| 45 | |
| 46 | test_done |