mirror of https://github.com/tc39/test262.git
Introduce additional tests for ES6 templates
This commit is contained in:
parent
bd3d160ba1
commit
5ca7a58e75
|
@ -0,0 +1,42 @@
|
|||
// Copyright (C) Copyright 2015 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
es6id: 12.3.7
|
||||
description: Argument list evalution for call expresions
|
||||
info: >
|
||||
A tagged template is a function call where the arguments of the call are
|
||||
derived from a TemplateLiteral. The actual arguments include a template
|
||||
object and the values produced by evaluating the expressions embedded
|
||||
within the TemplateLiteral.
|
||||
---*/
|
||||
|
||||
var number = 5;
|
||||
var string = 'str';
|
||||
var object = {};
|
||||
function fn() { return 'result'; }
|
||||
var calls;
|
||||
|
||||
calls = 0;
|
||||
(function() {
|
||||
return function() {
|
||||
calls++;
|
||||
assert.sameValue(
|
||||
arguments.length, 1, 'NoSubstitutionTemplate arguments length'
|
||||
);
|
||||
};
|
||||
})()`NoSubstitutionTemplate`;
|
||||
assert.sameValue(calls, 1, 'NoSubstitutionTemplate function invocation');
|
||||
|
||||
calls = 0;
|
||||
(function() {
|
||||
return function(site, n, s, o, f, r) {
|
||||
calls++;
|
||||
assert.sameValue(n, number);
|
||||
assert.sameValue(s, string);
|
||||
assert.sameValue(o, object);
|
||||
assert.sameValue(f, fn);
|
||||
assert.sameValue(r, 'result');
|
||||
assert.sameValue(arguments.length, 6, 'TemplateHead arguments length');
|
||||
};
|
||||
})()`TemplateHead${number}TemplateSpans${string}${object}${fn}${fn()}`;
|
||||
assert.sameValue(calls, 1, 'TemplateHead function invocation');
|
|
@ -0,0 +1,21 @@
|
|||
// Copyright (C) Copyright 2015 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
es6id: 12.3.7
|
||||
description: Invocation context for call expressions
|
||||
info: >
|
||||
A tagged template is a function call where the arguments of the call are
|
||||
derived from a TemplateLiteral. The actual arguments include a template
|
||||
object and the values produced by evaluating the expressions embedded
|
||||
within the TemplateLiteral.
|
||||
---*/
|
||||
var context;
|
||||
var fn = function() {
|
||||
return function() {
|
||||
context = this;
|
||||
};
|
||||
};
|
||||
|
||||
fn`NoSubstitutionTemplate`;
|
||||
|
||||
assert.sameValue(context, undefined);
|
|
@ -8,4 +8,4 @@ description: >
|
|||
negative: SyntaxError
|
||||
---*/
|
||||
|
||||
(function() {})`\x`;
|
||||
`\x0`;
|
||||
|
|
|
@ -8,4 +8,4 @@ description: >
|
|||
negative: SyntaxError
|
||||
---*/
|
||||
|
||||
(function() {})`\00`;
|
||||
`\00`;
|
||||
|
|
|
@ -8,4 +8,4 @@ description: >
|
|||
negative: SyntaxError
|
||||
---*/
|
||||
|
||||
(function() {})`\u`;
|
||||
`\u0`;
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
// Copyright (C) Copyright 2015 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
es6id: 12.2.8.5
|
||||
description: Abrupt completion when evaluating expression of TemplateLiteral
|
||||
info: >
|
||||
TemplateLiteral : TemplateHead Expression TemplateSpans
|
||||
|
||||
1. Let head be the TV of TemplateHead as defined in 11.8.6.
|
||||
2. Let sub be the result of evaluating Expression.
|
||||
3. Let middle be ToString(sub).
|
||||
4. ReturnIfAbrupt(middle).
|
||||
---*/
|
||||
|
||||
assert.throws(Test262Error, function() {
|
||||
`${function() { throw new Test262Error(); }()}`;
|
||||
});
|
|
@ -22,3 +22,13 @@ assert.sameValue(
|
|||
assert.sameValue(
|
||||
`foo ${object.string} bar`, 'foo stringValue bar', 'string value property'
|
||||
);
|
||||
assert.sameValue(
|
||||
`foo ${object['string']} bar`,
|
||||
'foo stringValue bar',
|
||||
'string value property (single-quote string dereference)'
|
||||
);
|
||||
assert.sameValue(
|
||||
`foo ${object["string"]} bar`,
|
||||
'foo stringValue bar',
|
||||
'string value property (double-quote string dereference)'
|
||||
);
|
||||
|
|
|
@ -0,0 +1,23 @@
|
|||
// Copyright (C) Copyright 2015 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
es6id: 12.2.8.5
|
||||
description: Abrupt completion when converting expression value of TemplateLiteral
|
||||
info: >
|
||||
TemplateLiteral : TemplateHead Expression TemplateSpans
|
||||
|
||||
1. Let head be the TV of TemplateHead as defined in 11.8.6.
|
||||
2. Let sub be the result of evaluating Expression.
|
||||
3. Let middle be ToString(sub).
|
||||
4. ReturnIfAbrupt(middle).
|
||||
---*/
|
||||
|
||||
var obj = {
|
||||
toString: function() {
|
||||
throw new Test262Error();
|
||||
}
|
||||
};
|
||||
|
||||
assert.throws(Test262Error, function() {
|
||||
`${obj}`;
|
||||
});
|
|
@ -0,0 +1,19 @@
|
|||
// Copyright (C) Copyright 2015 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
es6id: 12.2.8.5
|
||||
description: Abrupt completion when evaluating expression of TemplateMiddleList
|
||||
info: >
|
||||
TemplateMiddleList : TemplateMiddleList TemplateMiddle Expression
|
||||
|
||||
1. Let rest be the result of evaluating TemplateMiddleList .
|
||||
2. ReturnIfAbrupt(rest).
|
||||
3. Let middle be the TV of TemplateMiddle as defined in 11.8.6.
|
||||
4. Let sub be the result of evaluating Expression.
|
||||
5. Let last be ToString(sub).
|
||||
6. ReturnIfAbrupt(last).
|
||||
---*/
|
||||
|
||||
assert.throws(Test262Error, function() {
|
||||
`${0}${1}${function() { throw new Test262Error(); }()}`;
|
||||
});
|
|
@ -0,0 +1,18 @@
|
|||
// Copyright (C) Copyright 2015 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
es6id: 12.2.8.5
|
||||
description: Function invocation in expression position of TemplateMiddleList
|
||||
info: >
|
||||
TemplateMiddleList : TemplateMiddleList TemplateMiddle Expression
|
||||
|
||||
1. Let rest be the result of evaluating TemplateMiddleList .
|
||||
2. ReturnIfAbrupt(rest).
|
||||
3. Let middle be the TV of TemplateMiddle as defined in 11.8.6.
|
||||
4. Let sub be the result of evaluating Expression.
|
||||
5. Let last be ToString(sub).
|
||||
---*/
|
||||
|
||||
function fn() { return 'result'; }
|
||||
|
||||
assert.sameValue(`${0} ${1} ${fn()}`, '0 1 result');
|
|
@ -0,0 +1,38 @@
|
|||
// Copyright (C) Copyright 2015 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
es6id: 12.2.8.5
|
||||
description: MemberExpression in expression position of TemplateMiddleList
|
||||
info: >
|
||||
TemplateMiddleList : TemplateMiddleList TemplateMiddle Expression
|
||||
|
||||
1. Let rest be the result of evaluating TemplateMiddleList .
|
||||
2. ReturnIfAbrupt(rest).
|
||||
3. Let middle be the TV of TemplateMiddle as defined in 11.8.6.
|
||||
4. Let sub be the result of evaluating Expression.
|
||||
5. Let last be ToString(sub).
|
||||
---*/
|
||||
|
||||
var object = {
|
||||
number: 5,
|
||||
string: 'stringValue'
|
||||
};
|
||||
|
||||
assert.sameValue(
|
||||
`${0} ${1} ${object.number} bar`, '0 1 5 bar', 'number value property'
|
||||
);
|
||||
assert.sameValue(
|
||||
`${0} ${1} ${object.string} bar`,
|
||||
'0 1 stringValue bar',
|
||||
'string value property'
|
||||
);
|
||||
assert.sameValue(
|
||||
`${0} ${1} ${object['string']} bar`,
|
||||
'0 1 stringValue bar',
|
||||
'string value property (single-quote string dereference)'
|
||||
);
|
||||
assert.sameValue(
|
||||
`${0} ${1} ${object["string"]} bar`,
|
||||
'0 1 stringValue bar',
|
||||
'string value property (double-quote string dereference)'
|
||||
);
|
|
@ -0,0 +1,19 @@
|
|||
// Copyright (C) Copyright 2015 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
es6id: 12.2.8.5
|
||||
description: Method invocation in expression position of TemplateMiddleList
|
||||
info: >
|
||||
TemplateMiddleList : TemplateMiddleList TemplateMiddle Expression
|
||||
|
||||
1. Let rest be the result of evaluating TemplateMiddleList .
|
||||
2. ReturnIfAbrupt(rest).
|
||||
3. Let middle be the TV of TemplateMiddle as defined in 11.8.6.
|
||||
4. Let sub be the result of evaluating Expression.
|
||||
5. Let last be ToString(sub).
|
||||
---*/
|
||||
var object = {
|
||||
fn: function() { return 'result'; }
|
||||
};
|
||||
|
||||
assert.sameValue(`${0} ${1} ${object.fn()} bar`, '0 1 result bar');
|
|
@ -0,0 +1,31 @@
|
|||
// Copyright (C) Copyright 2015 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
es6id: 12.2.8.5
|
||||
description: Object reference in expression position of TemplateMiddleList
|
||||
info: >
|
||||
TemplateMiddleList : TemplateMiddleList TemplateMiddle Expression
|
||||
|
||||
1. Let rest be the result of evaluating TemplateMiddleList .
|
||||
2. ReturnIfAbrupt(rest).
|
||||
3. Let middle be the TV of TemplateMiddle as defined in 11.8.6.
|
||||
4. Let sub be the result of evaluating Expression.
|
||||
5. Let last be ToString(sub).
|
||||
---*/
|
||||
|
||||
var plain = {};
|
||||
var custom = {
|
||||
toString: function() {
|
||||
return '"own" toString';
|
||||
}
|
||||
};
|
||||
|
||||
assert.sameValue(`${0} ${1} ${plain}`, '0 1 [object Object]');
|
||||
assert.sameValue(`${0} ${1} ${plain}`, '0 1 [object Object]');
|
||||
assert.sameValue(`${0} ${1} ${plain}2`, '0 1 [object Object]2');
|
||||
assert.sameValue(`${0} ${1} ${plain}2`, '0 1 [object Object]2');
|
||||
|
||||
assert.sameValue(`${0} ${1} ${custom}`, '0 1 "own" toString');
|
||||
assert.sameValue(`${0} ${1} ${custom}`, '0 1 "own" toString');
|
||||
assert.sameValue(`${0} ${1} ${custom}2`, '0 1 "own" toString2');
|
||||
assert.sameValue(`${0} ${1} ${custom}2`, '0 1 "own" toString2');
|
|
@ -0,0 +1,17 @@
|
|||
// Copyright (C) Copyright 2015 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
es6id: 12.2.8.5
|
||||
description: Primitive value in expression position of TemplateMiddleList
|
||||
info: >
|
||||
TemplateMiddleList : TemplateMiddleList TemplateMiddle Expression
|
||||
|
||||
1. Let rest be the result of evaluating TemplateMiddleList .
|
||||
2. ReturnIfAbrupt(rest).
|
||||
3. Let middle be the TV of TemplateMiddle as defined in 11.8.6.
|
||||
4. Let sub be the result of evaluating Expression.
|
||||
5. Let last be ToString(sub).
|
||||
---*/
|
||||
|
||||
assert.sameValue(`${0} ${1} ${5} bar`, '0 1 5 bar', 'number value');
|
||||
assert.sameValue(`${0} ${1} ${'string'} bar`, '0 1 string bar', 'string value');
|
|
@ -0,0 +1,16 @@
|
|||
// Copyright (C) Copyright 2015 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
es6id: 12.2.8.5
|
||||
description: Template literal in expression position of TemplateMiddleList
|
||||
info: >
|
||||
TemplateMiddleList : TemplateMiddleList TemplateMiddle Expression
|
||||
|
||||
1. Let rest be the result of evaluating TemplateMiddleList .
|
||||
2. ReturnIfAbrupt(rest).
|
||||
3. Let middle be the TV of TemplateMiddle as defined in 11.8.6.
|
||||
4. Let sub be the result of evaluating Expression.
|
||||
5. Let last be ToString(sub).
|
||||
---*/
|
||||
|
||||
assert.sameValue(`${0} ${1} ${`bar ${5} baz`} qux`, '0 1 bar 5 baz qux');
|
|
@ -0,0 +1,25 @@
|
|||
// Copyright (C) Copyright 2015 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
es6id: 12.2.8.5
|
||||
description: Abrupt completion when converting expression value of TemplateMiddleList
|
||||
info: >
|
||||
TemplateMiddleList : TemplateMiddleList TemplateMiddle Expression
|
||||
|
||||
1. Let rest be the result of evaluating TemplateMiddleList .
|
||||
2. ReturnIfAbrupt(rest).
|
||||
3. Let middle be the TV of TemplateMiddle as defined in 11.8.6.
|
||||
4. Let sub be the result of evaluating Expression.
|
||||
5. Let last be ToString(sub).
|
||||
6. ReturnIfAbrupt(last).
|
||||
---*/
|
||||
|
||||
var obj = {
|
||||
toString: function() {
|
||||
throw new Test262Error();
|
||||
}
|
||||
};
|
||||
|
||||
assert.throws(Test262Error, function() {
|
||||
`${0} ${1} ${obj}`;
|
||||
});
|
|
@ -0,0 +1,17 @@
|
|||
// Copyright (C) Copyright 2015 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
es6id: 12.2.8.5
|
||||
description: Abrupt completion when evaluating expression of TemplateMiddleList
|
||||
info: >
|
||||
TemplateMiddleList : TemplateMiddle Expression
|
||||
|
||||
1. Let head be the TV of TemplateMiddle as defined in 11.8.6.
|
||||
2. Let sub be the result of evaluating Expression.
|
||||
3. Let middle be ToString(sub).
|
||||
4. ReturnIfAbrupt(middle).
|
||||
---*/
|
||||
|
||||
assert.throws(Test262Error, function() {
|
||||
`${0}${function() { throw new Test262Error(); }()}`;
|
||||
});
|
|
@ -0,0 +1,16 @@
|
|||
// Copyright (C) Copyright 2015 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
es6id: 12.2.8.5
|
||||
description: Function invocation in expression position of TemplateMiddleList
|
||||
info: >
|
||||
TemplateMiddleList : TemplateMiddle Expression
|
||||
|
||||
1. Let head be the TV of TemplateMiddle as defined in 11.8.6.
|
||||
2. Let sub be the result of evaluating Expression.
|
||||
3. Let middle be ToString(sub).
|
||||
---*/
|
||||
|
||||
function fn() { return 'result'; }
|
||||
|
||||
assert.sameValue(`${0} ${fn()}`, '0 result');
|
|
@ -0,0 +1,35 @@
|
|||
// Copyright (C) Copyright 2015 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
es6id: 12.2.8.5
|
||||
description: MemberExpression in expression position of TemplateMiddleList
|
||||
info: >
|
||||
TemplateMiddleList : TemplateMiddle Expression
|
||||
|
||||
1. Let head be the TV of TemplateMiddle as defined in 11.8.6.
|
||||
2. Let sub be the result of evaluating Expression.
|
||||
3. Let middle be ToString(sub).
|
||||
4. ReturnIfAbrupt(middle).
|
||||
---*/
|
||||
|
||||
var object = {
|
||||
number: 5,
|
||||
string: 'stringValue'
|
||||
};
|
||||
|
||||
assert.sameValue(
|
||||
`${0} ${object.number} bar`, '0 5 bar', 'number value property'
|
||||
);
|
||||
assert.sameValue(
|
||||
`${0} ${object.string} bar`, '0 stringValue bar', 'string value property'
|
||||
);
|
||||
assert.sameValue(
|
||||
`${0} ${object['string']} bar`,
|
||||
'0 stringValue bar',
|
||||
'string value property (single-quote string dereference)'
|
||||
);
|
||||
assert.sameValue(
|
||||
`${0} ${object["string"]} bar`,
|
||||
'0 stringValue bar',
|
||||
'string value property (double-quote string dereference)'
|
||||
);
|
|
@ -0,0 +1,18 @@
|
|||
// Copyright (C) Copyright 2015 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
es6id: 12.2.8.5
|
||||
description: Method invocation in expression position of TemplateMiddleList
|
||||
info: >
|
||||
TemplateMiddleList : TemplateMiddle Expression
|
||||
|
||||
1. Let head be the TV of TemplateMiddle as defined in 11.8.6.
|
||||
2. Let sub be the result of evaluating Expression.
|
||||
3. Let middle be ToString(sub).
|
||||
4. ReturnIfAbrupt(middle).
|
||||
---*/
|
||||
var object = {
|
||||
fn: function() { return 'result'; }
|
||||
};
|
||||
|
||||
assert.sameValue(`${0} ${object.fn()} bar`, '0 result bar');
|
|
@ -0,0 +1,30 @@
|
|||
// Copyright (C) Copyright 2015 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
es6id: 12.2.8.5
|
||||
description: Object reference in expression position of TemplateMiddleList
|
||||
info: >
|
||||
TemplateMiddleList : TemplateMiddle Expression
|
||||
|
||||
1. Let head be the TV of TemplateMiddle as defined in 11.8.6.
|
||||
2. Let sub be the result of evaluating Expression.
|
||||
3. Let middle be ToString(sub).
|
||||
4. ReturnIfAbrupt(middle).
|
||||
---*/
|
||||
|
||||
var plain = {};
|
||||
var custom = {
|
||||
toString: function() {
|
||||
return '"own" toString';
|
||||
}
|
||||
};
|
||||
|
||||
assert.sameValue(`${0} ${plain}`, '0 [object Object]');
|
||||
assert.sameValue(`${0} ${plain}`, '0 [object Object]');
|
||||
assert.sameValue(`${0} ${plain}2`, '0 [object Object]2');
|
||||
assert.sameValue(`${0} ${plain}2`, '0 [object Object]2');
|
||||
|
||||
assert.sameValue(`${0} ${custom}`, '0 "own" toString');
|
||||
assert.sameValue(`${0} ${custom}`, '0 "own" toString');
|
||||
assert.sameValue(`${0} ${custom}2`, '0 "own" toString2');
|
||||
assert.sameValue(`${0} ${custom}2`, '0 "own" toString2');
|
|
@ -0,0 +1,15 @@
|
|||
// Copyright (C) Copyright 2015 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
es6id: 12.2.8.5
|
||||
description: Primitive value in expression position of TemplateMiddleList
|
||||
info: >
|
||||
TemplateMiddleList : TemplateMiddle Expression
|
||||
|
||||
1. Let head be the TV of TemplateMiddle as defined in 11.8.6.
|
||||
2. Let sub be the result of evaluating Expression.
|
||||
3. Let middle be ToString(sub).
|
||||
---*/
|
||||
|
||||
assert.sameValue(`${0} ${5} bar`, '0 5 bar', 'number value');
|
||||
assert.sameValue(`${0} ${'string'} bar`, '0 string bar', 'string value');
|
|
@ -0,0 +1,14 @@
|
|||
// Copyright (C) Copyright 2015 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
es6id: 12.2.8.5
|
||||
description: Template literal in expression position of TemplateMiddleList
|
||||
info: >
|
||||
TemplateMiddleList : TemplateMiddle Expression
|
||||
|
||||
1. Let head be the TV of TemplateMiddle as defined in 11.8.6.
|
||||
2. Let sub be the result of evaluating Expression.
|
||||
3. Let middle be ToString(sub).
|
||||
---*/
|
||||
|
||||
assert.sameValue(`${0} ${`bar ${5} baz`} qux`, '0 bar 5 baz qux');
|
|
@ -0,0 +1,23 @@
|
|||
// Copyright (C) Copyright 2015 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
es6id: 12.2.8.5
|
||||
description: Abrupt completion when converting expression value of TemplateMiddleList
|
||||
info: >
|
||||
TemplateMiddleList : TemplateMiddle Expression
|
||||
|
||||
1. Let head be the TV of TemplateMiddle as defined in 11.8.6.
|
||||
2. Let sub be the result of evaluating Expression.
|
||||
3. Let middle be ToString(sub).
|
||||
4. ReturnIfAbrupt(middle).
|
||||
---*/
|
||||
|
||||
var obj = {
|
||||
toString: function() {
|
||||
throw new Test262Error();
|
||||
}
|
||||
};
|
||||
|
||||
assert.throws(Test262Error, function() {
|
||||
`${0} ${obj}`;
|
||||
});
|
|
@ -0,0 +1,14 @@
|
|||
// Copyright (C) Copyright 2015 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
es6id: 12.2.8.5
|
||||
description: Evaluation of NoSubstitutionTemplate
|
||||
info: >
|
||||
12.2.8.5 Runtime Semantics: Evaluation
|
||||
TemplateLiteral : NoSubstitutionTemplate
|
||||
|
||||
1. Return the string value whose code units are the elements of the TV of
|
||||
NoSubstitutionTemplate as defined in 11.8.6.
|
||||
---*/
|
||||
|
||||
assert.sameValue(`NoSubstitutionTemplate`, 'NoSubstitutionTemplate');
|
|
@ -1,88 +0,0 @@
|
|||
// Copyright (C) Copyright 2014 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
es6id: 11.8.6
|
||||
description: >
|
||||
The TRV of CharacterEscapeSequence :: SingleEscapeCharacter is the TRV of
|
||||
the SingleEscapeCharacter.
|
||||
The TRV of CharacterEscapeSequence :: NonEscapeCharacter is the CV of the
|
||||
NonEscapeCharacter.
|
||||
---*/
|
||||
var calls;
|
||||
|
||||
calls = 0;
|
||||
(function(s) {
|
||||
calls++;
|
||||
assert.sameValue(s.raw[0], "\u005C\u0027");
|
||||
})`\'`;
|
||||
assert.sameValue(calls, 1);
|
||||
|
||||
calls = 0;
|
||||
(function(s) {
|
||||
calls++;
|
||||
assert.sameValue(s.raw[0], "\u005C\u0022");
|
||||
})`\"`;
|
||||
assert.sameValue(calls, 1);
|
||||
|
||||
calls = 0;
|
||||
(function(s) {
|
||||
calls++;
|
||||
assert.sameValue(s.raw[0], "\u005C\u005C");
|
||||
})`\\`;
|
||||
assert.sameValue(calls, 1);
|
||||
|
||||
calls = 0;
|
||||
(function(s) {
|
||||
calls++;
|
||||
assert.sameValue(s.raw[0], "\u005Cb");
|
||||
})`\b`;
|
||||
assert.sameValue(calls, 1);
|
||||
|
||||
calls = 0;
|
||||
(function(s) {
|
||||
calls++;
|
||||
assert.sameValue(s.raw[0], "\u005Cf");
|
||||
})`\f`;
|
||||
assert.sameValue(calls, 1);
|
||||
|
||||
calls = 0;
|
||||
(function(s) {
|
||||
calls++;
|
||||
assert.sameValue(s.raw[0], "\u005Cn");
|
||||
})`\n`;
|
||||
assert.sameValue(calls, 1);
|
||||
|
||||
calls = 0;
|
||||
(function(s) {
|
||||
calls++;
|
||||
assert.sameValue(s.raw[0], "\u005Cr");
|
||||
})`\r`;
|
||||
assert.sameValue(calls, 1);
|
||||
|
||||
calls = 0;
|
||||
(function(s) {
|
||||
calls++;
|
||||
assert.sameValue(s.raw[0], "\u005Ct");
|
||||
})`\t`;
|
||||
assert.sameValue(calls, 1);
|
||||
|
||||
calls = 0;
|
||||
(function(s) {
|
||||
calls++;
|
||||
assert.sameValue(s.raw[0], "\u005Cv");
|
||||
})`\v`;
|
||||
assert.sameValue(calls, 1);
|
||||
|
||||
calls = 0;
|
||||
(function(s) {
|
||||
calls++;
|
||||
assert.sameValue(s.raw[0], "\u005C`");
|
||||
})`\``;
|
||||
assert.sameValue(calls, 1);
|
||||
|
||||
calls = 0;
|
||||
(function(s) {
|
||||
calls++;
|
||||
assert.sameValue(s.raw[0], "\u005Cz");
|
||||
})`\z`;
|
||||
assert.sameValue(calls, 1);
|
|
@ -1,39 +0,0 @@
|
|||
// Copyright (C) Copyright 2014 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
es6id: 11.8.6
|
||||
description: >
|
||||
The TV of TemplateCharacter :: \ EscapeSequence is the SV of
|
||||
EscapeSequence.
|
||||
The TRV of EscapeSequence :: 0 is the code unit value 0x0030.
|
||||
The TRV of EscapeSequence :: HexEscapeSequence is the TRV of the
|
||||
HexEscapeSequence.
|
||||
The TRV of EscapeSequence :: UnicodeEscapeSequence is the TRV of the
|
||||
UnicodeEscapeSequence.
|
||||
---*/
|
||||
var calls;
|
||||
|
||||
calls = 0;
|
||||
(function(s) {
|
||||
calls++;
|
||||
assert.sameValue(s[0], ' |