blob: 3830020c65ddb0d32749660fc6c3dc0ae44b2dc1 [file] [log] [blame]
// Copyright (c) 2014, 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.
/// Test that poi.dart finds the right element.
library trydart.poi_find_test;
import 'dart:io' show
Platform;
import 'dart:async' show
Future;
import 'package:try/poi/poi.dart' as poi;
import 'package:async_helper/async_helper.dart';
import 'package:expect/expect.dart';
import 'package:compiler/implementation/elements/elements.dart' show
Element;
import 'package:compiler/implementation/source_file_provider.dart' show
FormattingDiagnosticHandler;
Future testPoi() {
Uri script = Platform.script.resolve('data/empty_main.dart');
FormattingDiagnosticHandler handler = new FormattingDiagnosticHandler();
handler.verbose = true;
Future future = poi.runPoi(script, 225, handler.provider, handler);
return future.then((Element element) {
Uri foundScript = element.compilationUnit.script.resourceUri;
Expect.stringEquals('$script', '$foundScript');
Expect.stringEquals('main', element.name);
});
}
void main() {
asyncTest(testPoi);
}