| Index: dart/tests/utils/src/DummyCompilerTest.dart
|
| diff --git a/dart/tests/utils/src/DummyCompilerTest.dart b/dart/tests/utils/src/DummyCompilerTest.dart
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..92ab6077c8032d8580aafd3a5d1d391e38d550e6
|
| --- /dev/null
|
| +++ b/dart/tests/utils/src/DummyCompilerTest.dart
|
| @@ -0,0 +1,32 @@
|
| +// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
|
| +// for details. All rights reserved. Use of this source code is governed by a
|
| +// BSD-style license that can be found in the LICENSE file.
|
| +
|
| +// Smoke test of the dart2js compiler API.
|
| +
|
| +#import('../../../frog/leg/api.dart');
|
| +#import('../../../lib/uri/uri.dart');
|
| +
|
| +Future<String> provider(Uri uri) {
|
| + Completer<String> completer = new Completer<String>();
|
| + String source;
|
| + if (uri.scheme == "main") {
|
| + source = "main() {}";
|
| + } else {
|
| + source = "";
|
| + }
|
| + completer.complete(source);
|
| + return completer.future;
|
| +}
|
| +
|
| +void handler(Uri uri, int begin, int end, String message, bool fatal) {
|
| + print(message);
|
| +}
|
| +
|
| +main() {
|
| + String code = compile(new Uri(scheme: 'main'), new Uri(scheme: 'lib'),
|
| + provider, handler).value;
|
| + if (code === null) {
|
| + throw 'Compilation failed';
|
| + }
|
| +}
|
|
|