1*912701f9SAndroid Build Coastguard Worker# Test Data for CLDR MessageFormat 2.0 Tech Preview 2*912701f9SAndroid Build Coastguard Worker 3*912701f9SAndroid Build Coastguard WorkerFor information about MessageFormat 2.0, see [Unicode Locale Data Markup Language (LDML): Part 9: Message Format](../../../docs/ldml/tr35-messageFormat.md) 4*912701f9SAndroid Build Coastguard Worker 5*912701f9SAndroid Build Coastguard WorkerThe files in this directory were originally copied from the [messageformat project](https://github.com/messageformat/messageformat/tree/11c95dab2b25db8454e49ff4daadb817e1d5b770/packages/mf2-messageformat/src/__fixtures) 6*912701f9SAndroid Build Coastguard Workerand are here relicensed by their original author (Eemeli Aro) under the Unicode License. 7*912701f9SAndroid Build Coastguard Worker 8*912701f9SAndroid Build Coastguard WorkerThese test files are intended to be useful for testing multiple different message processors in different ways: 9*912701f9SAndroid Build Coastguard Worker 10*912701f9SAndroid Build Coastguard Worker- `syntax-errors.json` — An array of strings that should produce a Syntax Error when parsed. 11*912701f9SAndroid Build Coastguard Worker 12*912701f9SAndroid Build Coastguard Worker- `data-model-errors.json` - An object with string keys and arrays of strings as values, 13*912701f9SAndroid Build Coastguard Worker where each key is the name of an error and its value is an array of strings that 14*912701f9SAndroid Build Coastguard Worker should produce `error` when processed. 15*912701f9SAndroid Build Coastguard Worker Error names are defined in ["MessageFormat 2.0 Errors"](../../../docs/ldml/tr35-messageFormat.md#errors) in the spec. 16*912701f9SAndroid Build Coastguard Worker 17*912701f9SAndroid Build Coastguard Worker- `test-core.json` — An array of test cases that do not depend on any registry definitions. 18*912701f9SAndroid Build Coastguard Worker Each test may include some of the following fields: 19*912701f9SAndroid Build Coastguard Worker - `src: string` (required) — The MF2 syntax source. 20*912701f9SAndroid Build Coastguard Worker - `exp: string` (required) — The expected result of formatting the message to a string. 21*912701f9SAndroid Build Coastguard Worker - `locale: string` — The locale to use for formatting. Defaults to 'en-US'. 22*912701f9SAndroid Build Coastguard Worker - `params: Record<string, string | number | null | undefined>` — Parameters to pass in to the formatter for resolving external variables. 23*912701f9SAndroid Build Coastguard Worker - `parts: object[]` — The expected result of formatting the message to parts. 24*912701f9SAndroid Build Coastguard Worker - `cleanSrc: string` — A normalixed form of `src`, for testing stringifiers. 25*912701f9SAndroid Build Coastguard Worker - `errors: { type: string }[]` — The runtime errors expected to be emitted when formatting the message. 26*912701f9SAndroid Build Coastguard Worker If `errors` is either absent or empty, the message must be formatted without errors. 27*912701f9SAndroid Build Coastguard Worker - `only: boolean` — Normally not set. A flag to use during development to only run one or more specific tests. 28*912701f9SAndroid Build Coastguard Worker 29*912701f9SAndroid Build Coastguard Worker- `test-function.json` — An object with string keys and arrays of test cases as values, 30*912701f9SAndroid Build Coastguard Worker using the same definition as for `test-core.json`. 31*912701f9SAndroid Build Coastguard Worker The keys each correspond to a function that is used in the tests. 32*912701f9SAndroid Build Coastguard Worker Since the behavior of built-in formatters is implementation-specific, 33*912701f9SAndroid Build Coastguard Worker the `exp` field should generally be omitted, 34*912701f9SAndroid Build Coastguard Worker except for error cases. 35*912701f9SAndroid Build Coastguard Worker 36*912701f9SAndroid Build Coastguard WorkerTypeScript `.d.ts` files are included for `test-core.json` and `test-function.json` with the above definition. 37*912701f9SAndroid Build Coastguard Worker 38*912701f9SAndroid Build Coastguard WorkerSome examples of test harnesses using these tests, from the source repository: 39*912701f9SAndroid Build Coastguard Worker- [CST parse/stringify tests](https://github.com/messageformat/messageformat/blob/11c95dab2b25db8454e49ff4daadb817e1d5b770/packages/mf2-messageformat/src/cst/cst.test.ts) 40*912701f9SAndroid Build Coastguard Worker- [Data model stringify tests](https://github.com/messageformat/messageformat/blob/11c95dab2b25db8454e49ff4daadb817e1d5b770/packages/mf2-messageformat/src/data-model/stringify.test.ts) 41*912701f9SAndroid Build Coastguard Worker- [Formatting tests](https://github.com/messageformat/messageformat/blob/11c95dab2b25db8454e49ff4daadb817e1d5b770/packages/mf2-messageformat/src/messageformat.test.ts) 42