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

Side by Side Diff: sdk/lib/_internal/pub_generated/test/package_list_files_test.dart

Issue 557563002: Store the async-await compiled pub code directly in the repo. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 3 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 | Annotate | Revision Log
OLDNEW
(Empty)
1 library packages_list_files_test;
2 import 'package:path/path.dart' as path;
3 import 'package:scheduled_test/scheduled_test.dart';
4 import '../lib/src/entrypoint.dart';
5 import '../lib/src/io.dart';
6 import '../lib/src/system_cache.dart';
7 import 'descriptor.dart' as d;
8 import 'test_pub.dart';
9 var root;
10 var entrypoint;
11 main() {
12 initConfig();
13 group('not in a git repo', () {
14 setUp(() {
15 d.appDir().create();
16 scheduleEntrypoint();
17 });
18 integration('lists files recursively', () {
19 d.dir(
20 appPath,
21 [
22 d.file('file1.txt', 'contents'),
23 d.file('file2.txt', 'contents'),
24 d.dir(
25 'subdir',
26 [
27 d.file('subfile1.txt', 'subcontents'),
28 d.file('subfile2.txt', 'subcontents')])]).create();
29 schedule(() {
30 expect(
31 entrypoint.root.listFiles(),
32 unorderedEquals(
33 [
34 path.join(root, 'pubspec.yaml'),
35 path.join(root, 'file1.txt'),
36 path.join(root, 'file2.txt'),
37 path.join(root, 'subdir', 'subfile1.txt'),
38 path.join(root, 'subdir', 'subfile2.txt')]));
39 });
40 });
41 commonTests();
42 });
43 group('with git', () {
44 setUp(() {
45 ensureGit();
46 d.git(appPath, [d.appPubspec()]).create();
47 scheduleEntrypoint();
48 });
49 integration("includes files that are or aren't checked in", () {
50 d.dir(
51 appPath,
52 [
53 d.file('file1.txt', 'contents'),
54 d.file('file2.txt', 'contents'),
55 d.dir(
56 'subdir',
57 [
58 d.file('subfile1.txt', 'subcontents'),
59 d.file('subfile2.txt', 'subcontents')])]).create();
60 schedule(() {
61 expect(
62 entrypoint.root.listFiles(),
63 unorderedEquals(
64 [
65 path.join(root, 'pubspec.yaml'),
66 path.join(root, 'file1.txt'),
67 path.join(root, 'file2.txt'),
68 path.join(root, 'subdir', 'subfile1.txt'),
69 path.join(root, 'subdir', 'subfile2.txt')]));
70 });
71 });
72 integration("ignores files that are gitignored", () {
73 d.dir(
74 appPath,
75 [
76 d.file('.gitignore', '*.txt'),
77 d.file('file1.txt', 'contents'),
78 d.file('file2.text', 'contents'),
79 d.dir(
80 'subdir',
81 [
82 d.file('subfile1.txt', 'subcontents'),
83 d.file('subfile2.text', 'subcontents')])]).create();
84 schedule(() {
85 expect(
86 entrypoint.root.listFiles(),
87 unorderedEquals(
88 [
89 path.join(root, 'pubspec.yaml'),
90 path.join(root, '.gitignore'),
91 path.join(root, 'file2.text'),
92 path.join(root, 'subdir', 'subfile2.text')]));
93 });
94 });
95 commonTests();
96 });
97 }
98 void scheduleEntrypoint() {
99 schedule(() {
100 root = path.join(sandboxDir, appPath);
101 entrypoint = new Entrypoint(root, new SystemCache.withSources(root));
102 }, 'initializing entrypoint');
103 currentSchedule.onComplete.schedule(() {
104 entrypoint = null;
105 }, 'nulling entrypoint');
106 }
107 void commonTests() {
108 integration('ignores broken symlinks', () {
109 d.dir(appPath, [d.dir('target')]).create();
110 scheduleSymlink(path.join(appPath, 'target'), path.join(appPath, 'link'));
111 schedule(() => deleteEntry(path.join(sandboxDir, appPath, 'target')));
112 schedule(() {
113 expect(
114 entrypoint.root.listFiles(),
115 equals([path.join(root, 'pubspec.yaml')]));
116 });
117 });
118 integration('ignores pubspec.lock files', () {
119 d.dir(
120 appPath,
121 [d.file('pubspec.lock'), d.dir('subdir', [d.file('pubspec.lock')])]).cre ate();
122 schedule(() {
123 expect(
124 entrypoint.root.listFiles(),
125 equals([path.join(root, 'pubspec.yaml')]));
126 });
127 });
128 integration('ignores packages directories', () {
129 d.dir(
130 appPath,
131 [
132 d.dir('packages', [d.file('file.txt', 'contents')]),
133 d.dir(
134 'subdir',
135 [d.dir('packages', [d.file('subfile.txt', 'subcontents')])])]).c reate();
136 schedule(() {
137 expect(
138 entrypoint.root.listFiles(),
139 equals([path.join(root, 'pubspec.yaml')]));
140 });
141 });
142 integration('allows pubspec.lock directories', () {
143 d.dir(
144 appPath,
145 [d.dir('pubspec.lock', [d.file('file.txt', 'contents')])]).create();
146 schedule(() {
147 expect(
148 entrypoint.root.listFiles(),
149 unorderedEquals(
150 [
151 path.join(root, 'pubspec.yaml'),
152 path.join(root, 'pubspec.lock', 'file.txt')]));
153 });
154 });
155 group('and "beneath"', () {
156 integration('only lists files beneath the given root', () {
157 d.dir(
158 appPath,
159 [
160 d.file('file1.txt', 'contents'),
161 d.file('file2.txt', 'contents'),
162 d.dir(
163 'subdir',
164 [
165 d.file('subfile1.txt', 'subcontents'),
166 d.file('subfile2.txt', 'subcontents'),
167 d.dir(
168 'subsubdir',
169 [
170 d.file('subsubfile1.txt', 'subsubcontents'),
171 d.file('subsubfile2.txt', 'subsubcontents')])])]). create();
172 schedule(() {
173 expect(
174 entrypoint.root.listFiles(beneath: path.join(root, 'subdir')),
175 unorderedEquals(
176 [
177 path.join(root, 'subdir', 'subfile1.txt'),
178 path.join(root, 'subdir', 'subfile2.txt'),
179 path.join(root, 'subdir', 'subsubdir', 'subsubfile1.txt'),
180 path.join(root, 'subdir', 'subsubdir', 'subsubfile2.txt')])) ;
181 });
182 });
183 integration("doesn't care if the root is blacklisted", () {
184 d.dir(
185 appPath,
186 [
187 d.file('file1.txt', 'contents'),
188 d.file('file2.txt', 'contents'),
189 d.dir(
190 'packages',
191 [
192 d.file('subfile1.txt', 'subcontents'),
193 d.file('subfile2.txt', 'subcontents'),
194 d.dir(
195 'subsubdir',
196 [
197 d.file('subsubfile1.txt', 'subsubcontents'),
198 d.file('subsubfile2.txt', 'subsubcontents')])])]). create();
199 schedule(() {
200 expect(
201 entrypoint.root.listFiles(beneath: path.join(root, 'packages')),
202 unorderedEquals(
203 [
204 path.join(root, 'packages', 'subfile1.txt'),
205 path.join(root, 'packages', 'subfile2.txt'),
206 path.join(root, 'packages', 'subsubdir', 'subsubfile1.txt'),
207 path.join(root, 'packages', 'subsubdir', 'subsubfile2.txt')] ));
208 });
209 });
210 });
211 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698