Skip to content

Commit fdee563

Browse files
authored
Remove expected output from date/time formatter tests (#760)
The expected output is implementation-specific. Also added a note in the README to that effect.
1 parent cc7603f commit fdee563

File tree

2 files changed

+18
-23
lines changed

2 files changed

+18
-23
lines changed

test/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,15 @@ These test files are intended to be useful for testing multiple different messag
1919
- `parts: object[]` — The expected result of formatting the message to parts.
2020
- `cleanSrc: string` — A normalixed form of `src`, for testing stringifiers.
2121
- `errors: { type: string }[]` — The runtime errors expected to be emitted when formatting the message.
22+
If `errors` is either absent or empty, the message must be formatted without errors.
2223
- `only: boolean` — Normally not set. A flag to use during development to only run one or more specific tests.
2324

2425
- `test-function.json` — An object with string keys and arrays of test cases as values,
2526
using the same definition as for `test-core.json`.
2627
The keys each correspond to a function that is used in the tests.
28+
Since the behavior of built-in formatters is implementation-specific,
29+
the `exp` field should generally be omitted,
30+
except for error cases.
2731

2832
TypeScript `.d.ts` files are included for `test-core.json` and `test-function.json` with the above definition.
2933

test/test-functions.json

Lines changed: 14 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,14 @@
66
"exp": "{|horse|}",
77
"errors": [{ "type": "bad-input" }]
88
},
9-
{ "src": "{|2006-01-02| :date}", "exp": "1/2/06" },
10-
{ "src": "{|2006-01-02T15:04:06| :date}", "exp": "1/2/06" },
11-
{ "src": "{|2006-01-02| :date style=long}", "exp": "January 2, 2006" },
9+
{ "src": "{|2006-01-02| :date}" },
10+
{ "src": "{|2006-01-02T15:04:06| :date}" },
11+
{ "src": "{|2006-01-02| :date style=long}" },
1212
{
13-
"src": ".local $d = {|2006-01-02| :date style=long} {{{$d :date}}}",
14-
"exp": "January 2, 2006"
13+
"src": ".local $d = {|2006-01-02| :date style=long} {{{$d :date}}}"
1514
},
1615
{
17-
"src": ".local $t = {|2006-01-02T15:04:06| :time} {{{$t :date}}}",
18-
"exp": "1/2/06"
16+
"src": ".local $t = {|2006-01-02T15:04:06| :time} {{{$t :date}}}"
1917
}
2018
],
2119
"time": [
@@ -25,18 +23,15 @@
2523
"exp": "{|horse|}",
2624
"errors": [{ "type": "bad-input" }]
2725
},
28-
{ "src": "{|2006-01-02T15:04:06| :time}", "exp": "3:04 PM" },
26+
{ "src": "{|2006-01-02T15:04:06| :time}" },
2927
{
30-
"src": "{|2006-01-02T15:04:06| :time style=medium}",
31-
"exp": "3:04:06 PM"
28+
"src": "{|2006-01-02T15:04:06| :time style=medium}"
3229
},
3330
{
34-
"src": ".local $t = {|2006-01-02T15:04:06| :time style=medium} {{{$t :time}}}",
35-
"exp": "3:04:06 PM"
31+
"src": ".local $t = {|2006-01-02T15:04:06| :time style=medium} {{{$t :time}}}"
3632
},
3733
{
38-
"src": ".local $d = {|2006-01-02T15:04:06| :date} {{{$d :time}}}",
39-
"exp": "3:04 PM"
34+
"src": ".local $d = {|2006-01-02T15:04:06| :date} {{{$d :time}}}"
4035
}
4136
],
4237
"datetime": [
@@ -56,23 +51,19 @@
5651
"exp": "{|horse|}",
5752
"errors": [{ "name": "RangeError" }]
5853
},
59-
{ "src": "{|2006-01-02T15:04:06| :datetime}", "exp": "1/2/06, 3:04 PM" },
54+
{ "src": "{|2006-01-02T15:04:06| :datetime}" },
6055
{
61-
"src": "{|2006-01-02T15:04:06| :datetime year=numeric month=|2-digit|}",
62-
"exp": "01/2006"
56+
"src": "{|2006-01-02T15:04:06| :datetime year=numeric month=|2-digit|}"
6357
},
6458
{
65-
"src": "{|2006-01-02T15:04:06| :datetime dateStyle=long}",
66-
"exp": "January 2, 2006"
59+
"src": "{|2006-01-02T15:04:06| :datetime dateStyle=long}"
6760
},
6861
{
69-
"src": "{|2006-01-02T15:04:06| :datetime timeStyle=medium}",
70-
"exp": "3:04:06 PM"
62+
"src": "{|2006-01-02T15:04:06| :datetime timeStyle=medium}"
7163
},
7264
{
7365
"src": "{$dt :datetime}",
74-
"params": { "dt": "2006-01-02T15:04:06" },
75-
"exp": "1/2/06, 3:04 PM"
66+
"params": { "dt": "2006-01-02T15:04:06" }
7667
}
7768
],
7869
"integer": [

0 commit comments

Comments
 (0)