Index: test/mjsunit/es6/string-raw.js |
diff --git a/test/mjsunit/es6/string-raw.js b/test/mjsunit/es6/string-raw.js |
index 7a7f4c2a40ade49a98b7b0ad57b73012397704bf..2c6bb2ff308a9c7a02fba66337ed120d6cdbbfdc 100644 |
--- a/test/mjsunit/es6/string-raw.js |
+++ b/test/mjsunit/es6/string-raw.js |
@@ -254,3 +254,39 @@ |
assertEquals("12345", String.raw(callSiteObj, arg(2), arg(4), arg(6))); |
assertEquals(["length", "raw1", "arg2", "raw3", "arg4", "raw5"], order); |
})(); |
+ |
+ |
+(function testStringRawToStringSubstitutionsOrder() { |
+ var subs = []; |
+ var log = []; |
+ function stringify(toString) { |
+ var valueOf = "_" + toString + "_"; |
+ return { |
+ toString: function() { return toString; }, |
+ valueOf: function() { return valueOf; } |
+ }; |
+ } |
+ function getter(name, value) { |
+ return { |
+ get: function() { |
+ log.push("get" + name); |
+ return value; |
+ }, |
+ set: function(v) { |
+ log.push("set" + name); |
+ } |
+ }; |
+ } |
+ Object.defineProperties(subs, { |
+ 0: getter(0, stringify("a")), |
+ 1: getter(1, stringify("b")), |
+ 2: getter(2, stringify("c")) |
+ }); |
+ |
+ assertEquals("-a-b-c-", String.raw`-${subs[0]}-${subs[1]}-${subs[2]}-`); |
+ assertArrayEquals(["get0", "get1", "get2"], log); |
+ |
+ log.length = 0; |
+ assertEquals("-a-", String.raw`-${subs[0]}-`); |
+ assertArrayEquals(["get0"], log); |
+})(); |