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

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

Issue 896623005: Use native async/await support in pub. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Code review changes Created 5 years, 10 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 // 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 expect(tree.fromFiles(files), equals("""
33 '-- dir
34 |-- a.dart
35 |-- b.dart
36 |-- c.dart
37 |-- d.dart
38 |-- e.dart
39 |-- f.dart
40 |-- g.dart
41 |-- h.dart
42 |-- i.dart
43 '-- j.dart
44 """));
45 });
46
47 test('files are elided if there are more than ten', () {
48 var files = [
49 "dir/a.dart",
50 "dir/b.dart",
51 "dir/c.dart",
52 "dir/d.dart",
53 "dir/e.dart",
54 "dir/f.dart",
55 "dir/g.dart",
56 "dir/h.dart",
57 "dir/i.dart",
58 "dir/j.dart",
59 "dir/k.dart"];
60 expect(tree.fromFiles(files), equals("""
61 '-- dir
62 |-- a.dart
63 |-- b.dart
64 |-- c.dart
65 | (5 more...)
66 |-- i.dart
67 |-- j.dart
68 '-- k.dart
69 """));
70 });
71
72 test('files are not elided at the top level', () {
73 var files = [
74 "a.dart",
75 "b.dart",
76 "c.dart",
77 "d.dart",
78 "e.dart",
79 "f.dart",
80 "g.dart",
81 "h.dart",
82 "i.dart",
83 "j.dart",
84 "k.dart"];
85 expect(tree.fromFiles(files), equals("""
86 |-- a.dart
87 |-- b.dart
88 |-- c.dart
89 |-- d.dart
90 |-- e.dart
91 |-- f.dart
92 |-- g.dart
93 |-- h.dart
94 |-- i.dart
95 |-- j.dart
96 '-- k.dart
97 """));
98 });
99
100 test('a complex example', () {
101 var files = [
102 "TODO",
103 "example/console_example.dart",
104 "example/main.dart",
105 "example/web copy/web_example.dart",
106 "test/absolute_test.dart",
107 "test/basename_test.dart",
108 "test/dirname_test.dart",
109 "test/extension_test.dart",
110 "test/is_absolute_test.dart",
111 "test/is_relative_test.dart",
112 "test/join_test.dart",
113 "test/normalize_test.dart",
114 "test/relative_test.dart",
115 "test/split_test.dart",
116 ".gitignore",
117 "README.md",
118 "lib/path.dart",
119 "pubspec.yaml",
120 "test/all_test.dart",
121 "test/path_posix_test.dart",
122 "test/path_windows_test.dart"];
123
124 expect(tree.fromFiles(files), equals("""
125 |-- .gitignore
126 |-- README.md
127 |-- TODO
128 |-- example
129 | |-- console_example.dart
130 | |-- main.dart
131 | '-- web copy
132 | '-- web_example.dart
133 |-- lib
134 | '-- path.dart
135 |-- pubspec.yaml
136 '-- test
137 |-- absolute_test.dart
138 |-- all_test.dart
139 |-- basename_test.dart
140 | (7 more...)
141 |-- path_windows_test.dart
142 |-- relative_test.dart
143 '-- split_test.dart
144 """));
145 });
146 });
147
148 group('treeFromMap', () {
149 test('empty map', () {
150 expect(tree.fromMap({}), equals(""));
151 });
152
153 test('a complex example', () {
154 var map = {
155 ".gitignore": {},
156 "README.md": {},
157 "TODO": {},
158 "example": {
159 "console_example.dart": {},
160 "main.dart": {},
161 "web copy": {
162 "web_example.dart": {}
163 },
164 },
165 "lib": {
166 "path.dart": {}
167 },
168 "pubspec.yaml": {},
169 "test": {
170 "absolute_test.dart": {},
171 "basename_test.dart": {},
172 "dirname_test.dart": {},
173 "extension_test.dart": {},
174 "is_absolute_test.dart": {},
175 "is_relative_test.dart": {},
176 "join_test.dart": {},
177 "normalize_test.dart": {},
178 "relative_test.dart": {},
179 "split_test.dart": {}
180 }
181 };
182
183 expect(tree.fromMap(map), equals("""
184 |-- .gitignore
185 |-- README.md
186 |-- TODO
187 |-- example
188 | |-- console_example.dart
189 | |-- main.dart
190 | '-- web copy
191 | '-- web_example.dart
192 |-- lib
193 | '-- path.dart
194 |-- pubspec.yaml
195 '-- test
196 |-- absolute_test.dart
197 |-- basename_test.dart
198 |-- dirname_test.dart
199 |-- extension_test.dart
200 |-- is_absolute_test.dart
201 |-- is_relative_test.dart
202 |-- join_test.dart
203 |-- normalize_test.dart
204 |-- relative_test.dart
205 '-- split_test.dart
206 """));
207 });
208 });
209
210 test('does not elide children if showAllChildren is true', () {
211 var map = {
212 'dir': {
213 'a.dart': {},
214 'b.dart': {},
215 'c.dart': {},
216 'd.dart': {},
217 'e.dart': {},
218 'f.dart': {},
219 'g.dart': {},
220 'h.dart': {},
221 'i.dart': {},
222 'j.dart': {},
223 'k.dart': {},
224 'l.dart': {},
225 }
226 };
227 expect(tree.fromMap(map, showAllChildren: true), equals("""
228 '-- dir
229 |-- a.dart
230 |-- b.dart
231 |-- c.dart
232 |-- d.dart
233 |-- e.dart
234 |-- f.dart
235 |-- g.dart
236 |-- h.dart
237 |-- i.dart
238 |-- j.dart
239 |-- k.dart
240 '-- l.dart
241 """));
242 });
243
244 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698