Skip to content

Commit 12b82c4

Browse files
aphillipseemeli
andauthored
Fix unpaired surrogate in test (#1072)
* Fix unpaired surrogate in test Fixes #1062 per 2025-04-21 call * Remove commenting Comments, of course, are not legal JSON either, but sometimes work... removing here so we can handle differently. * Update syntax-errors.json * Update test/tests/syntax-errors.json Co-authored-by: Eemeli Aro <[email protected]> * Update README.md * Update test/README.md Co-authored-by: Eemeli Aro <[email protected]> * Update test/README.md Co-authored-by: Eemeli Aro <[email protected]> --------- Co-authored-by: Eemeli Aro <[email protected]>
1 parent 81c7770 commit 12b82c4

File tree

2 files changed

+21
-4
lines changed

2 files changed

+21
-4
lines changed

test/README.md

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,25 @@
1-
The tests in the `./tests/` directory were originally copied from the [messageformat project](https://github.com/messageformat/messageformat/tree/11c95dab2b25db8454e49ff4daadb817e1d5b770/packages/mf2-messageformat/src/__fixtures)
2-
and are here relicensed by their original author (Eemeli Aro) under the Unicode License.
1+
# Unicode MessageFormat Test Suite
32

4-
These test files are intended to be useful for testing multiple different message processors in different ways:
3+
These test files are intended to be useful for testing multiple different _message_ processors in different ways:
54

65
- `syntax.json` — Test cases that do not depend on any registry definitions.
76

87
- `syntax-errors.json` — Strings that should produce a Syntax Error when parsed.
98

9+
> [!NOTE]
10+
> Tests for the disallowed uses of unpaired surrogate code points are not included
11+
> because JSON does not permit unpaired surrogate code points.
12+
> If your implementation uses UTF-16 based strings (such as JavaScript `String` or Java `java.lang.String`)
13+
> or otherwise allows unpaired surrogates in text or literals, you will need to implement tests equivalent
14+
> to the following for syntax errors:
15+
> ```json
16+
> {
17+
> "locale": "en-US",
18+
> "src": "{\ud800}",
19+
> "expErrors": [{ "type": "syntax-error" }]
20+
> }
21+
> ```
22+
1023
- `data-model-errors.json` - Strings that should produce a Data Model Error when processed.
1124
Error names are defined in ["MessageFormat 2.0 Errors"](../spec/errors.md) in the spec.
1225
@@ -192,3 +205,8 @@ except that it cannot be used for selection.
192205
193206
When `:test:format` is used as a _selector_,
194207
the steps under 2.iii. of [Resolve Selectors](/spec/formatting.md#resolve-selectors) are followed.
208+
209+
## About
210+
211+
The tests in the `./tests/` directory were originally copied from the [messageformat project](https://github.com/messageformat/messageformat/tree/11c95dab2b25db8454e49ff4daadb817e1d5b770/packages/mf2-messageformat/src/__fixtures)
212+
and are here relicensed by their original author (Eemeli Aro) under the Unicode License.

test/tests/syntax-errors.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,6 @@
192192
{ "src": "{^.}" },
193193
{ "src": "{^ .}" },
194194
{ "src": "{&}" },
195-
{ "src": "{\ud800}" },
196195
{ "src": "{\ufdd0}" },
197196
{ "src": "{\ufffe}" },
198197
{ "src": "{!.\\{}" },

0 commit comments

Comments
 (0)