Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
test262
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
pmaksimo
test262
Commits
ce217fff
Commit
ce217fff
authored
7 years ago
by
Daniel Ehrenberg
Committed by
Rick Waldron
7 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Improve invalid \c escape tests
parent
2086f66c
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
test/annexB/built-ins/RegExp/RegExp-control-escape-russian-letter.js
+46
-11
46 additions, 11 deletions
.../built-ins/RegExp/RegExp-control-escape-russian-letter.js
with
46 additions
and
11 deletions
test/annexB/built-ins/RegExp/RegExp-control-escape-russian-letter.js
+
46
−
11
View file @
ce217fff
...
...
@@ -5,19 +5,54 @@
info: "CharacterEscape :: c ControlLetter"
es5id: 15.10.2.10_A2.1_T3
es6id: B.1.4
description: "ControlLetter :: RUSSIAN ALPHABET is incorrect"
description: >
"ControlLetter :: RUSSIAN ALPHABET is incorrect"
Instead, fall back to semantics to match literal "\\c"
---*/
//CHECK#0410-042F
for
(
var
alpha
=
0x0410
;
alpha
<=
0x042F
;
alpha
++
)
{
var
str
=
String
.
fromCharCode
(
alpha
%
32
);
var
arr
=
(
new
RegExp
(
"
\\
c
"
+
String
.
fromCharCode
(
alpha
))).
exec
(
str
);
assert
.
sameValue
(
arr
,
null
,
'
RUSSIAN CAPITAL ALPHABET:
'
+
alpha
);
function
*
invalidControls
()
{
// Check upper case Cyrillic
for
(
var
alpha
=
0x0410
;
alpha
<=
0x042F
;
alpha
++
)
{
yield
String
.
fromCharCode
(
alpha
);
}
// Check lower case Cyrillic
for
(
alpha
=
0x0430
;
alpha
<=
0x044F
;
alpha
++
)
{
yield
String
.
fromCharCode
(
alpha
);
}
// Check ASCII characters which are not in the extended range or syntax
// characters
for
(
alpha
=
0x00
;
alpha
<=
0x7F
;
alpha
++
)
{
let
letter
=
String
.
fromCharCode
(
alpha
);
if
(
!
letter
.
match
(
/
[
0-9A-Za-z_
\$
(|)
\[\]\/\\
^
]
/
))
{
yield
letter
;
}
}
// Check for end of string
yield
""
;
}
//CHECK#0430-044F
for
(
alpha
=
0x0430
;
alpha
<=
0x044F
;
alpha
++
)
{
str
=
String
.
fromCharCode
(
alpha
%
32
);
arr
=
(
new
RegExp
(
"
\\
c
"
+
String
.
fromCharCode
(
alpha
))).
exec
(
str
);
assert
.
sameValue
(
arr
,
null
,
'
russian small alphabet:
'
+
alpha
);
for
(
let
letter
of
invalidControls
())
{
var
source
=
"
\\
c
"
+
letter
;
var
re
=
new
RegExp
(
source
);
if
(
letter
.
length
>
0
)
{
var
char
=
letter
.
charCodeAt
(
0
);
var
str
=
String
.
fromCharCode
(
char
%
32
);
var
arr
=
re
.
exec
(
str
);
if
(
arr
!==
null
)
{
$ERROR
(
`Character
${
letter
}
unreasonably wrapped around as a control character`
);
}
}
arr
=
re
.
exec
(
source
.
substring
(
1
))
if
(
arr
!==
null
)
{
$ERROR
(
`invalid
\\
c escape matched c rather than
\\
c when followed by
${
letter
}
`
);
}
arr
=
re
.
exec
(
source
)
if
(
arr
===
null
)
{
$ERROR
(
`invalid
\\
c escape failed to match
\\
c when followed by
${
letter
}
`
);
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment