OLD | NEW |
| (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 '../../pub/directory_tree.dart'; | |
10 | |
11 main() { | |
12 test('no files', () { | |
13 expect(generateTree([]), equals("")); | |
14 }); | |
15 | |
16 test('up to ten files in one directory are shown', () { | |
17 var files = [ | |
18 "dir/a.dart", | |
19 "dir/b.dart", | |
20 "dir/c.dart", | |
21 "dir/d.dart", | |
22 "dir/e.dart", | |
23 "dir/f.dart", | |
24 "dir/g.dart", | |
25 "dir/h.dart", | |
26 "dir/i.dart", | |
27 "dir/j.dart" | |
28 ]; | |
29 expect(generateTree(files), equals(""" | |
30 '-- dir | |
31 |-- a.dart | |
32 |-- b.dart | |
33 |-- c.dart | |
34 |-- d.dart | |
35 |-- e.dart | |
36 |-- f.dart | |
37 |-- g.dart | |
38 |-- h.dart | |
39 |-- i.dart | |
40 '-- j.dart | |
41 """)); | |
42 }); | |
43 | |
44 test('files are elided if there are more than ten', () { | |
45 var files = [ | |
46 "dir/a.dart", | |
47 "dir/b.dart", | |
48 "dir/c.dart", | |
49 "dir/d.dart", | |
50 "dir/e.dart", | |
51 "dir/f.dart", | |
52 "dir/g.dart", | |
53 "dir/h.dart", | |
54 "dir/i.dart", | |
55 "dir/j.dart", | |
56 "dir/k.dart" | |
57 ]; | |
58 expect(generateTree(files), equals(""" | |
59 '-- dir | |
60 |-- a.dart | |
61 |-- b.dart | |
62 |-- c.dart | |
63 | (5 more...) | |
64 |-- i.dart | |
65 |-- j.dart | |
66 '-- k.dart | |
67 """)); | |
68 }); | |
69 | |
70 test('files are not elided at the top level', () { | |
71 var files = [ | |
72 "a.dart", | |
73 "b.dart", | |
74 "c.dart", | |
75 "d.dart", | |
76 "e.dart", | |
77 "f.dart", | |
78 "g.dart", | |
79 "h.dart", | |
80 "i.dart", | |
81 "j.dart", | |
82 "k.dart" | |
83 ]; | |
84 expect(generateTree(files), equals(""" | |
85 |-- a.dart | |
86 |-- b.dart | |
87 |-- c.dart | |
88 |-- d.dart | |
89 |-- e.dart | |
90 |-- f.dart | |
91 |-- g.dart | |
92 |-- h.dart | |
93 |-- i.dart | |
94 |-- j.dart | |
95 '-- k.dart | |
96 """)); | |
97 }); | |
98 | |
99 test('a complex example', () { | |
100 var files = [ | |
101 "TODO", | |
102 "example/console_example.dart", | |
103 "example/main.dart", | |
104 "example/web copy/web_example.dart", | |
105 "test/absolute_test.dart", | |
106 "test/basename_test.dart", | |
107 "test/dirname_test.dart", | |
108 "test/extension_test.dart", | |
109 "test/is_absolute_test.dart", | |
110 "test/is_relative_test.dart", | |
111 "test/join_test.dart", | |
112 "test/normalize_test.dart", | |
113 "test/relative_test.dart", | |
114 "test/split_test.dart", | |
115 ".gitignore", | |
116 "README.md", | |
117 "lib/path.dart", | |
118 "pubspec.yaml", | |
119 "test/all_test.dart", | |
120 "test/path_posix_test.dart", | |
121 "test/path_windows_test.dart" | |
122 ]; | |
123 | |
124 expect(generateTree(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 } | |
OLD | NEW |