Skip to content

Commit

Permalink
feat(developer): support normalization=disabled 🙀
Browse files Browse the repository at this point in the history
- test and code fixes

#10554
  • Loading branch information
srl295 committed Feb 2, 2024
1 parent 7572c94 commit 3a538c1
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 21 deletions.
36 changes: 18 additions & 18 deletions core/tests/unit/ldml/keyboards/k_009_transform_nfc-test.xml
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,12 @@
<keystroke key="e" />
<keystroke key="u-0300" />
<keystroke key="u-0320" />
<check result="YES1" />
<check result="1NO0" />
</test>
<test name="regex-test-1-nfd2">
<keystroke key="1" />
<keystroke key="nfd" />
<check result="YES1" />
<check result="1e\u{0320}\u{0300}" />
</test>
<test name="regex-test-1-nfc">
<keystroke key="1" />
Expand All @@ -61,7 +61,7 @@
<test name="regex-test-1-nfd-ooo2">
<keystroke key="1" />
<keystroke key="not-nfd" />
<check result="YES1" />
<check result="1NO0" />
</test>
</tests>
<tests name="regex-tests-2">
Expand All @@ -70,12 +70,12 @@
<keystroke key="e" />
<keystroke key="u-0300" />
<keystroke key="u-0320" />
<check result="2e\u{0300}\u{0320}" />
<check result="2NO0" />
</test>
<test name="regex-test-2-nfd2">
<keystroke key="2" />
<keystroke key="nfd" />
<check result="2e\u{0320}\u{0300}" />
<check result="YES2" />
</test>
<test name="regex-test-2-nfc">
<keystroke key="2" />
Expand All @@ -92,7 +92,7 @@
<test name="regex-test-2-nfd-ooo2">
<keystroke key="2" />
<keystroke key="not-nfd" />
<check result="YES2" />
<check result="2NO0" />
</test>
</tests>
<tests name="regex-tests-3">
Expand All @@ -101,7 +101,7 @@
<keystroke key="e" />
<keystroke key="u-0300" />
<keystroke key="u-0320" />
<check result="3e\u{0300}\u{0320}" />
<check result="3NO0" />
</test>
<test name="regex-test-3-nfd2">
<keystroke key="3" />
Expand All @@ -123,7 +123,7 @@
<test name="regex-test-3-nfd-ooo2">
<keystroke key="3" />
<keystroke key="not-nfd" />
<check result="3\u{00e8}\u{0320}" />
<check result="3NO0" />
</test>
</tests>
<tests name="regex-tests-4">
Expand Down Expand Up @@ -175,15 +175,15 @@
<keystroke key="e" />
<keystroke key="u-0300" />
<keystroke key="u-0320" />
<check result="YES4x" />
<check result="4NO0" />
</test>
<test name="regex-test-4a-1x">
<keystroke key="4" />
<keystroke key="stampy" />
<keystroke key="e" />
<keystroke key="u-0300" />
<keystroke key="u-0320" />
<check result="YES4a" />
<check result="4NO0" />
</test>
<test name="regex-test-4a-2x">
<keystroke key="4" />
Expand All @@ -207,7 +207,7 @@
<keystroke key="u-0300" />
<keystroke key="u-0320" />
<keystroke key="stampy" />
<check result="YES4d" />
<check result="4NOYES0" />
</test>
</tests>
<tests name="regex-tests-5">
Expand Down Expand Up @@ -293,7 +293,7 @@
<keystroke key="u-0320"/>
<keystroke key="stampy"/>
<keystroke key="lgtm"/>
<check result="YES8c"/>
<check result="8NOYESYES0"/>
</test>
<test name="regex-test-8e-1">
<keystroke key="8" />
Expand All @@ -302,7 +302,7 @@
<keystroke key="u-0300"/>
<keystroke key="stampy"/>
<keystroke key="lgtm"/>
<check result="YES8c"/>
<check result="8e\u{0320}\u{0300}"/>
</test>
<test name="regex-test-8f-0">
<keystroke key="8" />
Expand All @@ -311,7 +311,7 @@
<keystroke key="u-0320"/>
<keystroke key="stampy"/>
<keystroke key="lgtm"/>
<check result="YES8d"/>
<check result="8f\u{0300}\u{0320}"/>
</test>
<test name="regex-test-8f-1">
<keystroke key="8" />
Expand All @@ -332,12 +332,12 @@
<test name="regex-test-9b">
<keystroke key="9" />
<keystroke key="a" />
<check result="9e\u{0320}\u{0300}"/>
<check result="9e\u{0300}\u{0320}"/>
</test>
<test name="regex-test-9c">
<keystroke key="9" />
<keystroke key="c" />
<check result="YES9c"/>
<check result="9ce\u{0300}\u{0320}"/>
</test>
<test name="regex-test-9d">
<keystroke key="9" />
Expand All @@ -357,7 +357,7 @@
<keystroke key="u-0300" /> <!-- out of order -->
<keystroke key="u-0320" />
<keystroke key="lgtm" />
<check result="YES9e" />
<check result="9ee\u{0300}e\u{0300}\u{0320}" />
</test>
<test name="regex-test-9e-0">
<keystroke key="9" />
Expand All @@ -369,7 +369,7 @@
<keystroke key="u-0320" />
<keystroke key="u-0300" /> <!-- in order -->
<keystroke key="lgtm" />
<check result="YES9e" />
<check result="9ee\u{0300}e\u{0320}\u{0300}" />
</test>
</tests>
<tests name="regex-tests-9f">
Expand Down
6 changes: 3 additions & 3 deletions core/tests/unit/ldml/ldml_test_source.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -511,7 +511,7 @@ LdmlJsonTestSource::next_action(ldml_action &fillin) {
if (type == "check") {
fillin.type = LDML_ACTION_CHECK_EXPECTED;
fillin.string = LdmlTestSource::parse_u8_source_string(result.get<std::string>());
if (get_normalization_disabled()) {
if (!get_normalization_disabled()) {
assert(km::core::ldml::normalize_nfd(fillin.string)); // TODO-LDML: will be NFC when core is normalizing to NFC
}
return;
Expand All @@ -526,7 +526,7 @@ LdmlJsonTestSource::next_action(ldml_action &fillin) {
} else if (type == "emit") {
fillin.type = LDML_ACTION_EMIT_STRING;
fillin.string = LdmlTestSource::parse_u8_source_string(to.get<std::string>());
if (get_normalization_disabled()) {
if (!get_normalization_disabled()) {
assert(km::core::ldml::normalize_nfd(fillin.string)); // TODO-LDML: will be NFC when core is normalizing to NFC
}
return;
Expand All @@ -553,7 +553,7 @@ LdmlJsonTestSource::get_context() {
// only set startContext if present - it's optional.
auto startContext = data["/startContext/to"_json_pointer];
context = LdmlTestSource::parse_u8_source_string(startContext);
if (get_normalization_disabled()) {
if (!get_normalization_disabled()) {
assert(km::core::ldml::normalize_nfd(context)); // TODO-LDML: should be NFC
}
}
Expand Down

0 comments on commit 3a538c1

Please sign in to comment.