From c8f87892e51a649b68280252f262f137196b81bd Mon Sep 17 00:00:00 2001 From: Zac-HD Date: Fri, 4 Oct 2019 22:34:32 +1000 Subject: [PATCH] Add trailine-newline tests for $ pattern --- .../optional/ecmascript-regex.json | 19 +++++++++++++++++++ tests/draft4/optional/ecmascript-regex.json | 19 +++++++++++++++++++ tests/draft6/optional/ecmascript-regex.json | 19 +++++++++++++++++++ tests/draft7/optional/ecmascript-regex.json | 19 +++++++++++++++++++ 4 files changed, 76 insertions(+) diff --git a/tests/draft2019-09/optional/ecmascript-regex.json b/tests/draft2019-09/optional/ecmascript-regex.json index 81643f8c..7a0cb77e 100644 --- a/tests/draft2019-09/optional/ecmascript-regex.json +++ b/tests/draft2019-09/optional/ecmascript-regex.json @@ -10,6 +10,25 @@ } ] }, + { + "description": "ECMA 262 regex $ does not match trailing newline", + "schema": { + "type": "string", + "pattern": "^abc$" + }, + "tests": [ + { + "description": "matches in Python, but should not in jsonschema", + "data": "abc\n", + "valid": false + }, + { + "description": "should match", + "data": "abc", + "valid": true + } + ] + }, { "description": "ECMA 262 regex converts \\a to ascii BEL", "schema": { diff --git a/tests/draft4/optional/ecmascript-regex.json b/tests/draft4/optional/ecmascript-regex.json index 81643f8c..7a0cb77e 100644 --- a/tests/draft4/optional/ecmascript-regex.json +++ b/tests/draft4/optional/ecmascript-regex.json @@ -10,6 +10,25 @@ } ] }, + { + "description": "ECMA 262 regex $ does not match trailing newline", + "schema": { + "type": "string", + "pattern": "^abc$" + }, + "tests": [ + { + "description": "matches in Python, but should not in jsonschema", + "data": "abc\n", + "valid": false + }, + { + "description": "should match", + "data": "abc", + "valid": true + } + ] + }, { "description": "ECMA 262 regex converts \\a to ascii BEL", "schema": { diff --git a/tests/draft6/optional/ecmascript-regex.json b/tests/draft6/optional/ecmascript-regex.json index 81643f8c..7a0cb77e 100644 --- a/tests/draft6/optional/ecmascript-regex.json +++ b/tests/draft6/optional/ecmascript-regex.json @@ -10,6 +10,25 @@ } ] }, + { + "description": "ECMA 262 regex $ does not match trailing newline", + "schema": { + "type": "string", + "pattern": "^abc$" + }, + "tests": [ + { + "description": "matches in Python, but should not in jsonschema", + "data": "abc\n", + "valid": false + }, + { + "description": "should match", + "data": "abc", + "valid": true + } + ] + }, { "description": "ECMA 262 regex converts \\a to ascii BEL", "schema": { diff --git a/tests/draft7/optional/ecmascript-regex.json b/tests/draft7/optional/ecmascript-regex.json index 81643f8c..7a0cb77e 100644 --- a/tests/draft7/optional/ecmascript-regex.json +++ b/tests/draft7/optional/ecmascript-regex.json @@ -10,6 +10,25 @@ } ] }, + { + "description": "ECMA 262 regex $ does not match trailing newline", + "schema": { + "type": "string", + "pattern": "^abc$" + }, + "tests": [ + { + "description": "matches in Python, but should not in jsonschema", + "data": "abc\n", + "valid": false + }, + { + "description": "should match", + "data": "abc", + "valid": true + } + ] + }, { "description": "ECMA 262 regex converts \\a to ascii BEL", "schema": {