blob: 878aadd64c9517dc1891031bd8bee0b298cfccb6 [file] [log] [blame]
Junio C Hamano93cfa7c2010-01-26 11:58:00 -08001#!/bin/sh
2
3test_description='various @{whatever} syntax tests'
Ævar Arnfjörð Bjarmason7a98d9a2022-04-13 22:01:47 +02004
5TEST_PASSES_SANITIZE_LEAK=true
Junio C Hamano93cfa7c2010-01-26 11:58:00 -08006. ./test-lib.sh
7
8test_expect_success 'setup' '
9 test_commit one &&
10 test_commit two
11'
12
13check_at() {
14 echo "$2" >expect &&
15 git log -1 --format=%s "$1" >actual &&
16 test_cmp expect actual
17}
18
19test_expect_success '@{0} shows current' '
20 check_at @{0} two
21'
22
23test_expect_success '@{1} shows old' '
24 check_at @{1} one
25'
26
27test_expect_success '@{now} shows current' '
28 check_at @{now} two
29'
30
Junio C Hamano6c647af2010-01-27 10:54:22 -080031test_expect_success '@{2001-09-17} (before the first commit) shows old' '
32 check_at @{2001-09-17} one
Junio C Hamano93cfa7c2010-01-26 11:58:00 -080033'
34
35test_expect_success 'silly approxidates work' '
Jeff King8e52dc32010-01-28 03:52:18 -050036 check_at @{3.hot.dogs.on.2001-09-17} one
Junio C Hamano93cfa7c2010-01-26 11:58:00 -080037'
38
39test_expect_success 'notice misspelled upstream' '
40 test_must_fail git log -1 --format=%s @{usptream}
41'
42
43test_expect_success 'complain about total nonsense' '
44 test_must_fail git log -1 --format=%s @{utter.bogosity}
45'
46
47test_done