From e42f977122a16d0b086ec9c6b1c498fff542118e Mon Sep 17 00:00:00 2001 From: Mike Pennisi Date: Tue, 16 Jun 2015 15:10:09 -0400 Subject: [PATCH] fixup! Introduce additional tests for ES6 templates Ensure test files assert the described behavior. Extend coverage to strict and non-strict mode explicitly. --- .../call-expression-context-no-strict.js | 22 +++++++++++++++++++ ...t.js => call-expression-context-strict.js} | 5 +++-- 2 files changed, 25 insertions(+), 2 deletions(-) create mode 100644 test/language/expressions/tagged-template/call-expression-context-no-strict.js rename test/language/expressions/tagged-template/{call-expression-context.js => call-expression-context-strict.js} (89%) diff --git a/test/language/expressions/tagged-template/call-expression-context-no-strict.js b/test/language/expressions/tagged-template/call-expression-context-no-strict.js new file mode 100644 index 0000000000..834ebc71b5 --- /dev/null +++ b/test/language/expressions/tagged-template/call-expression-context-no-strict.js @@ -0,0 +1,22 @@ +// 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. +flags: [noStrict] +---*/ +var context = null; +var fn = function() { + return function() { + context = this; + }; +}; + +fn()`NoSubstitutionTemplate`; + +assert.sameValue(context, this); diff --git a/test/language/expressions/tagged-template/call-expression-context.js b/test/language/expressions/tagged-template/call-expression-context-strict.js similarity index 89% rename from test/language/expressions/tagged-template/call-expression-context.js rename to test/language/expressions/tagged-template/call-expression-context-strict.js index e58ff26b73..1bdb6ec2b2 100644 --- a/test/language/expressions/tagged-template/call-expression-context.js +++ b/test/language/expressions/tagged-template/call-expression-context-strict.js @@ -8,14 +8,15 @@ info: > derived from a TemplateLiteral. The actual arguments include a template object and the values produced by evaluating the expressions embedded within the TemplateLiteral. +flags: [onlyStrict] ---*/ -var context; +var context = null; var fn = function() { return function() { context = this; }; }; -fn`NoSubstitutionTemplate`; +fn()`NoSubstitutionTemplate`; assert.sameValue(context, undefined);