From dec91ac36569cf33f019b04e36a9eb77c8316cc9 Mon Sep 17 00:00:00 2001 From: Tim Chevalier Date: Thu, 10 Oct 2024 16:17:07 -0700 Subject: [PATCH 1/6] Add tests for changes due to #885 (name/literal equality) --- test/tests/functions/string.json | 10 ++++++++++ test/tests/syntax.json | 27 +++++++++++++++++++++++++++ 2 files changed, 37 insertions(+) diff --git a/test/tests/functions/string.json b/test/tests/functions/string.json index 3543e7844a..d564fb4a1b 100644 --- a/test/tests/functions/string.json +++ b/test/tests/functions/string.json @@ -44,6 +44,16 @@ "type": "unresolved-variable" } ] + }, + { + "description": "NFC: keys are normalized", + "src": ".local $x = {\u1E0A\u0323 :string} .match $x \u1E0A\u0323 {{Not normalized}} \u1E0C\u0307 {{Normalized}} * {{Wrong}}", + "expErrors": [{"type": "duplicate-variant"}] + }, + { + "description": "NFC: keys are normalized", + "src": ".local $x = {\u1E0A\u0323 :string} .match $x \u1E0C\u0307 {{Right}} * {{Wrong}}", + "exp": "Right" } ] } diff --git a/test/tests/syntax.json b/test/tests/syntax.json index 27b74b2f30..7ac75770a7 100644 --- a/test/tests/syntax.json +++ b/test/tests/syntax.json @@ -697,6 +697,33 @@ { "src": "{{trailing whitespace}} \n", "exp": "trailing whitespace" + }, + { + "description": "NFC: literals are not normalized", + "src": "\u1E0A\u0323", + "exp": "\u1E0A\u0323" + }, + { + "description": "NFC: variables are compared to each other as-if normalized; decl is non-normalized, use is", + "src": ".local $\u0044\u0323\u0307 = {foo} {{{$\u1E0c\u0307}}}", + "exp": "foo" + }, + { + "description": "NFC: variables are compared to each other as-if normalized; decl is normalized, use isn't", + "src": ".local $\u1E0c\u0307 = {foo} {{{$\u0044\u0323\u0307}}}", + "exp": "foo" + }, + { + "description": "NFC: variables are compared to each other as-if normalized; decl is normalized, use isn't", + "src": ".input {$\u1E0c\u0307} {{{$\u0044\u0323\u0307}}}", + "params": [{"name": "\u1E0c\u0307", "value": "foo"}], + "exp": "foo" + }, + { + "description": "NFC: variables are compared to each other as-if normalized; decl is non-normalized, use is", + "src": ".input {$\u0044\u0323\u0307} {{{$\u1E0c\u0307}}}", + "params": [{"name": "\u0044\u0323\u0307", "value": "foo"}], + "exp": "foo" } ] } From 10062011982a9ef48100b455e4259cd353c14472 Mon Sep 17 00:00:00 2001 From: Tim Chevalier Date: Fri, 11 Oct 2024 11:54:40 -0700 Subject: [PATCH 2/6] Update test/tests/functions/string.json Co-authored-by: Eemeli Aro --- test/tests/functions/string.json | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/test/tests/functions/string.json b/test/tests/functions/string.json index d564fb4a1b..4bd93657d1 100644 --- a/test/tests/functions/string.json +++ b/test/tests/functions/string.json @@ -46,10 +46,20 @@ ] }, { - "description": "NFC: keys are normalized", + "description": "NFC: keys are normalized (unquoted)", "src": ".local $x = {\u1E0A\u0323 :string} .match $x \u1E0A\u0323 {{Not normalized}} \u1E0C\u0307 {{Normalized}} * {{Wrong}}", "expErrors": [{"type": "duplicate-variant"}] }, + { + "description": "NFC: keys are normalized (quoted)", + "src": ".local $x = {\u1E0A\u0323 :string} .match $x |\u1E0A\u0323| {{Not normalized}} |\u1E0C\u0307| {{Normalized}} * {{Wrong}}", + "expErrors": [{"type": "duplicate-variant"}] + }, + { + "description": "NFC: keys are normalized (mixed)", + "src": ".local $x = {\u1E0A\u0323 :string} .match $x \u1E0A\u0323 {{Not normalized}} |\u1E0C\u0307| {{Normalized}} * {{Wrong}}", + "expErrors": [{"type": "duplicate-variant"}] + }, { "description": "NFC: keys are normalized", "src": ".local $x = {\u1E0A\u0323 :string} .match $x \u1E0C\u0307 {{Right}} * {{Wrong}}", From 48a620520361bb6a57e095b0a79a695d5945e266 Mon Sep 17 00:00:00 2001 From: Tim Chevalier Date: Fri, 11 Oct 2024 11:54:47 -0700 Subject: [PATCH 3/6] Update test/tests/syntax.json Co-authored-by: Eemeli Aro --- test/tests/syntax.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/tests/syntax.json b/test/tests/syntax.json index 7ac75770a7..0164df08ab 100644 --- a/test/tests/syntax.json +++ b/test/tests/syntax.json @@ -699,7 +699,7 @@ "exp": "trailing whitespace" }, { - "description": "NFC: literals are not normalized", + "description": "NFC: text is not normalized", "src": "\u1E0A\u0323", "exp": "\u1E0A\u0323" }, From 2f893d9fd59c3673bf2fe84f460a7ebec2f72e11 Mon Sep 17 00:00:00 2001 From: Tim Chevalier Date: Fri, 11 Oct 2024 11:55:07 -0700 Subject: [PATCH 4/6] Update test/tests/functions/string.json Co-authored-by: Eemeli Aro --- test/tests/functions/string.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/tests/functions/string.json b/test/tests/functions/string.json index 4bd93657d1..451e43f92a 100644 --- a/test/tests/functions/string.json +++ b/test/tests/functions/string.json @@ -62,7 +62,7 @@ }, { "description": "NFC: keys are normalized", - "src": ".local $x = {\u1E0A\u0323 :string} .match $x \u1E0C\u0307 {{Right}} * {{Wrong}}", + "src": ".local $x = {\u1E0C\u0307 :string} .match $x \u1E0A\u0323 {{Right}} * {{Wrong}}", "exp": "Right" } ] From 80b73b71dd30809709737a847bc9bea8037713b8 Mon Sep 17 00:00:00 2001 From: Tim Chevalier Date: Fri, 11 Oct 2024 12:00:15 -0700 Subject: [PATCH 5/6] Added tests for reordering and special case mapping --- test/tests/syntax.json | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/test/tests/syntax.json b/test/tests/syntax.json index 0164df08ab..6082d094a4 100644 --- a/test/tests/syntax.json +++ b/test/tests/syntax.json @@ -724,6 +724,16 @@ "src": ".input {$\u0044\u0323\u0307} {{{$\u1E0c\u0307}}}", "params": [{"name": "\u0044\u0323\u0307", "value": "foo"}], "exp": "foo" + }, + { + "description": "NFC: variables are compared to each other as-if normalized; decl is non-normalized, use is; reordering", + "src": ".local $\u0044\u0307\u0323 = {foo} {{{$\u1E0c\u0307}}}", + "exp": "foo" + }, + { + "description": "NFC: variables are compared to each other as-if normalized; decl is non-normalized, use is; special case mapping", + "src": ".local $\u0041\u030A\u0301 = {foo} {{{$\u01FA}}}", + "exp": "foo" } ] } From 6bcd5922e660244e2ce574d89375f99e8b15e0a6 Mon Sep 17 00:00:00 2001 From: Tim Chevalier Date: Mon, 14 Oct 2024 11:05:30 -0700 Subject: [PATCH 6/6] Add another selection test --- test/tests/functions/string.json | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/test/tests/functions/string.json b/test/tests/functions/string.json index 451e43f92a..231868180d 100644 --- a/test/tests/functions/string.json +++ b/test/tests/functions/string.json @@ -61,7 +61,12 @@ "expErrors": [{"type": "duplicate-variant"}] }, { - "description": "NFC: keys are normalized", + "description": "NFC: :string normalizes the comparison value (un-normalized selector, normalized key)", + "src": ".local $x = {\u1E0A\u0323 :string} .match $x \u1E0C\u0307 {{Right}} * {{Wrong}}", + "exp": "Right" + }, + { + "description": "NFC: keys are normalized (normalized selector, un-normalized key)", "src": ".local $x = {\u1E0C\u0307 :string} .match $x \u1E0A\u0323 {{Right}} * {{Wrong}}", "exp": "Right" }