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

Side by Side Diff: tests/compiler/dart2js/dart_backend_test.dart

Issue 11574032: Make unit testing of the compiler work with the new isolate helper library. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 4
5 import 'dart:uri'; 5 import 'dart:uri';
6 import 'parser_helper.dart'; 6 import 'parser_helper.dart';
7 import 'mock_compiler.dart'; 7 import 'mock_compiler.dart';
8 import '../../../sdk/lib/_internal/compiler/compiler.dart'; 8 import '../../../sdk/lib/_internal/compiler/compiler.dart';
9 import '../../../sdk/lib/_internal/compiler/implementation/dart2jslib.dart' as l eg; 9 import '../../../sdk/lib/_internal/compiler/implementation/dart2jslib.dart' as l eg;
10 import '../../../sdk/lib/_internal/compiler/implementation/dart_backend/dart_bac kend.dart'; 10 import '../../../sdk/lib/_internal/compiler/implementation/dart_backend/dart_bac kend.dart';
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 54
55 const helperLib = r''' 55 const helperLib = r'''
56 library js_helper; 56 library js_helper;
57 class JSInvocationMirror {} 57 class JSInvocationMirror {}
58 '''; 58 ''';
59 59
60 const foreignLib = r''' 60 const foreignLib = r'''
61 var JS; 61 var JS;
62 '''; 62 ''';
63 63
64 const isolateHelperLib = r'''
65 class _WorkerStub {
66 }
67 ''';
68
64 testDart2Dart(String src, {void continuation(String s), bool minify: false, 69 testDart2Dart(String src, {void continuation(String s), bool minify: false,
65 bool stripTypes: false}) { 70 bool stripTypes: false}) {
66 // If continuation is not provided, check that source string remains the same. 71 // If continuation is not provided, check that source string remains the same.
67 if (continuation == null) { 72 if (continuation == null) {
68 continuation = (s) { Expect.equals(src, s); }; 73 continuation = (s) { Expect.equals(src, s); };
69 } 74 }
70 testDart2DartWithLibrary(src, '', continuation: continuation, minify: minify, 75 testDart2DartWithLibrary(src, '', continuation: continuation, minify: minify,
71 stripTypes: stripTypes); 76 stripTypes: stripTypes);
72 } 77 }
73 78
74 /** 79 /**
75 * Library name is assumed to be 'mylib' in 'mylib.dart' file. 80 * Library name is assumed to be 'mylib' in 'mylib.dart' file.
76 */ 81 */
77 testDart2DartWithLibrary( 82 testDart2DartWithLibrary(
78 String srcMain, String srcLibrary, 83 String srcMain, String srcLibrary,
79 {void continuation(String s), bool minify: false, 84 {void continuation(String s), bool minify: false,
80 bool stripTypes: false}) { 85 bool stripTypes: false}) {
81 fileUri(path) => new Uri.fromComponents(scheme: 'file', path: path); 86 fileUri(path) => new Uri.fromComponents(scheme: 'file', path: path);
82 87
83 final scriptUri = fileUri('script.dart'); 88 final scriptUri = fileUri('script.dart');
84 final libUri = fileUri('mylib.dart'); 89 final libUri = fileUri('mylib.dart');
85 90
86 provider(uri) { 91 provider(uri) {
87 if (uri == scriptUri) return new Future.immediate(srcMain); 92 if (uri == scriptUri) return new Future.immediate(srcMain);
88 if (uri.toString() == libUri.toString()) { 93 if (uri.toString() == libUri.toString()) {
89 return new Future.immediate(srcLibrary); 94 return new Future.immediate(srcLibrary);
90 } 95 }
91 if (uri.path.endsWith('/core.dart')) return new Future.immediate(coreLib); 96 if (uri.path.endsWith('/core.dart')) return new Future.immediate(coreLib);
kasperl 2012/12/14 10:13:42 Maybe fix the long lines in this section.
92 if (uri.path.endsWith('/io.dart')) return new Future.immediate(ioLib); 97 if (uri.path.endsWith('/io.dart')) return new Future.immediate(ioLib);
93 if (uri.path.endsWith('/js_helper.dart')) return new Future.immediate(helper Lib); 98 if (uri.path.endsWith('/js_helper.dart')) return new Future.immediate(helper Lib);
94 // TODO(smok): The file should change to html_dartium at some point. 99 // TODO(smok): The file should change to html_dartium at some point.
95 if (uri.path.endsWith('/html_dart2js.dart')) return new Future.immediate(htm lLib); 100 if (uri.path.endsWith('/html_dart2js.dart')) return new Future.immediate(htm lLib);
96 if (uri.path.endsWith('/foreign_helper.dart')) return new Future.immediate(f oreignLib); 101 if (uri.path.endsWith('/foreign_helper.dart')) return new Future.immediate(f oreignLib);
102 if (uri.path.endsWith('/isolate_helper.dart')) return new Future.immediate(i solateHelperLib);
ahe 2012/12/14 10:13:52 Long line.
97 return new Future.immediate(''); 103 return new Future.immediate('');
98 } 104 }
99 105
100 handler(uri, begin, end, message, kind) { 106 handler(uri, begin, end, message, kind) {
101 if (identical(kind, Diagnostic.ERROR) || identical(kind, Diagnostic.CRASH)) { 107 if (identical(kind, Diagnostic.ERROR) || identical(kind, Diagnostic.CRASH)) {
102 Expect.fail('$uri: $begin-$end: $message [$kind]'); 108 Expect.fail('$uri: $begin-$end: $message [$kind]');
103 } 109 }
104 } 110 }
105 111
106 final options = <String>['--output-type=dart']; 112 final options = <String>['--output-type=dart'];
(...skipping 631 matching lines...) Expand 10 before | Expand all | Expand 10 after
738 testStaticAccessIoLib(); 744 testStaticAccessIoLib();
739 testLocalFunctionPlaceholder(); 745 testLocalFunctionPlaceholder();
740 testMinification(); 746 testMinification();
741 testClosureLocalsMinified(); 747 testClosureLocalsMinified();
742 testParametersMinified(); 748 testParametersMinified();
743 testDeclarationTypePlaceholders(); 749 testDeclarationTypePlaceholders();
744 testPlatformLibraryMemberNamesAreFixed(); 750 testPlatformLibraryMemberNamesAreFixed();
745 testConflictsWithCoreLib(); 751 testConflictsWithCoreLib();
746 testUnresolvedNamedConstructor(); 752 testUnresolvedNamedConstructor();
747 } 753 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698