| 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, [d.pubspec({ | |
| 16 "name": "myapp", | |
| 17 "dependencies": { | |
| 18 "foo": { | |
| 19 "path": "../foo" | |
| 20 } | |
| 21 }, | |
| 22 "transformers": [{ | |
| 23 "foo": { | |
| 24 "\$include": "bin/myapp.dart.dart" | |
| 25 } | |
| 26 }] | |
| 27 }), | |
| 28 d.dir( | |
| 29 "bin", | |
| 30 [d.file("myapp.dart", "import 'package:myapp/lib.dart';"),])]).cre
ate(); | |
| 31 | |
| 32 d.dir("foo", [d.pubspec({ | |
| 33 "name": "foo", | |
| 34 "version": "1.0.0" | |
| 35 }), d.dir("lib", [d.file("foo.dart", transformer())])]).create(); | |
| 36 | |
| 37 expectLibraryDependencies('myapp|bin/myapp.dart', ['foo']); | |
| 38 }); | |
| 39 | |
| 40 integration( | |
| 41 "reports a dependency if a transformed local file is imported", | |
| 42 () { | |
| 43 d.dir(appPath, [d.pubspec({ | |
| 44 "name": "myapp", | |
| 45 "dependencies": { | |
| 46 "foo": { | |
| 47 "path": "../foo" | |
| 48 } | |
| 49 }, | |
| 50 "transformers": [{ | |
| 51 "foo": { | |
| 52 "\$include": "lib/lib.dart" | |
| 53 } | |
| 54 }] | |
| 55 }), | |
| 56 d.dir("lib", [d.file("lib.dart", ""),]), | |
| 57 d.dir( | |
| 58 "bin", | |
| 59 [d.file("myapp.dart", "import 'package:myapp/lib.dart';"),])]).cre
ate(); | |
| 60 | |
| 61 d.dir("foo", [d.pubspec({ | |
| 62 "name": "foo", | |
| 63 "version": "1.0.0" | |
| 64 }), d.dir("lib", [d.file("foo.dart", transformer())])]).create(); | |
| 65 | |
| 66 expectLibraryDependencies('myapp|bin/myapp.dart', ['foo']); | |
| 67 }); | |
| 68 | |
| 69 integration( | |
| 70 "reports a dependency if a transformed foreign file is imported", | |
| 71 () { | |
| 72 d.dir(appPath, [d.pubspec({ | |
| 73 "name": "myapp", | |
| 74 "dependencies": { | |
| 75 "foo": { | |
| 76 "path": "../foo" | |
| 77 } | |
| 78 }, | |
| 79 }), | |
| 80 d.dir( | |
| 81 "bin", | |
| 82 [d.file("myapp.dart", "import 'package:foo/foo.dart';")])]).create
(); | |
| 83 | |
| 84 d.dir("foo", [d.pubspec({ | |
| 85 "name": "foo", | |
| 86 "version": "1.0.0", | |
| 87 "transformers": [{ | |
| 88 "foo": { | |
| 89 "\$include": "lib/foo.dart" | |
| 90 } | |
| 91 }] | |
| 92 }), | |
| 93 d.dir( | |
| 94 "lib", | |
| 95 [d.file("foo.dart", ""), d.file("transformer.dart", transformer())
])]).create(); | |
| 96 | |
| 97 expectLibraryDependencies('myapp|bin/myapp.dart', ['foo']); | |
| 98 }); | |
| 99 | |
| 100 integration( | |
| 101 "doesn't report a dependency if no transformed files are " "imported", | |
| 102 () { | |
| 103 d.dir(appPath, [d.pubspec({ | |
| 104 "name": "myapp", | |
| 105 "dependencies": { | |
| 106 "foo": { | |
| 107 "path": "../foo" | |
| 108 } | |
| 109 }, | |
| 110 "transformers": [{ | |
| 111 "foo": { | |
| 112 "\$include": "lib/lib.dart" | |
| 113 } | |
| 114 }] | |
| 115 }), | |
| 116 d.dir("lib", [d.file("lib.dart", ""), d.file("untransformed.dart", "")
,]), | |
| 117 d.dir( | |
| 118 "bin", | |
| 119 [ | |
| 120 d.file( | |
| 121 "myapp.dart", | |
| 122 "import 'package:myapp/untransformed.dart';"),])]).create(
); | |
| 123 | |
| 124 d.dir("foo", [d.pubspec({ | |
| 125 "name": "foo", | |
| 126 "version": "1.0.0" | |
| 127 }), d.dir("lib", [d.file("foo.dart", transformer())])]).create(); | |
| 128 | |
| 129 expectLibraryDependencies('myapp|bin/myapp.dart', []); | |
| 130 }); | |
| 131 } | |
| OLD | NEW |