| OLD | NEW |
| (Empty) |
| 1 // Copyright (c) 2014, 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 library pub_tests; | |
| 6 | |
| 7 import '../descriptor.dart' as d; | |
| 8 import '../test_pub.dart'; | |
| 9 import 'utils.dart'; | |
| 10 | |
| 11 void main() { | |
| 12 initConfig(); | |
| 13 | |
| 14 integration("reports a dependency if the library itself is transformed", () { | |
| 15 d.dir(appPath, [ | |
| 16 d.pubspec({ | |
| 17 "name": "myapp", | |
| 18 "dependencies": {"foo": {"path": "../foo"}}, | |
| 19 "transformers": [ | |
| 20 {"foo": {"\$include": "bin/myapp.dart.dart"}} | |
| 21 ] | |
| 22 }), | |
| 23 d.dir("bin", [ | |
| 24 d.file("myapp.dart", "import 'package:myapp/lib.dart';"), | |
| 25 ]) | |
| 26 ]).create(); | |
| 27 | |
| 28 d.dir("foo", [ | |
| 29 d.pubspec({"name": "foo", "version": "1.0.0"}), | |
| 30 d.dir("lib", [d.file("foo.dart", transformer())]) | |
| 31 ]).create(); | |
| 32 | |
| 33 expectLibraryDependencies('myapp|bin/myapp.dart', ['foo']); | |
| 34 }); | |
| 35 | |
| 36 integration("reports a dependency if a transformed local file is imported", | |
| 37 () { | |
| 38 d.dir(appPath, [ | |
| 39 d.pubspec({ | |
| 40 "name": "myapp", | |
| 41 "dependencies": {"foo": {"path": "../foo"}}, | |
| 42 "transformers": [ | |
| 43 {"foo": {"\$include": "lib/lib.dart"}} | |
| 44 ] | |
| 45 }), | |
| 46 d.dir("lib", [ | |
| 47 d.file("lib.dart", ""), | |
| 48 ]), | |
| 49 d.dir("bin", [ | |
| 50 d.file("myapp.dart", "import 'package:myapp/lib.dart';"), | |
| 51 ]) | |
| 52 ]).create(); | |
| 53 | |
| 54 d.dir("foo", [ | |
| 55 d.pubspec({"name": "foo", "version": "1.0.0"}), | |
| 56 d.dir("lib", [d.file("foo.dart", transformer())]) | |
| 57 ]).create(); | |
| 58 | |
| 59 expectLibraryDependencies('myapp|bin/myapp.dart', ['foo']); | |
| 60 }); | |
| 61 | |
| 62 integration("reports a dependency if a transformed foreign file is imported", | |
| 63 () { | |
| 64 d.dir(appPath, [ | |
| 65 d.pubspec({ | |
| 66 "name": "myapp", | |
| 67 "dependencies": {"foo": {"path": "../foo"}}, | |
| 68 }), | |
| 69 d.dir("bin", [ | |
| 70 d.file("myapp.dart", "import 'package:foo/foo.dart';") | |
| 71 ]) | |
| 72 ]).create(); | |
| 73 | |
| 74 d.dir("foo", [ | |
| 75 d.pubspec({ | |
| 76 "name": "foo", | |
| 77 "version": "1.0.0", | |
| 78 "transformers": [{"foo": {"\$include": "lib/foo.dart"}}] | |
| 79 }), | |
| 80 d.dir("lib", [ | |
| 81 d.file("foo.dart", ""), | |
| 82 d.file("transformer.dart", transformer()) | |
| 83 ]) | |
| 84 ]).create(); | |
| 85 | |
| 86 expectLibraryDependencies('myapp|bin/myapp.dart', ['foo']); | |
| 87 }); | |
| 88 | |
| 89 integration("doesn't report a dependency if no transformed files are " | |
| 90 "imported", () { | |
| 91 d.dir(appPath, [ | |
| 92 d.pubspec({ | |
| 93 "name": "myapp", | |
| 94 "dependencies": {"foo": {"path": "../foo"}}, | |
| 95 "transformers": [ | |
| 96 {"foo": {"\$include": "lib/lib.dart"}} | |
| 97 ] | |
| 98 }), | |
| 99 d.dir("lib", [ | |
| 100 d.file("lib.dart", ""), | |
| 101 d.file("untransformed.dart", ""), | |
| 102 ]), | |
| 103 d.dir("bin", [ | |
| 104 d.file("myapp.dart", "import 'package:myapp/untransformed.dart';"), | |
| 105 ]) | |
| 106 ]).create(); | |
| 107 | |
| 108 d.dir("foo", [ | |
| 109 d.pubspec({"name": "foo", "version": "1.0.0"}), | |
| 110 d.dir("lib", [d.file("foo.dart", transformer())]) | |
| 111 ]).create(); | |
| 112 | |
| 113 expectLibraryDependencies('myapp|bin/myapp.dart', []); | |
| 114 }); | |
| 115 } | |
| OLD | NEW |