OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 23795 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
23806 " var foobXXXXX"; // Too many bytes which look like incomplete chars! | 23806 " var foobXXXXX"; // Too many bytes which look like incomplete chars! |
23807 char chunk2[] = | 23807 char chunk2[] = |
23808 "r = 13;\n" | 23808 "r = 13;\n" |
23809 " return foob\xeb\x91\x80\x80\x80r;\n" | 23809 " return foob\xeb\x91\x80\x80\x80r;\n" |
23810 "}\n"; | 23810 "}\n"; |
23811 for (int i = 0; i < 5; ++i) chunk1[strlen(chunk1) - 5 + i] = reference[i]; | 23811 for (int i = 0; i < 5; ++i) chunk1[strlen(chunk1) - 5 + i] = reference[i]; |
23812 | 23812 |
23813 const char* chunks[] = {chunk1, chunk2, "foo();", NULL}; | 23813 const char* chunks[] = {chunk1, chunk2, "foo();", NULL}; |
23814 RunStreamingTest(chunks, v8::ScriptCompiler::StreamedSource::UTF8, false); | 23814 RunStreamingTest(chunks, v8::ScriptCompiler::StreamedSource::UTF8, false); |
23815 } | 23815 } |
| 23816 |
| 23817 |
| 23818 TEST(StreamingUtf8ScriptWithMultipleMultibyteCharactersSomeSplit) { |
| 23819 // Regression test: Stream data where there are several multi-byte UTF-8 |
| 23820 // characters in a sequence and one of them is split between two data chunks. |
| 23821 const char* reference = "\xeb\x91\x80"; |
| 23822 char chunk1[] = |
| 23823 "function foo() {\n" |
| 23824 " // This function will contain an UTF-8 character which is not in\n" |
| 23825 " // ASCII.\n" |
| 23826 " var foob\xeb\x91\x80X"; |
| 23827 char chunk2[] = |
| 23828 "XXr = 13;\n" |
| 23829 " return foob\xeb\x91\x80\xeb\x91\x80r;\n" |
| 23830 "}\n"; |
| 23831 chunk1[strlen(chunk1) - 1] = reference[0]; |
| 23832 chunk2[0] = reference[1]; |
| 23833 chunk2[1] = reference[2]; |
| 23834 const char* chunks[] = {chunk1, chunk2, "foo();", NULL}; |
| 23835 RunStreamingTest(chunks, v8::ScriptCompiler::StreamedSource::UTF8); |
| 23836 } |
OLD | NEW |