|
8 | 8 | % helper-file=nosuchfile.ext |
9 | 9 | ]{git-info} |
10 | 10 |
|
| 11 | +\makeatletter |
| 12 | +\newcommand\stypeout[1]{% |
| 13 | + \immediate\write\@unused{#1}} |
| 14 | +\makeatother |
| 15 | + |
| 16 | +\newcommand\showval[2]{% |
| 17 | + \stypeout{#2: -=|#1|=-}} |
| 18 | +\newcommand\testsec[1]{% |
| 19 | + \stypeout{^^J#1}} |
| 20 | + |
11 | 21 | \makeatletter |
12 | 22 | \newcommand\testdate[3][+0000]{% |
13 | 23 | \begingroup |
14 | | - \def\GI@head@timestamp{#2}% |
15 | | - \def\GI@head@timezone{#1}% |
16 | | - \GI@get@gen@datetime{head}% |
17 | | - \message{^^J#2#1:^^JMacro: \githeaddatetime}% |
18 | | - \message{^^JReal: \space#3}% |
| 24 | + \def\GI@timestamp{#2}% |
| 25 | + \def\GI@timezone{#1}% |
| 26 | + \GI@compute@datetime |
| 27 | + \stypeout{#2#1:^^JMacro: \expandafter\GI@dtmac@datetime\GI@datetime} |
| 28 | + \stypeout{Real: \space#3}% |
19 | 29 | \endgroup} |
20 | 30 | \makeatother |
21 | 31 |
|
| 32 | +% %% from the output of gen-test.php |
| 33 | +% \testsec{Date internal macros} |
22 | 34 | % \testdate{0}{1970-01-01T00:00:00+00:00} |
23 | 35 | % \testdate{2865906}{1970-02-03T04:05:06+00:00} |
24 | 36 | % \testdate{31535999}{1970-12-31T23:59:59+00:00} |
|
31 | 43 | % \testdate{983404799}{2001-02-28T23:59:59+00:00} |
32 | 44 | % \testdate{983404800}{2001-03-01T00:00:00+00:00} |
33 | 45 |
|
34 | | -\newcommand\showval[2]{% |
35 | | - \message{^^J#2: -=|#1|=-^^J}} |
36 | | - |
37 | | -\showval{\gitinfo{@head}{commit}} {Git head commit} |
38 | | -\showval{\gitinfo{@head}{branch}} {Git head branch} |
39 | | -\showval{\gitinfo{@head}{author}} {Git head author} |
40 | | -\showval{\gitinfo{@head}{mail}} {Git head mail} |
41 | | -\showval{\gitinfo{@head}{dt@datetime}} {Git head datetime} |
| 46 | +% \testsec{Basic head info} |
| 47 | +% \showval{\gitinfo{@head}{commit}} {Git head commit} |
| 48 | +% \showval{\gitinfo{@head}{branch}} {Git head branch} |
| 49 | +% \showval{\gitinfo{@head}{author}} {Git head author} |
| 50 | +% \showval{\gitinfo{@head}{mail}} {Git head mail} |
| 51 | +% \showval{\gitinfo{@head}{dt@datetime}} {Git head datetime} |
42 | 52 |
|
| 53 | +% \testsec{Default date formats -- head -- normal catcodes} |
43 | 54 | % \showval{\gitinfo{@head}{dt@}} {Git head dt (default)} |
44 | 55 | % \showval{\gitinfo{@head}{dt}} {Git head dt (empty)} |
45 | 56 | % \showval{\gitinfo{@head}{dt@date}} {Git head date} |
|
55 | 66 | % \showval{\gitinfo{@head}{dt@tzhour}} {Git head tzhour} |
56 | 67 | % \showval{\gitinfo{@head}{dt@tzmin}} {Git head tzmin} |
57 | 68 |
|
58 | | -% dt may have catcode problems, so test also when @ is a letter |
59 | | -% |
| 69 | +% \testsec{Default date formats -- head -- at a letter} |
60 | 70 | % \makeatletter |
61 | | -% \showval{\gitinfo{@head}{dt@datetime}} {Git head datetime (atletter)} |
62 | | -% \showval{\gitinfo{@head}{dt@}} {Git head dt (default) (atletter)} |
63 | | -% \showval{\gitinfo{@head}{dt}} {Git head dt (empty) (atletter)} |
| 71 | +% \showval{\gitinfo{@head}{dt@datetime}} {Git head datetime} |
| 72 | +% \showval{\gitinfo{@head}{dt@}} {Git head dt (default)} |
| 73 | +% \showval{\gitinfo{@head}{dt}} {Git head dt (empty)} |
64 | 74 | % \makeatother |
65 | 75 |
|
66 | | -% package options |
| 76 | +% \testsec{Package options} |
67 | 77 | % \makeatletter |
68 | 78 | % \showval\GI@max@depth{Internal value 'maxdepth'} |
69 | 79 | % \showval\GI@gih@name{Internal value 'gihname'} |
|
72 | 82 | \begin{document} |
73 | 83 |
|
74 | 84 | % Not expandable, so must be tested in typesetting context only. |
75 | | -% Githeadtoday: -=|\githeadtoday|=-\par |
| 85 | +% Git-head-today: -=|\gitinfo{@head}{dt@today}|=-\par |
76 | 86 |
|
77 | 87 | % Testing error messages (not expandable) |
78 | 88 | % \gitinfo{@head}{commit} |
|
0 commit comments