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

Unified Diff: tests/compiler/dart2js/type_checker_test.dart

Issue 362243003: Generate mock libraries and assert that helpers are non-null. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fix after rebase. Created 6 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tests/compiler/dart2js/size_test.dart ('k') | tests/compiler/dart2js/value_range_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/compiler/dart2js/type_checker_test.dart
diff --git a/tests/compiler/dart2js/type_checker_test.dart b/tests/compiler/dart2js/type_checker_test.dart
index 55b31bacc625d478853ab294c4fd087510f8b485..1c40df45fd3175408f3b51db3196917201b4d7cc 100644
--- a/tests/compiler/dart2js/type_checker_test.dart
+++ b/tests/compiler/dart2js/type_checker_test.dart
@@ -1997,54 +1997,42 @@ String returnWithType(String type, expression) {
Node parseExpression(String text) =>
parseBodyCode(text, (parser, token) => parser.parseExpression(token));
-const String NUM_SOURCE = '''
-abstract class num {
- num operator +(num other);
- num operator -(num other);
- num operator *(num other);
- num operator %(num other);
- double operator /(num other);
- int operator ~/(num other);
- num operator -();
- bool operator <(num other);
- bool operator <=(num other);
- bool operator >(num other);
- bool operator >=(num other);
-}
-''';
-
-const String INT_SOURCE = '''
-abstract class int extends num {
- int operator &(int other);
- int operator |(int other);
- int operator ^(int other);
- int operator ~();
- int operator <<(int shiftAmount);
- int operator >>(int shiftAmount);
- int operator -();
-}
-''';
-
-const String STRING_SOURCE = '''
-class String implements Pattern {
- String operator +(String other) => this;
-}
-''';
+const Map<String, String> ALT_SOURCE = const <String, String>{
+ 'num': r'''
+ abstract class num {
+ num operator +(num other);
+ num operator -(num other);
+ num operator *(num other);
+ num operator %(num other);
+ double operator /(num other);
+ int operator ~/(num other);
+ num operator -();
+ bool operator <(num other);
+ bool operator <=(num other);
+ bool operator >(num other);
+ bool operator >=(num other);
+ }
+ ''',
+ 'int': r'''
+ abstract class int extends num {
+ int operator &(int other);
+ int operator |(int other);
+ int operator ^(int other);
+ int operator ~();
+ int operator <<(int shiftAmount);
+ int operator >>(int shiftAmount);
+ int operator -();
+ }
+ ''',
+ 'String': r'''
+ class String implements Pattern {
+ String operator +(String other) => this;
+ }
+ ''',
+};
Future setup(test(MockCompiler compiler)) {
- RegExp classNum = new RegExp(r'abstract class num {}');
- Expect.isTrue(DEFAULT_CORELIB.contains(classNum));
- RegExp classInt = new RegExp(r'abstract class int extends num { }');
- Expect.isTrue(DEFAULT_CORELIB.contains(classInt));
- RegExp classString = new RegExp('class String implements Pattern {}');
- Expect.isTrue(DEFAULT_CORELIB.contains(classString));
-
- String CORE_SOURCE = DEFAULT_CORELIB
- .replaceAll(classNum, NUM_SOURCE)
- .replaceAll(classInt, INT_SOURCE)
- .replaceAll(classString, STRING_SOURCE);
-
- MockCompiler compiler = new MockCompiler.internal(coreSource: CORE_SOURCE);
+ MockCompiler compiler = new MockCompiler.internal(coreSource: ALT_SOURCE);
return compiler.init().then((_) => test(compiler));
}
« no previous file with comments | « tests/compiler/dart2js/size_test.dart ('k') | tests/compiler/dart2js/value_range_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698