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

Side by Side Diff: tests/corelib_strong/regexp/v8_regexp_utils.dart

Issue 3004073002: Remove corelib/corelib_strong and migrate last two remaining tests. (Closed)
Patch Set: Created 3 years, 3 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) 2014, 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
5 // Utility functions to easily port V8 tests.
6
7 import "package:expect/expect.dart";
8
9 void assertEquals(actual, expected, [String message = null]) {
10 Expect.equals(actual, expected, message);
11 }
12
13 void assertTrue(actual, [String message = null]) {
14 Expect.isTrue(actual, message);
15 }
16
17 void assertFalse(actual, [String message = null]) {
18 Expect.isFalse(actual, message);
19 }
20
21 void assertThrows(fn, [num testid = null]) {
22 Expect.throws(fn, null, "Test $testid");
23 }
24
25 void assertNull(actual, [num testid = null]) {
26 Expect.isNull(actual, "Test $testid");
27 }
28
29 void assertToStringEquals(str, match, num testid) {
30 var actual = [];
31 for (int i = 0; i <= match.groupCount; i++) {
32 var g = match.group(i);
33 actual.add((g == null) ? "" : g);
34 }
35 Expect.equals(str, actual.join(","), "Test $testid");
36 }
37
38 void shouldBeTrue(actual) {
39 Expect.isTrue(actual);
40 }
41
42 void shouldBeFalse(actual) {
43 Expect.isFalse(actual);
44 }
45
46 void shouldBeNull(actual) {
47 Expect.isNull(actual);
48 }
49
50 void shouldBe(actual, expected, [String message = null]) {
51 if (expected == null) {
52 Expect.isNull(actual, message);
53 } else {
54 Expect.equals(expected.length, actual.groupCount + 1);
55 for (int i = 0; i <= actual.groupCount; i++) {
56 Expect.equals(expected[i], actual.group(i), message);
57 }
58 }
59 }
60
61 Match firstMatch(String str, RegExp pattern) => pattern.firstMatch(str);
62 List<String> allStringMatches(String str, RegExp pattern) =>
63 pattern.allMatches(str).map((Match m) => m.group(0)).toList();
64
65 void description(str) {}
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698