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

Side by Side Diff: test/cctest/test-regexp.cc

Issue 2173403002: Replace SmartArrayPointer<T> with unique_ptr<T[]> (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: updates Created 4 years, 5 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 unified diff | Download patch
« no previous file with comments | « test/cctest/test-parsing.cc ('k') | test/cctest/wasm/test-run-wasm-interpreter.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
11 // with the distribution. 11 // with the distribution.
12 // * Neither the name of Google Inc. nor the names of its 12 // * Neither the name of Google Inc. nor the names of its
13 // contributors may be used to endorse or promote products derived 13 // contributors may be used to endorse or promote products derived
14 // from this software without specific prior written permission. 14 // from this software without specific prior written permission.
15 // 15 //
16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 27
28 #include <cstdlib> 28 #include <cstdlib>
29 #include <memory>
29 #include <sstream> 30 #include <sstream>
30 31
31 #include "include/v8.h" 32 #include "include/v8.h"
32 #include "src/v8.h" 33 #include "src/v8.h"
33 34
34 #include "src/ast/ast.h" 35 #include "src/ast/ast.h"
35 #include "src/char-predicates-inl.h" 36 #include "src/char-predicates-inl.h"
36 #include "src/ostreams.h" 37 #include "src/ostreams.h"
37 #include "src/regexp/jsregexp.h" 38 #include "src/regexp/jsregexp.h"
38 #include "src/regexp/regexp-macro-assembler.h" 39 #include "src/regexp/regexp-macro-assembler.h"
(...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after
478 v8::HandleScope scope(CcTest::isolate()); 479 v8::HandleScope scope(CcTest::isolate());
479 Zone zone(CcTest::i_isolate()->allocator()); 480 Zone zone(CcTest::i_isolate()->allocator());
480 FlatStringReader reader(CcTest::i_isolate(), CStrVector(input)); 481 FlatStringReader reader(CcTest::i_isolate(), CStrVector(input));
481 RegExpCompileData result; 482 RegExpCompileData result;
482 JSRegExp::Flags flags = JSRegExp::kNone; 483 JSRegExp::Flags flags = JSRegExp::kNone;
483 if (unicode) flags |= JSRegExp::kUnicode; 484 if (unicode) flags |= JSRegExp::kUnicode;
484 CHECK(!v8::internal::RegExpParser::ParseRegExp(CcTest::i_isolate(), &zone, 485 CHECK(!v8::internal::RegExpParser::ParseRegExp(CcTest::i_isolate(), &zone,
485 &reader, flags, &result)); 486 &reader, flags, &result));
486 CHECK(result.tree == NULL); 487 CHECK(result.tree == NULL);
487 CHECK(!result.error.is_null()); 488 CHECK(!result.error.is_null());
488 v8::base::SmartArrayPointer<char> str = result.error->ToCString(ALLOW_NULLS); 489 std::unique_ptr<char[]> str = result.error->ToCString(ALLOW_NULLS);
489 CHECK_EQ(0, strcmp(expected, str.get())); 490 CHECK_EQ(0, strcmp(expected, str.get()));
490 } 491 }
491 492
492 493
493 TEST(Errors) { 494 TEST(Errors) {
494 const char* kEndBackslash = "\\ at end of pattern"; 495 const char* kEndBackslash = "\\ at end of pattern";
495 ExpectError("\\", kEndBackslash); 496 ExpectError("\\", kEndBackslash);
496 const char* kUnterminatedGroup = "Unterminated group"; 497 const char* kUnterminatedGroup = "Unterminated group";
497 ExpectError("(foo", kUnterminatedGroup); 498 ExpectError("(foo", kUnterminatedGroup);
498 const char* kInvalidGroup = "Invalid group"; 499 const char* kInvalidGroup = "Invalid group";
(...skipping 1524 matching lines...) Expand 10 before | Expand all | Expand 10 after
2023 v8::Local<v8::String> external = 2024 v8::Local<v8::String> external =
2024 v8::String::NewExternalOneByte(isolate, new UncachedExternalString()) 2025 v8::String::NewExternalOneByte(isolate, new UncachedExternalString())
2025 .ToLocalChecked(); 2026 .ToLocalChecked();
2026 CHECK(v8::Utils::OpenHandle(*external)->map() == 2027 CHECK(v8::Utils::OpenHandle(*external)->map() ==
2027 CcTest::i_isolate()->heap()->short_external_one_byte_string_map()); 2028 CcTest::i_isolate()->heap()->short_external_one_byte_string_map());
2028 v8::Local<v8::Object> global = env->Global(); 2029 v8::Local<v8::Object> global = env->Global();
2029 global->Set(env.local(), v8_str("external"), external).FromJust(); 2030 global->Set(env.local(), v8_str("external"), external).FromJust();
2030 CompileRun("var re = /y(.)/; re.test('ab');"); 2031 CompileRun("var re = /y(.)/; re.test('ab');");
2031 ExpectString("external.substring(1).match(re)[1]", "z"); 2032 ExpectString("external.substring(1).match(re)[1]", "z");
2032 } 2033 }
OLDNEW
« no previous file with comments | « test/cctest/test-parsing.cc ('k') | test/cctest/wasm/test-run-wasm-interpreter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698