Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(16)

Side by Side Diff: sdk/lib/_internal/pub/test/dependency_computer/no_dependencies_test.dart

Issue 1165473002: Start pulling pub from its own repo. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Code review changes Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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 'package:scheduled_test/scheduled_test.dart';
8
9 import '../descriptor.dart' as d;
10 import '../test_pub.dart';
11 import 'utils.dart';
12
13 void main() {
14 initConfig();
15
16 integration("reports no dependencies if no transformers are used", () {
17 d.dir(appPath, [
18 d.pubspec({
19 "name": "myapp",
20 "dependencies": {"foo": {"path": "../foo"}}
21 })
22 ]).create();
23
24 d.dir("foo", [d.libPubspec("foo", "1.0.0")]).create();
25
26 expectDependencies({});
27 });
28
29 integration("reports no dependencies if a transformer is used in a "
30 "package that doesn't expose a transformer", () {
31 d.dir(appPath, [
32 d.pubspec({
33 "name": "myapp",
34 "dependencies": {"foo": {"path": "../foo"}},
35 "transformers": ["foo"]
36 })
37 ]).create();
38
39 d.dir("foo", [
40 d.libPubspec("foo", "1.0.0"),
41 d.dir("lib", [d.file("foo.dart", transformer())])
42 ]).create();
43
44 expectDependencies({"foo": []});
45 });
46
47 integration("reports no dependencies for non-file/package imports", () {
48 d.dir(appPath, [
49 d.pubspec({
50 "name": "myapp",
51 "dependencies": {"foo": {"path": "../foo"}},
52 "transformers": ["myapp"]
53 }),
54 d.dir("lib", [
55 d.file("myapp.dart", transformer([
56 "dart:async",
57 "http://dartlang.org/nonexistent.dart"
58 ]))
59 ])
60 ]).create();
61
62 d.dir("foo", [
63 d.libPubspec("foo", "1.0.0"),
64 d.dir("lib", [d.file("foo.dart", transformer())])
65 ]).create();
66
67 expectDependencies({"myapp": []});
68 });
69
70 integration("reports no dependencies for a single self transformer", () {
71 d.dir(appPath, [
72 d.pubspec({
73 "name": "myapp",
74 "transformers": ["myapp"]
75 }),
76 d.dir("lib", [d.file("myapp.dart", transformer())])
77 ]).create();
78
79 expectDependencies({"myapp": []});
80 });
81
82 integration("reports no dependencies if a transformer applies to files that "
83 "aren't used by the exposed transformer", () {
84 d.dir(appPath, [
85 d.pubspec({
86 "name": "myapp",
87 "dependencies": {"foo": {"path": "../foo"}},
88 "transformers": [
89 {"foo": {"\$include": "lib/myapp.dart"}},
90 {"foo": {"\$exclude": "lib/transformer.dart"}},
91 "myapp"
92 ]
93 }),
94 d.dir("lib", [
95 d.file("myapp.dart", ""),
96 d.file("transformer.dart", transformer())
97 ])
98 ]).create();
99
100 d.dir("foo", [
101 d.libPubspec("foo", "1.0.0"),
102 d.dir("lib", [d.file("foo.dart", transformer())])
103 ]).create();
104
105 expectDependencies({"myapp": [], "foo": []});
106 });
107
108 integration("reports no dependencies if a transformer applies to a "
109 "dependency's files that aren't used by the exposed transformer", () {
110 d.dir(appPath, [
111 d.pubspec({
112 "name": "myapp",
113 "dependencies": {"foo": {"path": "../foo"}},
114 "transformers": ["myapp"]
115 }),
116 d.dir("lib", [
117 d.file("myapp.dart", ""),
118 d.file("transformer.dart", transformer(["package:foo/foo.dart"]))
119 ])
120 ]).create();
121
122 d.dir("foo", [
123 d.pubspec({
124 "name": "foo",
125 "version": "1.0.0",
126 "transformers": [{"foo": {"\$exclude": "lib/foo.dart"}}]
127 }),
128 d.dir("lib", [
129 d.file("foo.dart", ""),
130 d.file("transformer.dart", transformer())
131 ])
132 ]).create();
133
134 expectDependencies({'myapp': [], 'foo': []});
135 });
136
137 test("reports no dependencies on transformers in future phases", () {
138 d.dir(appPath, [
139 d.pubspec({
140 "name": "myapp",
141 "transformers": [
142 {"myapp/first": {"\$include": "lib/myapp.dart"}},
143 {"myapp/second": {"\$include": "lib/first.dart"}},
144 {"myapp/third": {"\$include": "lib/second.dart"}}
145 ]
146 }),
147 d.dir("lib", [
148 d.file("myapp.dart", ""),
149 d.file("first.dart", transformer()),
150 d.file("second.dart", transformer()),
151 d.file("third.dart", transformer())
152 ])
153 ]).create();
154
155 expectDependencies({
156 'myapp/first': [],
157 'myapp/second': [],
158 'myapp/third': []
159 });
160 });
161 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698