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

Side by Side Diff: runtime/observatory/tests/service/regexp_function_test.dart

Issue 2207883004: From Regis: Remove regexp pattern from function name to avoid crash in debug mode. Fix service obj… (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 4 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
OLDNEW
(Empty)
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file.
4 // VMOptions=
5 // VMOptions=--interpret_irregexp
6
7 import "package:expect/expect.dart";
8 import 'package:observatory/service_io.dart';
9 import 'package:unittest/unittest.dart';
10 import 'test_helper.dart';
11
12 var regex0;
13 var regex;
14
15 void script() {
16 // Check the internal NUL doesn't trip up the name scrubbing in the vm.
17 regex0 = new RegExp("with internal \u{0} NUL");
18 regex = new RegExp(r"(\w+)");
19 String str = "Parse my string";
20 Iterable<Match> matches = regex.allMatches(str); // Run to generate bytecode.
21 Expect.equals(3, matches.length);
22 }
23
24 var tests = [
25
26 (Isolate isolate) async {
27 Library lib = isolate.rootLibrary;
28 await lib.load();
29
30 Field field0 = lib.variables.singleWhere((v) => v.name == 'regex0');
31 await field0.load(); // No crash due to embedded NUL.
32
33 Field field = lib.variables.singleWhere((v) => v.name == 'regex');
34 await field.load();
35 Instance regex = field.staticValue;
36 expect(regex.isInstance, isTrue);
37 expect(regex.isRegExp, isTrue);
38 await regex.load();
39
40 if (regex.oneByteFunction == null) {
41 // Running with interpreted regexp.
42 var b1 = await regex.oneByteBytecode.load();
43 expect(b1.isTypedData, isTrue);
44 var b2 = await regex.twoByteBytecode.load();
45 expect(b2.isTypedData, isFalse); // No two-byte string subject was used.
46 } else {
47 // Running with compiled regexp.
48 var f1 = await regex.oneByteFunction.load();
49 expect(f1 is ServiceFunction, isTrue);
50 var f2 = await regex.twoByteFunction.load();
51 expect(f2 is ServiceFunction, isTrue);
52 var f3 = await regex.externalOneByteFunction.load();
53 expect(f3 is ServiceFunction, isTrue);
54 var f4 = await regex.externalTwoByteFunction.load();
55 expect(f4 is ServiceFunction, isTrue);
56 }
57 }
58
59 ];
60
61 main(args) => runIsolateTests(args, tests, testeeBefore: script);
62
OLDNEW
« no previous file with comments | « runtime/observatory/lib/src/service/object.dart ('k') | runtime/observatory/tests/service/test_helper.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698