Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(576)

Unified Diff: test/unittests/value-serializer-unittest.cc

Issue 2665653004: ValueSerializer: Share string encoding code with String and RegExp objects. (Closed)
Patch Set: Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/value-serializer.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/unittests/value-serializer-unittest.cc
diff --git a/test/unittests/value-serializer-unittest.cc b/test/unittests/value-serializer-unittest.cc
index ec2df077f57021ad0e12d6f4c7c68519bbcc12dd..06d93a53c831b05e0adfede6de544a70c1e9e25c 100644
--- a/test/unittests/value-serializer-unittest.cc
+++ b/test/unittests/value-serializer-unittest.cc
@@ -1501,6 +1501,16 @@ TEST_F(ValueSerializerTest, DecodeValueObjects) {
EXPECT_TRUE(EvaluateScriptForResultBool("result.a instanceof String"));
EXPECT_TRUE(EvaluateScriptForResultBool("result.a === result.b"));
});
+
+ // String object containing a Latin-1 string.
+ DecodeTest({0xff, 0x0c, 0x73, 0x22, 0x06, 'Q', 'u', 0xe9, 'b', 'e', 'c'},
+ [this](Local<Value> value) {
+ EXPECT_TRUE(EvaluateScriptForResultBool(
+ "Object.getPrototypeOf(result) === String.prototype"));
+ EXPECT_TRUE(EvaluateScriptForResultBool(
+ "result.valueOf() === 'Qu\\xe9bec'"));
+ EXPECT_TRUE(EvaluateScriptForResultBool("result.length === 6"));
+ });
}
TEST_F(ValueSerializerTest, RoundTripRegExp) {
@@ -1560,6 +1570,15 @@ TEST_F(ValueSerializerTest, DecodeRegExp) {
EXPECT_TRUE(EvaluateScriptForResultBool("result.a instanceof RegExp"));
EXPECT_TRUE(EvaluateScriptForResultBool("result.a === result.b"));
});
+
+ // RegExp containing a Latin-1 string.
+ DecodeTest(
+ {0xff, 0x0c, 0x52, 0x22, 0x06, 'Q', 'u', 0xe9, 'b', 'e', 'c', 0x02},
+ [this](Local<Value> value) {
+ ASSERT_TRUE(value->IsRegExp());
+ EXPECT_TRUE(EvaluateScriptForResultBool(
+ "result.toString() === '/Qu\\xe9bec/i'"));
+ });
}
TEST_F(ValueSerializerTest, RoundTripMap) {
« no previous file with comments | « src/value-serializer.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698