blob: 62dfb8cfd5bca8ad7be787f3252b94b6f050e3f8 [file] [log] [blame]
// Copyright (c) 2016, 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.
// Packages=none
import 'dart:io';
import 'dart:isolate';
import "package:flu/flu.dart";
var PACKAGE_FLU = "package:flu";
var FLU_TEXT = "flu.text";
testShortResolution(package_uri) async {
var fluPackage = await Isolate.resolvePackageUri(Uri.parse(package_uri));
print("Resolved $package_uri to $fluPackage");
if (fluPackage == null) {
throw "Package resolves to null for $package_uri.\n";
}
var fluText = fluPackage.resolve(FLU_TEXT);
print("Resolved $FLU_TEXT from $package_uri to $fluText");
var fluFile = new File.fromUri(fluText);
var fluString = await fluFile.readAsString();
if (fluString != "Bar") {
throw "Contents of $FLU_TEXT not matching.\n"
"Got: $fluString\n"
"Expected: Bar";
}
}
main([args, port]) async {
if (Flu.value != "Flu") {
throw "Import of wrong Flu package.";
}
// await testShortResolution(PACKAGE_FLU);
await testShortResolution(PACKAGE_FLU + "/");
await testShortResolution(PACKAGE_FLU + "/abc.def");
print("SUCCESS");
}