...

Text file src/github.com/qri-io/jsonschema/testdata/draft7/optional/ecmascript-regex.json

Documentation: github.com/qri-io/jsonschema/testdata/draft7/optional

     1[
     2    {
     3        "description": "ECMA 262 regex non-compliance",
     4        "schema": { "format": "regex" },
     5        "tests": [
     6            {
     7                "description": "ECMA 262 has no support for \\Z anchor from .NET",
     8                "data": "^\\S(|(.|\\n)*\\S)\\Z",
     9                "valid": false
    10            }
    11        ]
    12    },
    13    {
    14        "description": "ECMA 262 regex $ does not match trailing newline",
    15        "schema": {
    16            "type": "string",
    17            "pattern": "^abc$"
    18        },
    19        "tests": [
    20            {
    21                "description": "matches in Python, but should not in jsonschema",
    22                "data": "abc\n",
    23                "valid": false
    24            },
    25            {
    26                "description": "should match",
    27                "data": "abc",
    28                "valid": true
    29            }
    30        ]
    31    },
    32    {
    33        "description": "ECMA 262 regex converts \\t to horizontal tab",
    34        "schema": {
    35            "type": "string",
    36            "pattern": "^\\t$"
    37        },
    38        "tests": [
    39            {
    40                "description": "does not match",
    41                "data": "\\t",
    42                "valid": false
    43            },
    44            {
    45                "description": "matches",
    46                "data": "\u0009",
    47                "valid": true
    48            }
    49        ]
    50    },
    51    {
    52        "description": "ECMA 262 regex escapes control codes with \\c and upper letter",
    53        "schema": {
    54            "type": "string",
    55            "pattern": "^\\cC$"
    56        },
    57        "tests": [
    58            {
    59                "description": "does not match",
    60                "data": "\\cC",
    61                "valid": false
    62            },
    63            {
    64                "description": "matches",
    65                "data": "\u0003",
    66                "valid": true
    67            }
    68        ]
    69    },
    70    {
    71        "description": "ECMA 262 regex escapes control codes with \\c and lower letter",
    72        "schema": {
    73            "type": "string",
    74            "pattern": "^\\cc$"
    75        },
    76        "tests": [
    77            {
    78                "description": "does not match",
    79                "data": "\\cc",
    80                "valid": false
    81            },
    82            {
    83                "description": "matches",
    84                "data": "\u0003",
    85                "valid": true
    86            }
    87        ]
    88    },
    89    {
    90        "description": "ECMA 262 \\d matches ascii digits only",
    91        "schema": {
    92            "type": "string",
    93            "pattern": "^\\d$"
    94        },
    95        "tests": [
    96            {
    97                "description": "ASCII zero matches",
    98                "data": "0",
    99                "valid": true
   100            },
   101            {
   102                "description": "NKO DIGIT ZERO does not match (unlike e.g. Python)",
   103                "data": "߀",
   104                "valid": false
   105            },
   106            {
   107                "description": "NKO DIGIT ZERO (as \\u escape) does not match",
   108                "data": "\u07c0",
   109                "valid": false
   110            }
   111        ]
   112    },
   113    {
   114        "description": "ECMA 262 \\D matches everything but ascii digits",
   115        "schema": {
   116            "type": "string",
   117            "pattern": "^\\D$"
   118        },
   119        "tests": [
   120            {
   121                "description": "ASCII zero does not match",
   122                "data": "0",
   123                "valid": false
   124            },
   125            {
   126                "description": "NKO DIGIT ZERO matches (unlike e.g. Python)",
   127                "data": "߀",
   128                "valid": true
   129            },
   130            {
   131                "description": "NKO DIGIT ZERO (as \\u escape) matches",
   132                "data": "\u07c0",
   133                "valid": true
   134            }
   135        ]
   136    },
   137    {
   138        "description": "ECMA 262 \\w matches ascii letters only",
   139        "schema": {
   140            "type": "string",
   141            "pattern": "^\\w$"
   142        },
   143        "tests": [
   144            {
   145                "description": "ASCII 'a' matches",
   146                "data": "a",
   147                "valid": true
   148            },
   149            {
   150                "description": "latin-1 e-acute does not match (unlike e.g. Python)",
   151                "data": "é",
   152                "valid": false
   153            }
   154        ]
   155    },
   156    {
   157        "description": "ECMA 262 \\w matches everything but ascii letters",
   158        "schema": {
   159            "type": "string",
   160            "pattern": "^\\W$"
   161        },
   162        "tests": [
   163            {
   164                "description": "ASCII 'a' does not match",
   165                "data": "a",
   166                "valid": false
   167            },
   168            {
   169                "description": "latin-1 e-acute matches (unlike e.g. Python)",
   170                "data": "é",
   171                "valid": true
   172            }
   173        ]
   174    },
   175    {
   176        "description": "ECMA 262 \\s matches ascii whitespace only",
   177        "schema": {
   178            "type": "string",
   179            "pattern": "^\\s$"
   180        },
   181        "tests": [
   182            {
   183                "description": "ASCII space matches",
   184                "data": " ",
   185                "valid": true
   186            },
   187            {
   188                "description": "latin-1 non-breaking-space does not match (unlike e.g. Python)",
   189                "data": "\u00a0",
   190                "valid": false
   191            }
   192        ]
   193    },
   194    {
   195        "description": "ECMA 262 \\S matches everything but ascii whitespace",
   196        "schema": {
   197            "type": "string",
   198            "pattern": "^\\S$"
   199        },
   200        "tests": [
   201            {
   202                "description": "ASCII space does not match",
   203                "data": " ",
   204                "valid": false
   205            },
   206            {
   207                "description": "latin-1 non-breaking-space matches (unlike e.g. Python)",
   208                "data": "\u00a0",
   209                "valid": true
   210            }
   211        ]
   212    }
   213]

View as plain text