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

Side by Side Diff: sdk/lib/_internal/pub/test/ascii_tree_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
« no previous file with comments | « sdk/lib/_internal/pub/pub.status ('k') | sdk/lib/_internal/pub/test/asset/out-of-date.snapshot » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2012, 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 lock_file_test;
6
7 import 'package:unittest/unittest.dart';
8
9 import '../lib/src/ascii_tree.dart' as tree;
10 import '../lib/src/utils.dart';
11
12 main() {
13 runningAsTest = true;
14
15 group('tree.fromFiles', () {
16 test('no files', () {
17 expect(tree.fromFiles([]), equals(""));
18 });
19
20 test('up to ten files in one directory are shown', () {
21 var files = [
22 "dir/a.dart",
23 "dir/b.dart",
24 "dir/c.dart",
25 "dir/d.dart",
26 "dir/e.dart",
27 "dir/f.dart",
28 "dir/g.dart",
29 "dir/h.dart",
30 "dir/i.dart",
31 "dir/j.dart"
32 ];
33 expect(tree.fromFiles(files), equals("""
34 '-- dir
35 |-- a.dart
36 |-- b.dart
37 |-- c.dart
38 |-- d.dart
39 |-- e.dart
40 |-- f.dart
41 |-- g.dart
42 |-- h.dart
43 |-- i.dart
44 '-- j.dart
45 """));
46 });
47
48 test('files are elided if there are more than ten', () {
49 var files = [
50 "dir/a.dart",
51 "dir/b.dart",
52 "dir/c.dart",
53 "dir/d.dart",
54 "dir/e.dart",
55 "dir/f.dart",
56 "dir/g.dart",
57 "dir/h.dart",
58 "dir/i.dart",
59 "dir/j.dart",
60 "dir/k.dart"
61 ];
62 expect(tree.fromFiles(files), equals("""
63 '-- dir
64 |-- a.dart
65 |-- b.dart
66 |-- c.dart
67 | (5 more...)
68 |-- i.dart
69 |-- j.dart
70 '-- k.dart
71 """));
72 });
73
74 test('files are not elided at the top level', () {
75 var files = [
76 "a.dart",
77 "b.dart",
78 "c.dart",
79 "d.dart",
80 "e.dart",
81 "f.dart",
82 "g.dart",
83 "h.dart",
84 "i.dart",
85 "j.dart",
86 "k.dart"
87 ];
88 expect(tree.fromFiles(files), equals("""
89 |-- a.dart
90 |-- b.dart
91 |-- c.dart
92 |-- d.dart
93 |-- e.dart
94 |-- f.dart
95 |-- g.dart
96 |-- h.dart
97 |-- i.dart
98 |-- j.dart
99 '-- k.dart
100 """));
101 });
102
103 test('a complex example', () {
104 var files = [
105 "TODO",
106 "example/console_example.dart",
107 "example/main.dart",
108 "example/web copy/web_example.dart",
109 "test/absolute_test.dart",
110 "test/basename_test.dart",
111 "test/dirname_test.dart",
112 "test/extension_test.dart",
113 "test/is_absolute_test.dart",
114 "test/is_relative_test.dart",
115 "test/join_test.dart",
116 "test/normalize_test.dart",
117 "test/relative_test.dart",
118 "test/split_test.dart",
119 ".gitignore",
120 "README.md",
121 "lib/path.dart",
122 "pubspec.yaml",
123 "test/all_test.dart",
124 "test/path_posix_test.dart",
125 "test/path_windows_test.dart"
126 ];
127
128 expect(tree.fromFiles(files), equals("""
129 |-- .gitignore
130 |-- README.md
131 |-- TODO
132 |-- example
133 | |-- console_example.dart
134 | |-- main.dart
135 | '-- web copy
136 | '-- web_example.dart
137 |-- lib
138 | '-- path.dart
139 |-- pubspec.yaml
140 '-- test
141 |-- absolute_test.dart
142 |-- all_test.dart
143 |-- basename_test.dart
144 | (7 more...)
145 |-- path_windows_test.dart
146 |-- relative_test.dart
147 '-- split_test.dart
148 """));
149 });
150 });
151
152 group('treeFromMap', () {
153 test('empty map', () {
154 expect(tree.fromMap({}), equals(""));
155 });
156
157 test('a complex example', () {
158 var map = {
159 ".gitignore": {},
160 "README.md": {},
161 "TODO": {},
162 "example": {
163 "console_example.dart": {},
164 "main.dart": {},
165 "web copy": {
166 "web_example.dart": {}
167 },
168 },
169 "lib": {
170 "path.dart": {}
171 },
172 "pubspec.yaml": {},
173 "test": {
174 "absolute_test.dart": {},
175 "basename_test.dart": {},
176 "dirname_test.dart": {},
177 "extension_test.dart": {},
178 "is_absolute_test.dart": {},
179 "is_relative_test.dart": {},
180 "join_test.dart": {},
181 "normalize_test.dart": {},
182 "relative_test.dart": {},
183 "split_test.dart": {}
184 }
185 };
186
187 expect(tree.fromMap(map), equals("""
188 |-- .gitignore
189 |-- README.md
190 |-- TODO
191 |-- example
192 | |-- console_example.dart
193 | |-- main.dart
194 | '-- web copy
195 | '-- web_example.dart
196 |-- lib
197 | '-- path.dart
198 |-- pubspec.yaml
199 '-- test
200 |-- absolute_test.dart
201 |-- basename_test.dart
202 |-- dirname_test.dart
203 |-- extension_test.dart
204 |-- is_absolute_test.dart
205 |-- is_relative_test.dart
206 |-- join_test.dart
207 |-- normalize_test.dart
208 |-- relative_test.dart
209 '-- split_test.dart
210 """));
211 });
212 });
213
214 test('does not elide children if showAllChildren is true', () {
215 var map = {
216 'dir': {
217 'a.dart': {},
218 'b.dart': {},
219 'c.dart': {},
220 'd.dart': {},
221 'e.dart': {},
222 'f.dart': {},
223 'g.dart': {},
224 'h.dart': {},
225 'i.dart': {},
226 'j.dart': {},
227 'k.dart': {},
228 'l.dart': {},
229 }
230 };
231 expect(tree.fromMap(map, showAllChildren: true), equals("""
232 '-- dir
233 |-- a.dart
234 |-- b.dart
235 |-- c.dart
236 |-- d.dart
237 |-- e.dart
238 |-- f.dart
239 |-- g.dart
240 |-- h.dart
241 |-- i.dart
242 |-- j.dart
243 |-- k.dart
244 '-- l.dart
245 """));
246 });
247
248 }
OLDNEW
« no previous file with comments | « sdk/lib/_internal/pub/pub.status ('k') | sdk/lib/_internal/pub/test/asset/out-of-date.snapshot » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698