From e2353bdc2265056b425feb004384afc69a321fa0 Mon Sep 17 00:00:00 2001 From: Tim Chevalier Date: Mon, 9 Dec 2024 14:29:25 -0800 Subject: [PATCH] Add tests from fuzzer --- .../intltest/messageformat2test_read_json.cpp | 1 + testdata/message2/more-syntax-errors.json | 21 +++++++++++++++++++ 2 files changed, 22 insertions(+) create mode 100644 testdata/message2/more-syntax-errors.json diff --git a/icu4c/source/test/intltest/messageformat2test_read_json.cpp b/icu4c/source/test/intltest/messageformat2test_read_json.cpp index b709af754675..3e378d6b905f 100644 --- a/icu4c/source/test/intltest/messageformat2test_read_json.cpp +++ b/icu4c/source/test/intltest/messageformat2test_read_json.cpp @@ -327,6 +327,7 @@ void TestMessageFormat2::jsonTestsFromFiles(IcuTestErrorCode& errorCode) { runTestsFromJsonFile(*this, "matches-whitespace.json", errorCode); runTestsFromJsonFile(*this, "alias-selector-annotations.json", errorCode); runTestsFromJsonFile(*this, "runtime-errors.json", errorCode); + runTestsFromJsonFile(*this, "more-syntax-errors.json", errorCode); // Re: the expected output for the first test in this file: // Note: the more "correct" fallback output seems like it should be "1.000 3" (ignoring the diff --git a/testdata/message2/more-syntax-errors.json b/testdata/message2/more-syntax-errors.json new file mode 100644 index 000000000000..6e1b86e8efba --- /dev/null +++ b/testdata/message2/more-syntax-errors.json @@ -0,0 +1,21 @@ +{ + "$schema": "https://raw.githubusercontent.com/unicode-org/message-format-wg/main/test/schemas/v0/tests.schema.json", + "scenario": "Syntax errors", + "description": "Strings that produce syntax errors when parsed.", + "defaultTestProperties": { + "locale": "en-US", + "expErrors": [ + { + "type": "syntax-error" + } + ] + }, + "tests": [ + { + "src": "{\u0000/\u0000g }\u0000\u0000\u0000\u0000\u000c" + }, + { + "src": ".\u0000$\u0000.\u0000\u00ca$\u0000\u0000\u00f9\u00f9{\u0000{\u0000{\u0000/\u0000\u00ff$\u00ff\u00ff\u00ff\u00ff" + } + ] +}