Reorganize existing tests

This commit is contained in:
Mike Pennisi 2015-06-11 12:00:29 -04:00
parent a1437652ab
commit bd3d160ba1
43 changed files with 80 additions and 52 deletions

View File

@ -0,0 +1,16 @@
// 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: 12.2.8.5
description: Function invocation in expression position 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).
---*/
function fn() { return 'result'; }
assert.sameValue(`foo ${fn()} bar`, 'foo result bar');

View File

@ -1,11 +1,16 @@
// 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: 12.2.8
description: >
Expressions should be evaluated and converted to Strings according to the
ToString abstract operation.
es6id: 12.2.8.5
description: MemberExpression in expression position 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).
---*/
var object = {
number: 5,
string: 'stringValue'

View File

@ -0,0 +1,17 @@
// 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: 12.2.8.5
description: Method invocation in expression position 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).
---*/
var object = {
fn: function() { return 'result'; }
};
assert.sameValue(`foo ${object.fn()} bar`, 'foo result bar');

View File

@ -1,11 +1,16 @@
// 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: 12.2.8
description: >
Expressions should be evaluated and converted to Strings according to the
ToString abstract operation.
es6id: 12.2.8.5
description: Object reference in expression position 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).
---*/
var plain = {};
var custom = {
toString: function() {

View File

@ -0,0 +1,15 @@
// 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: 12.2.8.5
description: Primitive value in expression position 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).
---*/
assert.sameValue(`foo ${5} bar`, 'foo 5 bar', 'number value');
assert.sameValue(`foo ${'string'} bar`, 'foo string bar', 'string value');

View File

@ -0,0 +1,14 @@
// 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: 12.2.8.5
description: Template literal in expression position 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).
---*/
assert.sameValue(`foo ${`bar ${5} baz`} qux`, 'foo bar 5 baz qux');

View File

@ -1,11 +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: 12.2.8
description: >
Expressions should be evaluated and converted to Strings according to the
ToString abstract operation.
---*/
function fn() { return 'result'; }
assert.sameValue(`foo ${fn()} bar`, 'foo result bar');

View File

@ -1,13 +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: 12.2.8
description: >
Expressions should be evaluated and converted to Strings according to the
ToString abstract operation.
---*/
var object = {
fn: function() { return 'result'; }
};
assert.sameValue(`foo ${object.fn()} bar`, 'foo result bar');

View File

@ -1,11 +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: 12.2.8
description: >
Expressions should be evaluated and converted to Strings according to the
ToString abstract operation.
---*/
assert.sameValue(`foo ${5} bar`, 'foo 5 bar', 'number value');
assert.sameValue(`foo ${'string'} bar`, 'foo string bar', 'string value');

View File

@ -1,9 +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: 12.2.8
description: >
Expressions should be evaluated and converted to Strings according to the
ToString abstract operation.
---*/
assert.sameValue(`foo ${`bar ${5} baz`} qux`, 'foo bar 5 baz qux');