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

Side by Side Diff: test/codegen/corelib/regexp/v8_regexp_utils.dart

Issue 1945153002: Add corelib tests (Closed) Base URL: https://github.com/dart-lang/dev_compiler@master
Patch Set: error_test and range_error_test now pass Created 4 years, 7 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 void assertTrue(actual, [String message = null]) { Expect.isTrue(actual, message ); }
13 void assertFalse(actual, [String message = null]) { Expect.isFalse(actual, messa ge); }
14 void assertThrows(fn, [num testid = null]) {
15 Expect.throws(fn, null, "Test $testid");
16 }
17 void assertNull(actual, [num testid = null]) {
18 Expect.isNull(actual, "Test $testid");
19 }
20
21 void assertToStringEquals(str, match, num testid) {
22 var actual = [];
23 for (int i = 0; i <= match.groupCount; i++) {
24 var g = match.group(i);
25 actual.add((g == null) ? "" : g);
26 }
27 Expect.equals(str, actual.join(","), "Test $testid");
28 }
29
30 void shouldBeTrue(actual) { Expect.isTrue(actual); }
31 void shouldBeFalse(actual) { Expect.isFalse(actual); }
32 void shouldBeNull(actual) { Expect.isNull(actual); }
33
34 void shouldBe(actual, expected, [String message = null]) {
35 if (expected == null) {
36 Expect.isNull(actual, message);
37 } else {
38 Expect.equals(expected.length, actual.groupCount + 1);
39 for (int i = 0; i <= actual.groupCount; i++) {
40 Expect.equals(expected[i], actual.group(i), message);
41 }
42 }
43 }
44
45 Match firstMatch(String str, RegExp pattern) => pattern.firstMatch(str);
46 List<String> allStringMatches(String str, RegExp pattern) =>
47 pattern.allMatches(str).map((Match m) => m.group(0)).toList();
48
49 void description(str) { }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698