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

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

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

Powered by Google App Engine
This is Rietveld 408576698