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 1388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1399 | 1399 |
1400 Isolate* isolate = CcTest::i_isolate(); | 1400 Isolate* isolate = CcTest::i_isolate(); |
1401 Factory* factory = isolate->factory(); | 1401 Factory* factory = isolate->factory(); |
1402 HandleScope scope(isolate); | 1402 HandleScope scope(isolate); |
1403 | 1403 |
1404 Handle<String> source = factory->NewStringFromStaticAscii("^f(o)o"); | 1404 Handle<String> source = factory->NewStringFromStaticAscii("^f(o)o"); |
1405 Handle<ByteArray> array = Handle<ByteArray>::cast(m.GetCode(source)); | 1405 Handle<ByteArray> array = Handle<ByteArray>::cast(m.GetCode(source)); |
1406 int captures[5]; | 1406 int captures[5]; |
1407 | 1407 |
1408 const uc16 str1[] = {'f', 'o', 'o', 'b', 'a', 'r'}; | 1408 const uc16 str1[] = {'f', 'o', 'o', 'b', 'a', 'r'}; |
1409 Handle<String> f1_16 = | 1409 Handle<String> f1_16 = factory->NewStringFromTwoByte( |
1410 factory->NewStringFromTwoByte(Vector<const uc16>(str1, 6)); | 1410 Vector<const uc16>(str1, 6)).ToHandleChecked(); |
1411 | 1411 |
1412 CHECK(IrregexpInterpreter::Match(isolate, array, f1_16, captures, 0)); | 1412 CHECK(IrregexpInterpreter::Match(isolate, array, f1_16, captures, 0)); |
1413 CHECK_EQ(0, captures[0]); | 1413 CHECK_EQ(0, captures[0]); |
1414 CHECK_EQ(3, captures[1]); | 1414 CHECK_EQ(3, captures[1]); |
1415 CHECK_EQ(1, captures[2]); | 1415 CHECK_EQ(1, captures[2]); |
1416 CHECK_EQ(2, captures[3]); | 1416 CHECK_EQ(2, captures[3]); |
1417 CHECK_EQ(84, captures[4]); | 1417 CHECK_EQ(84, captures[4]); |
1418 | 1418 |
1419 const uc16 str2[] = {'b', 'a', 'r', 'f', 'o', 'o'}; | 1419 const uc16 str2[] = {'b', 'a', 'r', 'f', 'o', 'o'}; |
1420 Handle<String> f2_16 = | 1420 Handle<String> f2_16 = factory->NewStringFromTwoByte( |
1421 factory->NewStringFromTwoByte(Vector<const uc16>(str2, 6)); | 1421 Vector<const uc16>(str2, 6)).ToHandleChecked(); |
1422 | 1422 |
1423 CHECK(!IrregexpInterpreter::Match(isolate, array, f2_16, captures, 0)); | 1423 CHECK(!IrregexpInterpreter::Match(isolate, array, f2_16, captures, 0)); |
1424 CHECK_EQ(42, captures[0]); | 1424 CHECK_EQ(42, captures[0]); |
1425 } | 1425 } |
1426 | 1426 |
1427 #endif // V8_INTERPRETED_REGEXP | 1427 #endif // V8_INTERPRETED_REGEXP |
1428 | 1428 |
1429 | 1429 |
1430 TEST(AddInverseToTable) { | 1430 TEST(AddInverseToTable) { |
1431 v8::internal::V8::Initialize(NULL); | 1431 v8::internal::V8::Initialize(NULL); |
(...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1804 ZoneList<CharacterRange> first_only(4, &zone); | 1804 ZoneList<CharacterRange> first_only(4, &zone); |
1805 ZoneList<CharacterRange> second_only(4, &zone); | 1805 ZoneList<CharacterRange> second_only(4, &zone); |
1806 ZoneList<CharacterRange> both(4, &zone); | 1806 ZoneList<CharacterRange> both(4, &zone); |
1807 } | 1807 } |
1808 | 1808 |
1809 | 1809 |
1810 TEST(Graph) { | 1810 TEST(Graph) { |
1811 V8::Initialize(NULL); | 1811 V8::Initialize(NULL); |
1812 Execute("\\b\\w+\\b", false, true, true); | 1812 Execute("\\b\\w+\\b", false, true, true); |
1813 } | 1813 } |
OLD | NEW |