github.com/kaptinlin/jsonschema@v0.4.6/testdata/JSON-Schema-Test-Suite/tests/draft6/optional/ecmascript-regex.json (about)

     1  [
     2      {
     3          "description": "ECMA 262 regex $ does not match trailing newline",
     4          "schema": {
     5              "type": "string",
     6              "pattern": "^abc$"
     7          },
     8          "tests": [
     9              {
    10                  "description": "matches in Python, but not in ECMA 262",
    11                  "data": "abc\\n",
    12                  "valid": false
    13              },
    14              {
    15                  "description": "matches",
    16                  "data": "abc",
    17                  "valid": true
    18              }
    19          ]
    20      },
    21      {
    22          "description": "ECMA 262 regex converts \\t to horizontal tab",
    23          "schema": {
    24              "type": "string",
    25              "pattern": "^\\t$"
    26          },
    27          "tests": [
    28              {
    29                  "description": "does not match",
    30                  "data": "\\t",
    31                  "valid": false
    32              },
    33              {
    34                  "description": "matches",
    35                  "data": "\u0009",
    36                  "valid": true
    37              }
    38          ]
    39      },
    40      {
    41          "description": "ECMA 262 regex escapes control codes with \\c and upper letter",
    42          "schema": {
    43              "type": "string",
    44              "pattern": "^\\cC$"
    45          },
    46          "tests": [
    47              {
    48                  "description": "does not match",
    49                  "data": "\\cC",
    50                  "valid": false
    51              },
    52              {
    53                  "description": "matches",
    54                  "data": "\u0003",
    55                  "valid": true
    56              }
    57          ]
    58      },
    59      {
    60          "description": "ECMA 262 regex escapes control codes with \\c and lower letter",
    61          "schema": {
    62              "type": "string",
    63              "pattern": "^\\cc$"
    64          },
    65          "tests": [
    66              {
    67                  "description": "does not match",
    68                  "data": "\\cc",
    69                  "valid": false
    70              },
    71              {
    72                  "description": "matches",
    73                  "data": "\u0003",
    74                  "valid": true
    75              }
    76          ]
    77      },
    78      {
    79          "description": "ECMA 262 \\d matches ascii digits only",
    80          "schema": {
    81              "type": "string",
    82              "pattern": "^\\d$"
    83          },
    84          "tests": [
    85              {
    86                  "description": "ASCII zero matches",
    87                  "data": "0",
    88                  "valid": true
    89              },
    90              {
    91                  "description": "NKO DIGIT ZERO does not match (unlike e.g. Python)",
    92                  "data": "߀",
    93                  "valid": false
    94              },
    95              {
    96                  "description": "NKO DIGIT ZERO (as \\u escape) does not match",
    97                  "data": "\u07c0",
    98                  "valid": false
    99              }
   100          ]
   101      },
   102      {
   103          "description": "ECMA 262 \\D matches everything but ascii digits",
   104          "schema": {
   105              "type": "string",
   106              "pattern": "^\\D$"
   107          },
   108          "tests": [
   109              {
   110                  "description": "ASCII zero does not match",
   111                  "data": "0",
   112                  "valid": false
   113              },
   114              {
   115                  "description": "NKO DIGIT ZERO matches (unlike e.g. Python)",
   116                  "data": "߀",
   117                  "valid": true
   118              },
   119              {
   120                  "description": "NKO DIGIT ZERO (as \\u escape) matches",
   121                  "data": "\u07c0",
   122                  "valid": true
   123              }
   124          ]
   125      },
   126      {
   127          "description": "ECMA 262 \\w matches ascii letters only",
   128          "schema": {
   129              "type": "string",
   130              "pattern": "^\\w$"
   131          },
   132          "tests": [
   133              {
   134                  "description": "ASCII 'a' matches",
   135                  "data": "a",
   136                  "valid": true
   137              },
   138              {
   139                  "description": "latin-1 e-acute does not match (unlike e.g. Python)",
   140                  "data": "é",
   141                  "valid": false
   142              }
   143          ]
   144      },
   145      {
   146          "description": "ECMA 262 \\W matches everything but ascii letters",
   147          "schema": {
   148              "type": "string",
   149              "pattern": "^\\W$"
   150          },
   151          "tests": [
   152              {
   153                  "description": "ASCII 'a' does not match",
   154                  "data": "a",
   155                  "valid": false
   156              },
   157              {
   158                  "description": "latin-1 e-acute matches (unlike e.g. Python)",
   159                  "data": "é",
   160                  "valid": true
   161              }
   162          ]
   163      },
   164      {
   165          "description": "ECMA 262 \\s matches whitespace",
   166          "schema": {
   167              "type": "string",
   168              "pattern": "^\\s$"
   169          },
   170          "tests": [
   171              {
   172                  "description": "ASCII space matches",
   173                  "data": " ",
   174                  "valid": true
   175              },
   176              {
   177                  "description": "Character tabulation matches",
   178                  "data": "\t",
   179                  "valid": true
   180              },
   181              {
   182                  "description": "Line tabulation matches",
   183                  "data": "\u000b",
   184                  "valid": true
   185              },
   186              {
   187                  "description": "Form feed matches",
   188                  "data": "\u000c",
   189                  "valid": true
   190              },
   191              {
   192                  "description": "latin-1 non-breaking-space matches",
   193                  "data": "\u00a0",
   194                  "valid": true
   195              },
   196              {
   197                  "description": "zero-width whitespace matches",
   198                  "data": "\ufeff",
   199                  "valid": true
   200              },
   201              {
   202                  "description": "line feed matches (line terminator)",
   203                  "data": "\u000a",
   204                  "valid": true
   205              },
   206              {
   207                  "description": "paragraph separator matches (line terminator)",
   208                  "data": "\u2029",
   209                  "valid": true
   210              },
   211              {
   212                  "description": "EM SPACE matches (Space_Separator)",
   213                  "data": "\u2003",
   214                  "valid": true
   215              },
   216              {
   217                  "description": "Non-whitespace control does not match",
   218                  "data": "\u0001",
   219                  "valid": false
   220              },
   221              {
   222                  "description": "Non-whitespace does not match",
   223                  "data": "\u2013",
   224                  "valid": false
   225              }
   226          ]
   227      },
   228      {
   229          "description": "ECMA 262 \\S matches everything but whitespace",
   230          "schema": {
   231              "type": "string",
   232              "pattern": "^\\S$"
   233          },
   234          "tests": [
   235              {
   236                  "description": "ASCII space does not match",
   237                  "data": " ",
   238                  "valid": false
   239              },
   240              {
   241                  "description": "Character tabulation does not match",
   242                  "data": "\t",
   243                  "valid": false
   244              },
   245              {
   246                  "description": "Line tabulation does not match",
   247                  "data": "\u000b",
   248                  "valid": false
   249              },
   250              {
   251                  "description": "Form feed does not match",
   252                  "data": "\u000c",
   253                  "valid": false
   254              },
   255              {
   256                  "description": "latin-1 non-breaking-space does not match",
   257                  "data": "\u00a0",
   258                  "valid": false
   259              },
   260              {
   261                  "description": "zero-width whitespace does not match",
   262                  "data": "\ufeff",
   263                  "valid": false
   264              },
   265              {
   266                  "description": "line feed does not match (line terminator)",
   267                  "data": "\u000a",
   268                  "valid": false
   269              },
   270              {
   271                  "description": "paragraph separator does not match (line terminator)",
   272                  "data": "\u2029",
   273                  "valid": false
   274              },
   275              {
   276                  "description": "EM SPACE does not match (Space_Separator)",
   277                  "data": "\u2003",
   278                  "valid": false
   279              },
   280              {
   281                  "description": "Non-whitespace control matches",
   282                  "data": "\u0001",
   283                  "valid": true
   284              },
   285              {
   286                  "description": "Non-whitespace matches",
   287                  "data": "\u2013",
   288                  "valid": true
   289              }
   290          ]
   291      },
   292      {
   293          "description": "patterns always use unicode semantics with pattern",
   294          "schema": { "pattern": "\\p{Letter}cole" },
   295          "tests": [
   296              {
   297                  "description": "ascii character in json string",
   298                  "data": "Les hivers de mon enfance etaient des saisons longues, longues. Nous vivions en trois lieux: l'ecole, l'eglise et la patinoire; mais la vraie vie etait sur la patinoire.",
   299                  "valid": true
   300              },
   301              {
   302                  "description": "literal unicode character in json string",
   303                  "data": "Les hivers de mon enfance étaient des saisons longues, longues. Nous vivions en trois lieux: l'école, l'église et la patinoire; mais la vraie vie était sur la patinoire.",
   304                  "valid": true
   305              },
   306              {
   307                  "description": "unicode character in hex format in string",
   308                  "data": "Les hivers de mon enfance étaient des saisons longues, longues. Nous vivions en trois lieux: l'\u00e9cole, l'église et la patinoire; mais la vraie vie était sur la patinoire.",
   309                  "valid": true
   310              },
   311              {
   312                  "description": "unicode matching is case-sensitive",
   313                  "data": "LES HIVERS DE MON ENFANCE ÉTAIENT DES SAISONS LONGUES, LONGUES. NOUS VIVIONS EN TROIS LIEUX: L'ÉCOLE, L'ÉGLISE ET LA PATINOIRE; MAIS LA VRAIE VIE ÉTAIT SUR LA PATINOIRE.",
   314                  "valid": false
   315              }
   316          ]
   317      },
   318      {
   319          "description": "\\w in patterns matches [A-Za-z0-9_], not unicode letters",
   320          "schema": { "pattern": "\\wcole" },
   321          "tests": [
   322              {
   323                  "description": "ascii character in json string",
   324                  "data": "Les hivers de mon enfance etaient des saisons longues, longues. Nous vivions en trois lieux: l'ecole, l'eglise et la patinoire; mais la vraie vie etait sur la patinoire.",
   325                  "valid": true
   326              },
   327              {
   328                  "description": "literal unicode character in json string",
   329                  "data": "Les hivers de mon enfance étaient des saisons longues, longues. Nous vivions en trois lieux: l'école, l'église et la patinoire; mais la vraie vie était sur la patinoire.",
   330                  "valid": false
   331              },
   332              {
   333                  "description": "unicode character in hex format in string",
   334                  "data": "Les hivers de mon enfance étaient des saisons longues, longues. Nous vivions en trois lieux: l'\u00e9cole, l'église et la patinoire; mais la vraie vie était sur la patinoire.",
   335                  "valid": false
   336              },
   337              {
   338                  "description": "unicode matching is case-sensitive",
   339                  "data": "LES HIVERS DE MON ENFANCE ÉTAIENT DES SAISONS LONGUES, LONGUES. NOUS VIVIONS EN TROIS LIEUX: L'ÉCOLE, L'ÉGLISE ET LA PATINOIRE; MAIS LA VRAIE VIE ÉTAIT SUR LA PATINOIRE.",
   340                  "valid": false
   341              }
   342          ]
   343      },
   344      {
   345          "description": "pattern with ASCII ranges",
   346          "schema": { "pattern": "[a-z]cole" },
   347          "tests": [
   348              {
   349                  "description": "literal unicode character in json string",
   350                  "data": "Les hivers de mon enfance étaient des saisons longues, longues. Nous vivions en trois lieux: l'école, l'église et la patinoire; mais la vraie vie était sur la patinoire.",
   351                  "valid": false
   352              },
   353              {
   354                  "description": "unicode character in hex format in string",
   355                  "data": "Les hivers de mon enfance étaient des saisons longues, longues. Nous vivions en trois lieux: l'\u00e9cole, l'église et la patinoire; mais la vraie vie était sur la patinoire.",
   356                  "valid": false
   357              },
   358              {
   359                  "description": "ascii characters match",
   360                  "data": "Les hivers de mon enfance etaient des saisons longues, longues. Nous vivions en trois lieux: l'ecole, l'eglise et la patinoire; mais la vraie vie etait sur la patinoire.",
   361                  "valid": true
   362              }
   363          ]
   364      },
   365      {
   366          "description": "\\d in pattern matches [0-9], not unicode digits",
   367          "schema": { "pattern": "^\\d+$" },
   368          "tests": [
   369              {
   370                  "description": "ascii digits",
   371                  "data": "42",
   372                  "valid": true
   373              },
   374              {
   375                  "description": "ascii non-digits",
   376                  "data": "-%#",
   377                  "valid": false
   378              },
   379              {
   380                  "description": "non-ascii digits (BENGALI DIGIT FOUR, BENGALI DIGIT TWO)",
   381                  "data": "৪২",
   382                  "valid": false
   383              }
   384          ]
   385      },
   386      {
   387          "description": "pattern with non-ASCII digits",
   388          "schema": { "pattern": "^\\p{digit}+$" },
   389          "tests": [
   390              {
   391                  "description": "ascii digits",
   392                  "data": "42",
   393                  "valid": true
   394              },
   395              {
   396                  "description": "ascii non-digits",
   397                  "data": "-%#",
   398                  "valid": false
   399              },
   400              {
   401                  "description": "non-ascii digits (BENGALI DIGIT FOUR, BENGALI DIGIT TWO)",
   402                  "data": "৪২",
   403                  "valid": true
   404              }
   405          ]
   406      },
   407      {
   408          "description": "patterns always use unicode semantics with patternProperties",
   409          "schema": {
   410              "type": "object",
   411              "patternProperties": {
   412                  "\\p{Letter}cole": true
   413              },
   414              "additionalProperties": false
   415          },
   416          "tests": [
   417              {
   418                  "description": "ascii character in json string",
   419                  "data": { "l'ecole": "pas de vraie vie" },
   420                  "valid": true
   421              },
   422              {
   423                  "description": "literal unicode character in json string",
   424                  "data": { "l'école": "pas de vraie vie" },
   425                  "valid": true
   426              },
   427              {
   428                  "description": "unicode character in hex format in string",
   429                  "data": { "l'\u00e9cole": "pas de vraie vie" },
   430                  "valid": true
   431              },
   432              {
   433                  "description": "unicode matching is case-sensitive",
   434                  "data": { "L'ÉCOLE": "PAS DE VRAIE VIE" },
   435                  "valid": false
   436              }
   437          ]
   438      },
   439      {
   440          "description": "\\w in patternProperties matches [A-Za-z0-9_], not unicode letters",
   441          "schema": {
   442              "type": "object",
   443              "patternProperties": {
   444                  "\\wcole": true
   445              },
   446              "additionalProperties": false
   447          },
   448          "tests": [
   449              {
   450                  "description": "ascii character in json string",
   451                  "data": { "l'ecole": "pas de vraie vie" },
   452                  "valid": true
   453              },
   454              {
   455                  "description": "literal unicode character in json string",
   456                  "data": { "l'école": "pas de vraie vie" },
   457                  "valid": false
   458              },
   459              {
   460                  "description": "unicode character in hex format in string",
   461                  "data": { "l'\u00e9cole": "pas de vraie vie" },
   462                  "valid": false
   463              },
   464              {
   465                  "description": "unicode matching is case-sensitive",
   466                  "data": { "L'ÉCOLE": "PAS DE VRAIE VIE" },
   467                  "valid": false
   468              }
   469          ]
   470      },
   471      {
   472          "description": "patternProperties with ASCII ranges",
   473          "schema": {
   474              "type": "object",
   475              "patternProperties": {
   476                  "[a-z]cole": true
   477              },
   478              "additionalProperties": false
   479          },
   480          "tests": [
   481              {
   482                  "description": "literal unicode character in json string",
   483                  "data": { "l'école": "pas de vraie vie" },
   484                  "valid": false
   485              },
   486              {
   487                  "description": "unicode character in hex format in string",
   488                  "data": { "l'\u00e9cole": "pas de vraie vie" },
   489                  "valid": false
   490              },
   491              {
   492                  "description": "ascii characters match",
   493                  "data": { "l'ecole": "pas de vraie vie" },
   494                  "valid": true
   495              }
   496          ]
   497      },
   498      {
   499          "description": "\\d in patternProperties matches [0-9], not unicode digits",
   500          "schema": {
   501              "type": "object",
   502              "patternProperties": {
   503                  "^\\d+$": true
   504              },
   505              "additionalProperties": false
   506          },
   507          "tests": [
   508              {
   509                  "description": "ascii digits",
   510                  "data": { "42": "life, the universe, and everything" },
   511                  "valid": true
   512              },
   513              {
   514                  "description": "ascii non-digits",
   515                  "data": { "-%#": "spending the year dead for tax reasons" },
   516                  "valid": false
   517              },
   518              {
   519                  "description": "non-ascii digits (BENGALI DIGIT FOUR, BENGALI DIGIT TWO)",
   520                  "data": { "৪২": "khajit has wares if you have coin" },
   521                  "valid": false
   522              }
   523          ]
   524      },
   525      {
   526          "description": "patternProperties with non-ASCII digits",
   527          "schema": {
   528              "type": "object",
   529              "patternProperties": {
   530                  "^\\p{digit}+$": true
   531              },
   532              "additionalProperties": false
   533          },
   534          "tests": [
   535              {
   536                  "description": "ascii digits",
   537                  "data": { "42": "life, the universe, and everything" },
   538                  "valid": true
   539              },
   540              {
   541                  "description": "ascii non-digits",
   542                  "data": { "-%#": "spending the year dead for tax reasons" },
   543                  "valid": false
   544              },
   545              {
   546                  "description": "non-ascii digits (BENGALI DIGIT FOUR, BENGALI DIGIT TWO)",
   547                  "data": { "৪২": "khajit has wares if you have coin" },
   548                  "valid": true
   549              }
   550          ]
   551      }
   552  ]