OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file |
| 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. |
| 4 |
| 5 // PackageRoot=none |
| 6 |
| 7 import 'dart:io'; |
| 8 import 'dart:isolate'; |
| 9 |
| 10 import "package:flu"; |
| 11 |
| 12 var PACKAGE_FLU = "package:flu"; |
| 13 var FLU_TEXT = "flu.text"; |
| 14 |
| 15 testShortResolution(package_uri) async { |
| 16 var fluPackage = await Isolate.resolvePackageUri(Uri.parse(package_uri)); |
| 17 print("Resolved $package_uri to $fluPackage"); |
| 18 var fluText = fluPackage.resolve(FLU_TEXT); |
| 19 print("Resolved $FLU_TEXT from $package_uri to $fluText"); |
| 20 var fluFile = new File.fromUri(fluText); |
| 21 var fluString = await fluFile.readAsString(); |
| 22 if (fluString != "Bar") { |
| 23 throw "Contents of $FLU_TEXT not matching.\n" |
| 24 "Got: $fluString\n" |
| 25 "Expected: Bar"; |
| 26 } |
| 27 } |
| 28 |
| 29 main([args, port]) async { |
| 30 if (Flu.value != "Flu") { |
| 31 throw "Import of wrong Flu package."; |
| 32 } |
| 33 await testShortResolution(PACKAGE_FLU); |
| 34 await testShortResolution(PACKAGE_FLU + "/"); |
| 35 await testShortResolution(PACKAGE_FLU + "/abc.def"); |
| 36 print("SUCCESS"); |
| 37 } |
OLD | NEW |