Skip to content
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

Add JSON ⊂ ECMAScript tests #1543

Closed
wants to merge 1 commit into from
Closed
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
4 changes: 4 additions & 0 deletions features.txt
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,10 @@ numeric-separator-literal
String.prototype.matchAll
Symbol.matchAll

# ECMAScript ⊃ JSON
# https://github.com/tc39/proposal-json-superset
json-superset

# Intl.Locale
# https://github.com/tc39/proposal-intl-locale
Intl.Locale
Expand Down
12 changes: 0 additions & 12 deletions test/language/line-terminators/S7.3_A2.3.js

This file was deleted.

12 changes: 12 additions & 0 deletions test/language/line-terminators/line-separator-string-literal.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// Copyright 2018 Mathias Bynens. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.

/*---
esid: sec-literals-string-literals
description: >
LINE SEPARATOR (U+2028) is allowed within string literals.
features: [json-superset]
---*/

eval("'foo\u2028bar\u2028baz\u2028qux'");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should go a bit beyond here. We don't need eval for these new tests, that's only legacy we don't need to import from the removed file.

At the same time, it's also a good opportunity to duplicate these tests with the literal cases using unescaped and escaped forms in each test file. I can work in a follow up if it's such a burn to add more here, let me know and I'd be glad to help.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I used eval to avoid having to put the raw U+2028 and U+2029 characters in the source code, which is hard to review and would be easy to accidentally break in the future. This approach seemed more maintainable.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

eval is annoying because it makes these tests not really consumable by parsers and other consumers which don't implement eval. (See #1356 etc.) I think it's worth having the literal character in the source.

'foo
bar
baz
qux';
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// Copyright 2018 Mathias Bynens. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.

/*---
esid: sec-literals-string-literals
description: >
PARAGRAPH SEPARATOR (U+2029) is allowed within string literals.
features: [json-superset]
---*/

eval("'foo\u2029bar\u2029baz\u2029qux'");
'foo
bar
baz
qux';