Index: test/cctest/test-strings.cc |
diff --git a/test/cctest/test-strings.cc b/test/cctest/test-strings.cc |
index c4f72f47010342fedc3c2fd4e042faf0fe649a1a..4557100e7ab1d1ec288d1135d0986ffb8264093c 100644 |
--- a/test/cctest/test-strings.cc |
+++ b/test/cctest/test-strings.cc |
@@ -1,4 +1,4 @@ |
-// Copyright 2011 the V8 project authors. All rights reserved. |
+// Copyright 2012 the V8 project authors. All rights reserved. |
// Check that we can traverse very deep stacks of ConsStrings using |
// StringInputBuffer. Check that Get(int) works on very deep stacks |
@@ -691,3 +691,20 @@ TEST(RegExpOverflow) { |
CHECK(result.IsEmpty()); |
CHECK(context->HasOutOfMemoryException()); |
} |
+ |
+ |
+TEST(StringReplaceAtomTwoByteResult) { |
+ InitializeVM(); |
+ HandleScope scope; |
+ LocalContext context; |
+ v8::Local<v8::Value> result = CompileRun( |
+ "var subject = 'ascii~only~string~'; " |
+ "var replace = '\x80'; " |
+ "subject.replace(/~/g, replace); "); |
+ CHECK(result->IsString()); |
+ Handle<String> string = v8::Utils::OpenHandle(v8::String::Cast(*result)); |
+ CHECK(string->IsSeqTwoByteString()); |
+ |
+ v8::Local<v8::String> expected = v8_str("ascii\x80only\x80string\x80"); |
+ CHECK(expected->Equals(result)); |
+} |