| OLD | NEW |
| 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:expect/expect.dart"; | |
| 8 import 'package:observatory/service_io.dart'; | 7 import 'package:observatory/service_io.dart'; |
| 9 import 'package:unittest/unittest.dart'; | 8 import 'package:unittest/unittest.dart'; |
| 10 import 'test_helper.dart'; | 9 import 'test_helper.dart'; |
| 11 | 10 |
| 12 var regex0; | 11 var regex0; |
| 13 var regex; | 12 var regex; |
| 14 | 13 |
| 15 void script() { | 14 void script() { |
| 16 // 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. |
| 17 regex0 = new RegExp("with internal \u{0} NUL"); | 16 regex0 = new RegExp("with internal \u{0} NUL"); |
| 18 regex = new RegExp(r"(\w+)"); | 17 regex = new RegExp(r"(\w+)"); |
| 19 String str = "Parse my string"; | 18 String str = "Parse my string"; |
| 20 Iterable<Match> matches = regex.allMatches(str); // Run to generate bytecode. | 19 Iterable<Match> matches = regex.allMatches(str); // Run to generate bytecode. |
| 21 Expect.equals(3, matches.length); | 20 expect(matches.length, equals(3)); |
| 22 } | 21 } |
| 23 | 22 |
| 24 var tests = [ | 23 var tests = [ |
| 25 | 24 |
| 26 (Isolate isolate) async { | 25 (Isolate isolate) async { |
| 27 Library lib = isolate.rootLibrary; | 26 Library lib = isolate.rootLibrary; |
| 28 await lib.load(); | 27 await lib.load(); |
| 29 | 28 |
| 30 Field field0 = lib.variables.singleWhere((v) => v.name == 'regex0'); | 29 Field field0 = lib.variables.singleWhere((v) => v.name == 'regex0'); |
| 31 await field0.load(); // No crash due to embedded NUL. | 30 await field0.load(); // No crash due to embedded NUL. |
| (...skipping 20 matching lines...) Expand all Loading... |
| 52 var f3 = await regex.externalOneByteFunction.load(); | 51 var f3 = await regex.externalOneByteFunction.load(); |
| 53 expect(f3 is ServiceFunction, isTrue); | 52 expect(f3 is ServiceFunction, isTrue); |
| 54 var f4 = await regex.externalTwoByteFunction.load(); | 53 var f4 = await regex.externalTwoByteFunction.load(); |
| 55 expect(f4 is ServiceFunction, isTrue); | 54 expect(f4 is ServiceFunction, isTrue); |
| 56 } | 55 } |
| 57 } | 56 } |
| 58 | 57 |
| 59 ]; | 58 ]; |
| 60 | 59 |
| 61 main(args) => runIsolateTests(args, tests, testeeBefore: script); | 60 main(args) => runIsolateTests(args, tests, testeeBefore: script); |
| 62 | |
| OLD | NEW |