From 600982205701ba363d5e17c6d6a2e88b8d4a0137 Mon Sep 17 00:00:00 2001 From: Zac Apl Date: Sun, 14 Apr 2024 11:48:21 +0100 Subject: [PATCH 1/3] base test implementation for const equality for strings based on evalutaion by individual codepoint --- tests/draft6/const.json | 52 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) diff --git a/tests/draft6/const.json b/tests/draft6/const.json index 1c2cafcc..e2ac5993 100644 --- a/tests/draft6/const.json +++ b/tests/draft6/const.json @@ -338,5 +338,57 @@ "valid": false } ] + }, + { + "description": "graphemes evaluated codepoint-for-codepoint", + "schema": { "const": "μ" }, + "tests": [ + { + "description": "grapheme is equal for codepoint", + "data": "μ", + "valid": true + }, + { + "description": "grapheme is not equal for codepoint", + "data": "µ", + "valid": false + }, + { + "description": "codepoint is equal for grapheme", + "data": "\u03bc", + "valid": true + }, + { + "description": "codepoint is not equal for grapheme", + "data": "\u00b5", + "valid": false + } + ] + }, + { + "description": "combining marks evaluated codepoint-for-codepoint", + "schema": { "const": "a\u0308" }, + "tests": [ + { + "description": "grapheme is equal codepoint-for-codepoint", + "data": "ä", + "valid": true + }, + { + "description": "grapheme is not equal codepoint-for-codepoint", + "data": "ä", + "valid": false + }, + { + "description": "codepoints are equal codepoint-for-codepoint", + "data": "\u0061\u0308", + "valid": true + }, + { + "description": "codepoints are not equal codepoint-for-codepoint", + "data": "\u00e4", + "valid": false + } + ] } ] From fd0df6cf0976ca7611cfcb3de4f669a02470e60e Mon Sep 17 00:00:00 2001 From: Jason Desrosiers Date: Wed, 29 Oct 2025 13:30:50 -0700 Subject: [PATCH 2/3] Update unicode tests per PR feedback --- tests/draft6/const.json | 48 ++++++++++++++++------------------------- 1 file changed, 19 insertions(+), 29 deletions(-) diff --git a/tests/draft6/const.json b/tests/draft6/const.json index e2ac5993..168fff4e 100644 --- a/tests/draft6/const.json +++ b/tests/draft6/const.json @@ -340,53 +340,43 @@ ] }, { - "description": "graphemes evaluated codepoint-for-codepoint", - "schema": { "const": "μ" }, + "description": "characters with the same visual representation but different codepoint", + "schema": { + "const": "μ", + "$comment": "U+03BC" + }, "tests": [ { - "description": "grapheme is equal for codepoint", + "description": "character uses the same codepoint", "data": "μ", + "comment": "U+03BC", "valid": true }, { - "description": "grapheme is not equal for codepoint", + "description": "character looks the same but uses a different codepoint", "data": "µ", - "valid": false - }, - { - "description": "codepoint is equal for grapheme", - "data": "\u03bc", - "valid": true - }, - { - "description": "codepoint is not equal for grapheme", - "data": "\u00b5", + "comment": "U+00B5", "valid": false } ] }, { - "description": "combining marks evaluated codepoint-for-codepoint", - "schema": { "const": "a\u0308" }, + "description": "characters with the same visual representation, but different number of codepoints", + "schema": { + "const": "ä", + "$comment": "U+00E4" + }, "tests": [ { - "description": "grapheme is equal codepoint-for-codepoint", - "data": "ä", - "valid": true - }, - { - "description": "grapheme is not equal codepoint-for-codepoint", + "description": "character uses the same codepoint", "data": "ä", - "valid": false - }, - { - "description": "codepoints are equal codepoint-for-codepoint", - "data": "\u0061\u0308", + "comment": "U+00E4", "valid": true }, { - "description": "codepoints are not equal codepoint-for-codepoint", - "data": "\u00e4", + "description": "character looks the same but uses combining marks", + "data": "ä", + "comment": "a, U+0308", "valid": false } ] From ed74ee74ba54f6efa8ab2ba452372b79be21111d Mon Sep 17 00:00:00 2001 From: Jason Desrosiers Date: Wed, 29 Oct 2025 13:31:28 -0700 Subject: [PATCH 3/3] Add unicode tests to all the dialects --- tests/draft2019-09/const.json | 44 +++++++++++++++++++++++++++++++++++ tests/draft2020-12/const.json | 44 +++++++++++++++++++++++++++++++++++ tests/draft4/enum.json | 42 +++++++++++++++++++++++++++++++++ tests/draft7/const.json | 42 +++++++++++++++++++++++++++++++++ tests/v1/const.json | 44 +++++++++++++++++++++++++++++++++++ 5 files changed, 216 insertions(+) diff --git a/tests/draft2019-09/const.json b/tests/draft2019-09/const.json index 29700fda..14debdd7 100644 --- a/tests/draft2019-09/const.json +++ b/tests/draft2019-09/const.json @@ -383,5 +383,49 @@ "valid": false } ] + }, + { + "description": "characters with the same visual representation but different codepoint", + "schema": { + "$schema": "https://json-schema.org/draft/2019-09/schema", + "const": "μ", + "$comment": "U+03BC" + }, + "tests": [ + { + "description": "character uses the same codepoint", + "data": "μ", + "comment": "U+03BC", + "valid": true + }, + { + "description": "character looks the same but uses a different codepoint", + "data": "µ", + "comment": "U+00B5", + "valid": false + } + ] + }, + { + "description": "characters with the same visual representation, but different number of codepoints", + "schema": { + "$schema": "https://json-schema.org/draft/2019-09/schema", + "const": "ä", + "$comment": "U+00E4" + }, + "tests": [ + { + "description": "character uses the same codepoint", + "data": "ä", + "comment": "U+00E4", + "valid": true + }, + { + "description": "character looks the same but uses combining marks", + "data": "ä", + "comment": "a, U+0308", + "valid": false + } + ] } ] diff --git a/tests/draft2020-12/const.json b/tests/draft2020-12/const.json index 50be86a0..72ea3f04 100644 --- a/tests/draft2020-12/const.json +++ b/tests/draft2020-12/const.json @@ -383,5 +383,49 @@ "valid": false } ] + }, + { + "description": "characters with the same visual representation but different codepoint", + "schema": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "const": "μ", + "$comment": "U+03BC" + }, + "tests": [ + { + "description": "character uses the same codepoint", + "data": "μ", + "comment": "U+03BC", + "valid": true + }, + { + "description": "character looks the same but uses a different codepoint", + "data": "µ", + "comment": "U+00B5", + "valid": false + } + ] + }, + { + "description": "characters with the same visual representation, but different number of codepoints", + "schema": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "const": "ä", + "$comment": "U+00E4" + }, + "tests": [ + { + "description": "character uses the same codepoint", + "data": "ä", + "comment": "U+00E4", + "valid": true + }, + { + "description": "character looks the same but uses combining marks", + "data": "ä", + "comment": "a, U+0308", + "valid": false + } + ] } ] diff --git a/tests/draft4/enum.json b/tests/draft4/enum.json index ce43acc0..f023a492 100644 --- a/tests/draft4/enum.json +++ b/tests/draft4/enum.json @@ -316,5 +316,47 @@ "valid": false } ] + }, + { + "description": "characters with the same visual representation but different codepoint", + "schema": { + "enum": ["μ"], + "$comment": "U+03BC" + }, + "tests": [ + { + "description": "character uses the same codepoint", + "data": "μ", + "comment": "U+03BC", + "valid": true + }, + { + "description": "character looks the same but uses a different codepoint", + "data": "µ", + "comment": "U+00B5", + "valid": false + } + ] + }, + { + "description": "characters with the same visual representation, but different number of codepoints", + "schema": { + "enum": ["ä"], + "$comment": "U+00E4" + }, + "tests": [ + { + "description": "character uses the same codepoint", + "data": "ä", + "comment": "U+00E4", + "valid": true + }, + { + "description": "character looks the same but uses combining marks", + "data": "ä", + "comment": "a, U+0308", + "valid": false + } + ] } ] diff --git a/tests/draft7/const.json b/tests/draft7/const.json index 1c2cafcc..168fff4e 100644 --- a/tests/draft7/const.json +++ b/tests/draft7/const.json @@ -338,5 +338,47 @@ "valid": false } ] + }, + { + "description": "characters with the same visual representation but different codepoint", + "schema": { + "const": "μ", + "$comment": "U+03BC" + }, + "tests": [ + { + "description": "character uses the same codepoint", + "data": "μ", + "comment": "U+03BC", + "valid": true + }, + { + "description": "character looks the same but uses a different codepoint", + "data": "µ", + "comment": "U+00B5", + "valid": false + } + ] + }, + { + "description": "characters with the same visual representation, but different number of codepoints", + "schema": { + "const": "ä", + "$comment": "U+00E4" + }, + "tests": [ + { + "description": "character uses the same codepoint", + "data": "ä", + "comment": "U+00E4", + "valid": true + }, + { + "description": "character looks the same but uses combining marks", + "data": "ä", + "comment": "a, U+0308", + "valid": false + } + ] } ] diff --git a/tests/v1/const.json b/tests/v1/const.json index 94f41e70..711450c8 100644 --- a/tests/v1/const.json +++ b/tests/v1/const.json @@ -383,5 +383,49 @@ "valid": false } ] + }, + { + "description": "characters with the same visual representation but different codepoint", + "schema": { + "$schema": "https://json-schema.org/v1", + "const": "μ", + "$comment": "U+03BC" + }, + "tests": [ + { + "description": "character uses the same codepoint", + "data": "μ", + "comment": "U+03BC", + "valid": true + }, + { + "description": "character looks the same but uses a different codepoint", + "data": "µ", + "comment": "U+00B5", + "valid": false + } + ] + }, + { + "description": "characters with the same visual representation, but different number of codepoints", + "schema": { + "$schema": "https://json-schema.org/v1", + "const": "ä", + "$comment": "U+00E4" + }, + "tests": [ + { + "description": "character uses the same codepoint", + "data": "ä", + "comment": "U+00E4", + "valid": true + }, + { + "description": "character looks the same but uses combining marks", + "data": "ä", + "comment": "a, U+0308", + "valid": false + } + ] } ]