Skip to content

Tests for ECMA 262 regex dialect #282

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 2, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
181 changes: 181 additions & 0 deletions tests/draft2019-09/optional/ecmascript-regex.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,186 @@
"valid": false
}
]
},
{
"description": "ECMA 262 regex converts \\a to ascii BEL",
"schema": {
"type": "string",
"pattern": "^\\a$"
},
"tests": [
{
"description": "does not match",
"data": "\\a",
"valid": false
},
{
"description": "matches",
"data": "\u0007",
"valid": true
}
]
},
{
"description": "ECMA 262 regex escapes control codes with \\c and upper letter",
"schema": {
"type": "string",
"pattern": "^\\cC$"
},
"tests": [
{
"description": "does not match",
"data": "\\cC",
"valid": false
},
{
"description": "matches",
"data": "\u0003",
"valid": true
}
]
},
{
"description": "ECMA 262 regex escapes control codes with \\c and lower letter",
"schema": {
"type": "string",
"pattern": "^\\cc$"
},
"tests": [
{
"description": "does not match",
"data": "\\cc",
"valid": false
},
{
"description": "matches",
"data": "\u0003",
"valid": true
}
]
},
{
"description": "ECMA 262 \\d matches ascii digits only",
"schema": {
"type": "string",
"pattern": "^\\d$"
},
"tests": [
{
"description": "ASCII zero matches",
"data": "0",
"valid": true
},
{
"description": "NKO DIGIT ZERO does not match (unlike e.g. Python)",
"data": "߀",
"valid": false
},
{
"description": "NKO DIGIT ZERO (as \\u escape) does not match",
"data": "\\u07c0",
"valid": false
}
]
},
{
"description": "ECMA 262 \\D matches everything but ascii digits",
"schema": {
"type": "string",
"pattern": "^\\D$"
},
"tests": [
{
"description": "ASCII zero does not match",
"data": "0",
"valid": false
},
{
"description": "NKO DIGIT ZERO matches (unlike e.g. Python)",
"data": "߀",
"valid": true
},
{
"description": "NKO DIGIT ZERO (as \\u escape) matches",
"data": "\\u07c0",
"valid": true
}
]
},
{
"description": "ECMA 262 \\w matches ascii letters only",
"schema": {
"type": "string",
"pattern": "^\\w$"
},
"tests": [
{
"description": "ASCII 'a' matches",
"data": "a",
"valid": true
},
{
"description": "latin-1 e-acute does not match (unlike e.g. Python)",
"data": "é",
"valid": false
}
]
},
{
"description": "ECMA 262 \\w matches everything but ascii letters",
"schema": {
"type": "string",
"pattern": "^\\W$"
},
"tests": [
{
"description": "ASCII 'a' does not match",
"data": "a",
"valid": false
},
{
"description": "latin-1 e-acute matches (unlike e.g. Python)",
"data": "é",
"valid": true
}
]
},
{
"description": "ECMA 262 \\s matches ascii whitespace only",
"schema": {
"type": "string",
"pattern": "^\\s$"
},
"tests": [
{
"description": "ASCII space matches",
"data": " ",
"valid": true
},
{
"description": "latin-1 non-breaking-space does not match (unlike e.g. Python)",
"data": "\\u00a0",
"valid": false
}
]
},
{
"description": "ECMA 262 \\S matches everything but ascii whitespace",
"schema": {
"type": "string",
"pattern": "^\\S$"
},
"tests": [
{
"description": "ASCII space does not match",
"data": " ",
"valid": false
},
{
"description": "latin-1 non-breaking-space matches (unlike e.g. Python)",
"data": "\\u00a0",
"valid": true
}
]
}
]
181 changes: 181 additions & 0 deletions tests/draft4/optional/ecmascript-regex.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,186 @@
"valid": false
}
]
},
{
"description": "ECMA 262 regex converts \\a to ascii BEL",
"schema": {
"type": "string",
"pattern": "^\\a$"
},
"tests": [
{
"description": "does not match",
"data": "\\a",
"valid": false
},
{
"description": "matches",
"data": "\u0007",
"valid": true
}
]
},
{
"description": "ECMA 262 regex escapes control codes with \\c and upper letter",
"schema": {
"type": "string",
"pattern": "^\\cC$"
},
"tests": [
{
"description": "does not match",
"data": "\\cC",
"valid": false
},
{
"description": "matches",
"data": "\u0003",
"valid": true
}
]
},
{
"description": "ECMA 262 regex escapes control codes with \\c and lower letter",
"schema": {
"type": "string",
"pattern": "^\\cc$"
},
"tests": [
{
"description": "does not match",
"data": "\\cc",
"valid": false
},
{
"description": "matches",
"data": "\u0003",
"valid": true
}
]
},
{
"description": "ECMA 262 \\d matches ascii digits only",
"schema": {
"type": "string",
"pattern": "^\\d$"
},
"tests": [
{
"description": "ASCII zero matches",
"data": "0",
"valid": true
},
{
"description": "NKO DIGIT ZERO does not match (unlike e.g. Python)",
"data": "߀",
"valid": false
},
{
"description": "NKO DIGIT ZERO (as \\u escape) does not match",
"data": "\\u07c0",
"valid": false
}
]
},
{
"description": "ECMA 262 \\D matches everything but ascii digits",
"schema": {
"type": "string",
"pattern": "^\\D$"
},
"tests": [
{
"description": "ASCII zero does not match",
"data": "0",
"valid": false
},
{
"description": "NKO DIGIT ZERO matches (unlike e.g. Python)",
"data": "߀",
"valid": true
},
{
"description": "NKO DIGIT ZERO (as \\u escape) matches",
"data": "\\u07c0",
"valid": true
}
]
},
{
"description": "ECMA 262 \\w matches ascii letters only",
"schema": {
"type": "string",
"pattern": "^\\w$"
},
"tests": [
{
"description": "ASCII 'a' matches",
"data": "a",
"valid": true
},
{
"description": "latin-1 e-acute does not match (unlike e.g. Python)",
"data": "é",
"valid": false
}
]
},
{
"description": "ECMA 262 \\w matches everything but ascii letters",
"schema": {
"type": "string",
"pattern": "^\\W$"
},
"tests": [
{
"description": "ASCII 'a' does not match",
"data": "a",
"valid": false
},
{
"description": "latin-1 e-acute matches (unlike e.g. Python)",
"data": "é",
"valid": true
}
]
},
{
"description": "ECMA 262 \\s matches ascii whitespace only",
"schema": {
"type": "string",
"pattern": "^\\s$"
},
"tests": [
{
"description": "ASCII space matches",
"data": " ",
"valid": true
},
{
"description": "latin-1 non-breaking-space does not match (unlike e.g. Python)",
"data": "\\u00a0",
"valid": false
}
]
},
{
"description": "ECMA 262 \\S matches everything but ascii whitespace",
"schema": {
"type": "string",
"pattern": "^\\S$"
},
"tests": [
{
"description": "ASCII space does not match",
"data": " ",
"valid": false
},
{
"description": "latin-1 non-breaking-space matches (unlike e.g. Python)",
"data": "\\u00a0",
"valid": true
}
]
}
]
Loading