Skip to content
Snippets Groups Projects
Commit bd7c280e authored by André Bargull's avatar André Bargull
Browse files

Rename and consolidate tests in reserved-words directory

parent 053d63fd
No related branches found
No related tags found
No related merge requests found
Showing
with 285 additions and 0 deletions
......@@ -2,21 +2,29 @@
// This code is governed by the BSD license found in the LICENSE file.
/*---
es5id: 7.6.1-6-12
es5id: 7.6.1-2-1
description: >
Allow reserved words as property names by dot operator assignment,
accessed via indexing: const, export, import
Allow reserved words as property names by dot operator assignment.
---*/
var tokenCodes = {};
tokenCodes.const = 0;
tokenCodes.export = 1;
tokenCodes.import = 2;
var arr = [
'const',
'export',
'import'
];
for (var i = 0; i < arr.length; i++) {
assert.sameValue(tokenCodes[arr[i]], i, 'tokenCodes[arr[i]]');
}
var tokenCodes = {};
tokenCodes.null = 'null';
tokenCodes.true = 'true';
tokenCodes.false = 'false';
var arr = [
'null',
'true',
'false',
];
for (var i = 0; i < arr.length; ++i) {
var propertyName = arr[i];
assert(tokenCodes.hasOwnProperty(propertyName),
'Property "' + propertyName + '" found');
assert.sameValue(tokenCodes[propertyName], propertyName,
'Property "' + propertyName + '" has correct value');
}
......@@ -2,22 +2,29 @@
// This code is governed by the BSD license found in the LICENSE file.
/*---
es5id: 7.6.1-5-12
es5id: 7.6.1-1-1
description: >
Allow reserved words as property names at object initialization,
accessed via indexing: const, export, import
Allow reserved words as property names at object initialization.
---*/
var tokenCodes = {
const : 0,
export: 1,
import: 2
};
var arr = [
'const',
'export',
'import'
];
for (var i = 0; i < arr.length; i++) {
assert.sameValue(tokenCodes[arr[i]], i, 'tokenCodes[arr[i]]');
}
var tokenCodes = {
null: 'null',
true: 'true',
false: 'false',
};
var arr = [
'null',
'true',
'false',
];
for (var i = 0; i < arr.length; ++i) {
var propertyName = arr[i];
assert(tokenCodes.hasOwnProperty(propertyName),
'Property "' + propertyName + '" found');
assert.sameValue(tokenCodes[propertyName], propertyName,
'Property "' + propertyName + '" has correct value');
}
// Copyright (C) 2017 André Bargull. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-identifiers-static-semantics-early-errors
description: >
`false` is a reserved word and cannot be used as an identifier reference.
info: |
Identifier : IdentifierName but not ReservedWord
It is a Syntax Error if StringValue of IdentifierName is the same String
value as the StringValue of any ReservedWord except for yield.
negative:
phase: early
type: SyntaxError
---*/
f\u0061lse = 0;
// Copyright (C) 2017 André Bargull. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-identifiers-static-semantics-early-errors
description: >
`false` is a reserved word and cannot be used as an identifier reference.
info: |
Identifier : IdentifierName but not ReservedWord
It is a Syntax Error if StringValue of IdentifierName is the same String
value as the StringValue of any ReservedWord except for yield.
negative:
phase: early
type: SyntaxError
---*/
// It's tempting to write `false = 0`, but that'd be a test to validate `false`
// is not a valid simple assignment target, cf. tests in language/expressions/assignment.
// Also see: sec-semantics-static-semantics-isvalidsimpleassignmenttarget
({false});
// Copyright (C) 2017 André Bargull. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-identifiers-static-semantics-early-errors
description: >
`false` is a reserved word and cannot be used as an identifier reference.
info: |
Identifier : IdentifierName but not ReservedWord
It is a Syntax Error if StringValue of IdentifierName is the same String
value as the StringValue of any ReservedWord except for yield.
negative:
phase: early
type: SyntaxError
---*/
nul\u006c = 0;
// Copyright (C) 2017 André Bargull. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-identifiers-static-semantics-early-errors
description: >
`false` is a reserved word and cannot be used as an identifier reference.
info: |
Identifier : IdentifierName but not ReservedWord
It is a Syntax Error if StringValue of IdentifierName is the same String
value as the StringValue of any ReservedWord except for yield.
negative:
phase: early
type: SyntaxError
---*/
// It's tempting to write `null = 0`, but that'd be a test to validate `null`
// is not a valid simple assignment target, cf. tests in language/expressions/assignment.
// Also see: sec-semantics-static-semantics-isvalidsimpleassignmenttarget
({null});
// Copyright (C) 2017 André Bargull. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-identifiers-static-semantics-early-errors
description: >
`false` is a reserved word and cannot be used as an identifier reference.
info: |
Identifier : IdentifierName but not ReservedWord
It is a Syntax Error if StringValue of IdentifierName is the same String
value as the StringValue of any ReservedWord except for yield.
negative:
phase: early
type: SyntaxError
---*/
tru\u0065 = 0;
// Copyright (C) 2017 André Bargull. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-identifiers-static-semantics-early-errors
description: >
`false` is a reserved word and cannot be used as an identifier reference.
info: |
Identifier : IdentifierName but not ReservedWord
It is a Syntax Error if StringValue of IdentifierName is the same String
value as the StringValue of any ReservedWord except for yield.
negative:
phase: early
type: SyntaxError
---*/
// It's tempting to write `true = 0`, but that'd be a test to validate `true`
// is not a valid simple assignment target, cf. tests in language/expressions/assignment.
// Also see: sec-semantics-static-semantics-isvalidsimpleassignmenttarget
({true});
// Copyright (C) 2017 André Bargull. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-identifiers-static-semantics-early-errors
description: >
`false` is a reserved word and cannot be used as a label identifier.
info: |
Identifier : IdentifierName but not ReservedWord
It is a Syntax Error if StringValue of IdentifierName is the same String
value as the StringValue of any ReservedWord except for yield.
negative:
phase: early
type: SyntaxError
---*/
f\u0061lse: ;
// Copyright (C) 2017 André Bargull. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-identifiers-static-semantics-early-errors
description: >
`false` is a reserved word and cannot be used as a label identifier.
info: |
Identifier : IdentifierName but not ReservedWord
It is a Syntax Error if StringValue of IdentifierName is the same String
value as the StringValue of any ReservedWord except for yield.
negative:
phase: early
type: SyntaxError
---*/
false: ;
// Copyright (C) 2017 André Bargull. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-identifiers-static-semantics-early-errors
description: >
`false` is a reserved word and cannot be used as a label identifier.
info: |
Identifier : IdentifierName but not ReservedWord
It is a Syntax Error if StringValue of IdentifierName is the same String
value as the StringValue of any ReservedWord except for yield.
negative:
phase: early
type: SyntaxError
---*/
nul\u006c: ;
// Copyright (C) 2017 André Bargull. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-identifiers-static-semantics-early-errors
description: >
`false` is a reserved word and cannot be used as a label identifier.
info: |
Identifier : IdentifierName but not ReservedWord
It is a Syntax Error if StringValue of IdentifierName is the same String
value as the StringValue of any ReservedWord except for yield.
negative:
phase: early
type: SyntaxError
---*/
null: ;
// Copyright (C) 2017 André Bargull. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-identifiers-static-semantics-early-errors
description: >
`false` is a reserved word and cannot be used as a label identifier.
info: |
Identifier : IdentifierName but not ReservedWord
It is a Syntax Error if StringValue of IdentifierName is the same String
value as the StringValue of any ReservedWord except for yield.
negative:
phase: early
type: SyntaxError
---*/
tru\u0065: ;
// Copyright (C) 2017 André Bargull. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-identifiers-static-semantics-early-errors
description: >
`false` is a reserved word and cannot be used as a label identifier.
info: |
Identifier : IdentifierName but not ReservedWord
It is a Syntax Error if StringValue of IdentifierName is the same String
value as the StringValue of any ReservedWord except for yield.
negative:
phase: early
type: SyntaxError
---*/
true: ;
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment