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
ea9a2f4c
Commit
ea9a2f4c
authored
13 years ago
by
Mark Miller
Browse files
Options
Downloads
Patches
Plain Diff
Adjusted converter
parent
660a2a08
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tools/converter/convert.js
+44
-39
44 additions, 39 deletions
tools/converter/convert.js
with
44 additions
and
39 deletions
tools/converter/convert.js
+
44
−
39
View file @
ea9a2f4c
...
...
@@ -70,7 +70,6 @@
var
testEnvelopePattern
=
regExp
(
'
^(
'
,
headerPattern
,
'
)(?:
'
,
captureCommentPattern
,
'
)?(?:
'
,
captureStrictPattern
,
'
)?(
'
,
anyPattern
,
'
)$
'
);
...
...
@@ -146,10 +145,15 @@
envelope
.
testRecord
[
propName
]
=
propVal
;
});
}
if
(
envelopeMatch
[
3
])
{
envelope
.
rest
=
envelopeMatch
[
3
];
// Do not trim
var
strictMatch
=
captureStrictPattern
.
exec
(
envelope
.
rest
);
if
(
strictMatch
)
{
envelope
.
testRecord
.
strictOnly
=
''
;
// Note: does not remove or alter the "use strict"; directive
// itself. We also make no use of the captured string so TODO:
// stop capturing it.
}
envelope
.
rest
=
envelopeMatch
[
4
];
// Do not trim
var
registerMatch
=
registerPattern
.
exec
(
envelope
.
rest
);
if
(
registerMatch
)
{
...
...
@@ -194,17 +198,17 @@
var
name
=
trim
(
cfnbMatch
[
1
]);
var
body
=
trim
(
cfnbMatch
[
2
]);
//
L
ook for special cases
var
cebMatch
=
captureExprBodyPattern
.
exec
(
body
);
if
(
cebMatch
)
{
return
'
assertTruthy(
'
+
trim
(
cebMatch
[
1
])
+
'
);
'
;
}
var
cpMatch
=
capturePredicatePattern
.
exec
(
body
);
if
(
cpMatch
)
{
return
'
assertTruthy(
'
+
trim
(
cpMatch
[
1
])
+
'
);
'
;
}
//
Uncomment to l
ook for special cases
//
//
var cebMatch = captureExprBodyPattern.exec(body);
//
if (cebMatch) {
//
return 'assertTruthy(' + trim(cebMatch[1]) + ');';
//
}
//
//
var cpMatch = capturePredicatePattern.exec(body);
//
if (cpMatch) {
//
return 'assertTruthy(' + trim(cpMatch[1]) + ');';
//
}
// General case
...
...
@@ -212,21 +216,29 @@
'
runTestCase(
'
+
name
+
'
);
'
;
}
/**
* If record[toName] is absent or empty and record[fromName] is
* present, whether empty or not, then set record[toName] to the
* current value of record[fromName] and delete record[fromName]
*/
function
transferProp
(
record
,
fromName
,
toName
)
{
// Note that record[toName] is falsy whether toName is absent or
// empty
if
(
!
record
[
toName
]
&&
fromName
in
record
)
{
record
[
toName
]
=
record
[
fromName
];
delete
record
[
fromName
];
}
}
/**
* Given an ietestcenter style test, this <b>evaluates</b> the
* registration expression in order to gather the test record.
*/
function
gatherOne
(
envelope
,
name
)
{
if
(
envelope
.
testRecord
)
{
var
propNames
=
keys
(
envelope
.
testRecord
);
if
(
propNames
.
length
>=
1
)
{
// This need not be an error. It's just here so we notice the
// first time it happens. This would happen if an
// ietestcenter style test also had a comment with "@"
// property definitions.
throw
new
Error
(
'
unexpected in
'
+
name
+
'
:
'
+
propNames
);
}
}
var
testRecord
=
envelope
.
testRecord
;
var
testRecords
=
[];
// Evaluating!!!!
...
...
@@ -245,7 +257,14 @@
// generators.
throw
new
Error
(
'
not singleton:
'
+
name
);
}
var
testRecord
=
testRecords
[
0
];
var
gatheredTestRecord
=
testRecords
[
0
];
forEach
(
keys
(
gatheredTestRecord
),
function
(
propName
)
{
if
(
propName
in
testRecord
&&
testRecord
[
propName
]
!==
gatheredTestRecord
[
propName
])
{
throw
new
Error
(
'
Conflicting "
'
+
propName
+
'
" in
'
+
name
);
}
testRecord
[
propName
]
=
gatheredTestRecord
[
propName
];
});
if
(
typeof
testRecord
.
test
===
'
function
'
)
{
testRecord
.
test
=
envelope
.
rest
+
'
\n
'
+
...
...
@@ -261,20 +280,6 @@
return
testRecord
;
}
/**
* If record[toName] is absent or empty and record[fromName] is
* present, whether empty or not, then set record[toName] to the
* current value of record[fromName] and delete record[fromName]
*/
function
transferProp
(
record
,
fromName
,
toName
)
{
// Note that record[toName] is falsy whether toName is absent or
// empty
if
(
!
record
[
toName
]
&&
fromName
in
record
)
{
record
[
toName
]
=
record
[
fromName
];
delete
record
[
fromName
];
}
}
/**
* Normalizes the properties of testRecord to be the canonical
* test262 style properties, that will be assumed by the new test
...
...
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