-
-
Notifications
You must be signed in to change notification settings - Fork 744
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ICU-22927 Duplicate (back) the MF2 test data between icu4c and icu4j
The C++ and Java implementations are done by two different people different companies. With different time constraints and availability. The spec is still not final (although it is close), and the implementations are still quite a bit behind. Sharing these test files slows down development, by forcing any C++ and Java changes to happen in the same time. There are other components that share test files that are not shared yet, even if they are more stable. So I don't know why we would force this on MF2 only. This is temporary, and the data files will be de-duplicated again at a later time, when the two implementations are more stable. That de-duplication will include other shared files, and in a slightly different structure (we have a doc and a discution on this topic).
- Loading branch information
Showing
34 changed files
with
3,855 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
icu4j/main/core/src/test/resources/com/ibm/icu/dev/test/message2/README.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
© 2024 and later: Unicode, Inc. and others. | ||
License & terms of use: http://www.unicode.org/copyright.html | ||
|
||
The format of the JSON files in this directory and subdirectories | ||
follow the test schema defined in the Conformance repository: | ||
|
||
https://github.com/unicode-org/conformance/blob/main/schema/message_fmt2/testgen_schema.json | ||
|
||
(as of https://github.com/unicode-org/conformance/pull/255 or later). | ||
|
||
# JSON notes | ||
|
||
In the "params" field, a date parameter can be expressed as: | ||
{ "date": n } | ||
where n is a number representing a Unix timestamp. | ||
|
||
In the "params" field, a decimal string parameter can be expressed as: | ||
{ "decimal": s } | ||
where s is a string. | ||
|
||
Optional fields, "ignoreJava" and "ignoreCpp" can be used | ||
for tests currently expected to fail in the respective language. | ||
The field may have any value; if it's | ||
present, the test is ignored. (The value can be a comment explaining | ||
why it's expected to fail.) | ||
|
||
Tests in the `spec/` subdirectory are taken from https://github.com/unicode-org/message-format-wg/blob/main/test . | ||
If the contents change upstream, then the corresponding tests in CLDR | ||
need to be updated (also see https://unicode-org.atlassian.net/browse/ICU-22812 ). | ||
|
||
## ICU4J only | ||
|
||
The `cleanSrc` fields is used to represent normalized input (ICU4C has its | ||
own function for normalizing input). | ||
|
||
## ICU4C only | ||
|
||
Additional "char" and "line" fields may be present with integer values, | ||
used for tests expected to trigger a syntax error. | ||
If present, "char" reflects the expected character offset and "line" | ||
reflects the expected line number in the parse error. | ||
The files with "diagnostics" in the name have these fields filled in. | ||
|
18 changes: 18 additions & 0 deletions
18
...ain/core/src/test/resources/com/ibm/icu/dev/test/message2/alias-selector-annotations.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{ | ||
"scenario": "Selector annotations", | ||
"description": "Tests for indirectly annotated selectors", | ||
"defaultTestProperties": { | ||
"locale": "en-US" | ||
}, | ||
"tests": [ | ||
{ | ||
"src": ".local $one = {|The one| :string}\n .match {$one}\n 1 {{Value is one}}\n * {{Value is not one}}", | ||
"exp": "Value is not one" | ||
}, | ||
{ | ||
"src": ".local $one = {|The one| :string}\n .local $two = {$one}\n .match {$two}\n 1 {{Value is one}}\n * {{Value is not one}}", | ||
"exp": "Value is not one" | ||
} | ||
] | ||
} | ||
|
43 changes: 43 additions & 0 deletions
43
icu4j/main/core/src/test/resources/com/ibm/icu/dev/test/message2/duplicate-declarations.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
{ | ||
"scenario": "Duplicate declaration errors", | ||
"description": "Tests that should trigger a duplicate declaration error", | ||
"defaultTestProperties": { | ||
"locale": "en-US", | ||
"expErrors": [ | ||
{ | ||
"type": "duplicate-declaration" | ||
} | ||
] | ||
}, | ||
"tests": [ | ||
{ | ||
"src": ".local $foo = {$foo} .local $foo = {42} {{bar {$foo}}}", | ||
"params": [{ "name": "foo", "value": "foo" }], | ||
"exp": "bar 42" | ||
}, | ||
{ | ||
"src": ".local $foo = {42} .local $foo = {42} {{bar {$foo}}}", | ||
"params": [{ "name": "foo", "value": "foo" }], | ||
"exp": "bar 42" | ||
}, | ||
{ | ||
"src": ".local $foo = {:unknown} .local $foo = {42} {{bar {$foo}}}", | ||
"params": [{ "name": "foo", "value": "foo" }], | ||
"exp": "bar 42" | ||
}, | ||
{ | ||
"src": ".local $x = {42} .local $y = {$x} .local $x = {13} {{{$x} {$y}}}", | ||
"exp": "13 42" | ||
}, | ||
{ | ||
"src": ".local $foo = {$foo} {{bar {$foo}}}", | ||
"params": [{ "name": "foo", "value": "foo" }], | ||
"exp": "bar foo" | ||
}, | ||
{ | ||
"src": ".local $foo = {$bar} .local $bar = {$baz} {{bar {$foo}}}", | ||
"params": [{ "name": "baz", "value": "foo" }], | ||
"exp": "bar {$bar}" | ||
} | ||
] | ||
} |
57 changes: 57 additions & 0 deletions
57
icu4j/main/core/src/test/resources/com/ibm/icu/dev/test/message2/icu-parser-tests.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
{ | ||
"scenario": "Valid tests", | ||
"description": "Additional valid tests", | ||
"defaultTestProperties": { | ||
"locale": "en-US" | ||
}, | ||
"tests": [ | ||
{ "src": "" }, | ||
{ "src": "Hello" }, | ||
{ "src": "Hello world!" }, | ||
{ "src": "Hello \t \n \r \\{ world!" }, | ||
{ "src": "Hello world {:datetime}" }, | ||
{ "src": "Hello world {foo}" }, | ||
{ "src": "Hello {0} world" }, | ||
{ "src": "Hello {123} world" }, | ||
{ "src": "Hello {-123} world" }, | ||
{ "src": "Hello {3.1416} world" }, | ||
{ "src": "Hello {-3.1416} world" }, | ||
{ "src": "Hello {123E+2} world" }, | ||
{ "src": "Hello {123E-2} world" }, | ||
{ "src": "Hello {123.456E+2} world" }, | ||
{ "src": "Hello {123.456E-2} world" }, | ||
{ "src": "Hello {-123.456E+2} world" }, | ||
{ "src": "Hello {-123.456E-2} world" }, | ||
{ "src": "Hello {-123E+2} world" }, | ||
{ "src": "Hello {-123E-2} world" }, | ||
{ "src": "Hello world {$exp}" }, | ||
{ "src": "Hello world {$exp :datetime}" }, | ||
{ "src": "Hello world {|2024-02-27| :datetime}" }, | ||
{ "src": "Hello world {$exp :datetime style=long} and more" }, | ||
{ "src": "Hello world {$exp :function number=1234} and more" }, | ||
{ "src": "Hello world {$exp :function unquoted=left } and more" }, | ||
{ "src": "Hello world {$exp :function quoted=|Something| } and more" }, | ||
{ "src": "Hello world {$exp :function quoted=|Something with spaces| } and more" }, | ||
{ "src": "Hello world {$exp :function quoted=|Something with \\| spaces and \\| escapes| } and more" }, | ||
{ "src": "Hello world {$exp :function number=1234 unquoted=left quoted=|Something|}" }, | ||
{ "src": "Hello world {$exp :function number=1234 unquoted=left quoted=|Something longer|}" }, | ||
{ "src": "Hello world {$exp :function number=1234 unquoted=left quoted=|Something \\| longer|}" }, | ||
{ "src": "Hello world {$exp}" }, | ||
{ "src": "Hello world {$exp @attr}" }, | ||
{ "src": "Hello world {$exp @valid @attr=a @attrb=123 @atrn=|foo bar|}" }, | ||
{ "src": "Hello world {$exp :date @valid @attr=aaaa @attrb=123 @atrn=|foo bar|}" }, | ||
{ "src": "Hello world {$exp :date year=numeric month=long day=numeric int=12 @valid @attr=a @attrb=123 @atrn=|foo bar|}" }, | ||
{ "src": "{{.starting with dot is OK here}}" }, | ||
{ "src": "{{Some string pattern \\}, with {$foo} and {$exp :date style=long}!}}" }, | ||
{ "src": ".input {$pi :number} {{}}" }, | ||
{ "src": ".input {$exp :date} {{}}" }, | ||
{ "src": ".local $foo = {$exp} {{}}" }, | ||
{ "src": ".local $foo = {$exp :date} {{}}" }, | ||
{ "src": ".local $foo = {$exp :date year=numeric month=long day=numeric} {{}}" }, | ||
{ "src": ".local $bar = {$foo :date month=medium} {{}}" }, | ||
{ "src": ".input {$a :date} .local $exp = {$a :date style=full} {{Your card expires on {$exp}!}}" }, | ||
{ "src": ".input {$a :date} .local $b = {$a :date year=numeric month=long day=numeric} .local $c = {$b :date month=medium} {{}}" }, | ||
{ "src": ".input {$x :number} {{_}}" }, | ||
{ "src": ".local $foo = {|1|} {{_}}" } | ||
] | ||
} |
Oops, something went wrong.