diff options
author | Daniel Ehrenberg <littledan@chromium.org> | 2018-02-05 20:40:19 +0100 |
---|---|---|
committer | Leo Balter <leonardo.balter@gmail.com> | 2018-02-05 14:40:19 -0500 |
commit | d5fc8b25afe9adca74cc99b609bb268fc98943a4 (patch) | |
tree | c03ef8323bfbf7db0488df1e90e968c5bf86ed16 /test/language/expressions/tagged-template/cache-identical-source.js | |
parent | 31dfa8761ae0c18298f8c9d179e739b5e465f99c (diff) |
Test for change to cache templates by site, not contents (#972)
* Test for change to cache templates by site, not contents
These tests are against a specification change based on discussion in
https://github.com/tc39/ecma262/issues/840
The tests here passed on SpiderMonkey but failed on other
implementations, which implement the current specification.
* Add a test that caching is by source location, not function identity
* Update existing tests to reference the spec properly
Diffstat (limited to 'test/language/expressions/tagged-template/cache-identical-source.js')
-rw-r--r-- | test/language/expressions/tagged-template/cache-identical-source.js | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/test/language/expressions/tagged-template/cache-identical-source.js b/test/language/expressions/tagged-template/cache-identical-source.js index c6a5644a0..436aea6bd 100644 --- a/test/language/expressions/tagged-template/cache-identical-source.js +++ b/test/language/expressions/tagged-template/cache-identical-source.js @@ -1,11 +1,12 @@ // Copyright (C) 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: Template caching using identical expressions -info: | - Previously-created template objects should be retrieved from the internal - template registry when their source is identical. +esid: sec-gettemplateobject +description: Templates are cached by site, even when using identical expressions +info: > + 1. For each element _e_ of _templateRegistry_, do + 1. If _e_.[[Site]] is the same Parse Node as _templateLiteral_, then + 1. Return _e_.[[Array]]. ---*/ function tag(templateObject) { previousObject = templateObject; @@ -20,8 +21,8 @@ assert(firstObject !== null); previousObject = null; tag`head${a}tail`; -assert.sameValue( +assert.notSameValue( previousObject, firstObject, - 'The realm\'s template cache is used when tagged templates are executed in the source code directly' + 'The realm\'s template cache is by site, not string contents' ); |