OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 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 | 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. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 library lock_file_test; | 5 library lock_file_test; |
6 | 6 |
7 import 'package:unittest/unittest.dart'; | 7 import 'package:unittest/unittest.dart'; |
8 | 8 |
9 import '../lib/src/ascii_tree.dart' as tree; | 9 import '../lib/src/ascii_tree.dart' as tree; |
10 import '../lib/src/utils.dart'; | 10 import '../lib/src/utils.dart'; |
11 | 11 |
12 main() { | 12 main() { |
13 runningAsTest = true; | 13 runningAsTest = true; |
14 | 14 |
15 group('tree.fromFiles', () { | 15 group('tree.fromFiles', () { |
16 test('no files', () { | 16 test('no files', () { |
17 expect(tree.fromFiles([]), equals("")); | 17 expect(tree.fromFiles([]), equals("")); |
18 }); | 18 }); |
19 | 19 |
20 test('up to ten files in one directory are shown', () { | 20 test('up to ten files in one directory are shown', () { |
21 var files = [ | 21 var files = [ |
22 "dir/a.dart", | 22 "dir/a.dart", |
23 "dir/b.dart", | 23 "dir/b.dart", |
24 "dir/c.dart", | 24 "dir/c.dart", |
25 "dir/d.dart", | 25 "dir/d.dart", |
26 "dir/e.dart", | 26 "dir/e.dart", |
27 "dir/f.dart", | 27 "dir/f.dart", |
28 "dir/g.dart", | 28 "dir/g.dart", |
29 "dir/h.dart", | 29 "dir/h.dart", |
30 "dir/i.dart", | 30 "dir/i.dart", |
31 "dir/j.dart" | 31 "dir/j.dart"]; |
32 ]; | |
33 expect(tree.fromFiles(files), equals(""" | 32 expect(tree.fromFiles(files), equals(""" |
34 '-- dir | 33 '-- dir |
35 |-- a.dart | 34 |-- a.dart |
36 |-- b.dart | 35 |-- b.dart |
37 |-- c.dart | 36 |-- c.dart |
38 |-- d.dart | 37 |-- d.dart |
39 |-- e.dart | 38 |-- e.dart |
40 |-- f.dart | 39 |-- f.dart |
41 |-- g.dart | 40 |-- g.dart |
42 |-- h.dart | 41 |-- h.dart |
43 |-- i.dart | 42 |-- i.dart |
44 '-- j.dart | 43 '-- j.dart |
45 """)); | 44 """)); |
46 }); | 45 }); |
47 | 46 |
48 test('files are elided if there are more than ten', () { | 47 test('files are elided if there are more than ten', () { |
49 var files = [ | 48 var files = [ |
50 "dir/a.dart", | 49 "dir/a.dart", |
51 "dir/b.dart", | 50 "dir/b.dart", |
52 "dir/c.dart", | 51 "dir/c.dart", |
53 "dir/d.dart", | 52 "dir/d.dart", |
54 "dir/e.dart", | 53 "dir/e.dart", |
55 "dir/f.dart", | 54 "dir/f.dart", |
56 "dir/g.dart", | 55 "dir/g.dart", |
57 "dir/h.dart", | 56 "dir/h.dart", |
58 "dir/i.dart", | 57 "dir/i.dart", |
59 "dir/j.dart", | 58 "dir/j.dart", |
60 "dir/k.dart" | 59 "dir/k.dart"]; |
61 ]; | |
62 expect(tree.fromFiles(files), equals(""" | 60 expect(tree.fromFiles(files), equals(""" |
63 '-- dir | 61 '-- dir |
64 |-- a.dart | 62 |-- a.dart |
65 |-- b.dart | 63 |-- b.dart |
66 |-- c.dart | 64 |-- c.dart |
67 | (5 more...) | 65 | (5 more...) |
68 |-- i.dart | 66 |-- i.dart |
69 |-- j.dart | 67 |-- j.dart |
70 '-- k.dart | 68 '-- k.dart |
71 """)); | 69 """)); |
72 }); | 70 }); |
73 | 71 |
74 test('files are not elided at the top level', () { | 72 test('files are not elided at the top level', () { |
75 var files = [ | 73 var files = [ |
76 "a.dart", | 74 "a.dart", |
77 "b.dart", | 75 "b.dart", |
78 "c.dart", | 76 "c.dart", |
79 "d.dart", | 77 "d.dart", |
80 "e.dart", | 78 "e.dart", |
81 "f.dart", | 79 "f.dart", |
82 "g.dart", | 80 "g.dart", |
83 "h.dart", | 81 "h.dart", |
84 "i.dart", | 82 "i.dart", |
85 "j.dart", | 83 "j.dart", |
86 "k.dart" | 84 "k.dart"]; |
87 ]; | |
88 expect(tree.fromFiles(files), equals(""" | 85 expect(tree.fromFiles(files), equals(""" |
89 |-- a.dart | 86 |-- a.dart |
90 |-- b.dart | 87 |-- b.dart |
91 |-- c.dart | 88 |-- c.dart |
92 |-- d.dart | 89 |-- d.dart |
93 |-- e.dart | 90 |-- e.dart |
94 |-- f.dart | 91 |-- f.dart |
95 |-- g.dart | 92 |-- g.dart |
96 |-- h.dart | 93 |-- h.dart |
97 |-- i.dart | 94 |-- i.dart |
98 |-- j.dart | 95 |-- j.dart |
99 '-- k.dart | 96 '-- k.dart |
100 """)); | 97 """)); |
101 }); | 98 }); |
102 | 99 |
103 test('a complex example', () { | 100 test('a complex example', () { |
104 var files = [ | 101 var files = [ |
105 "TODO", | 102 "TODO", |
106 "example/console_example.dart", | 103 "example/console_example.dart", |
107 "example/main.dart", | 104 "example/main.dart", |
108 "example/web copy/web_example.dart", | 105 "example/web copy/web_example.dart", |
109 "test/absolute_test.dart", | 106 "test/absolute_test.dart", |
110 "test/basename_test.dart", | 107 "test/basename_test.dart", |
111 "test/dirname_test.dart", | 108 "test/dirname_test.dart", |
112 "test/extension_test.dart", | 109 "test/extension_test.dart", |
113 "test/is_absolute_test.dart", | 110 "test/is_absolute_test.dart", |
114 "test/is_relative_test.dart", | 111 "test/is_relative_test.dart", |
115 "test/join_test.dart", | 112 "test/join_test.dart", |
116 "test/normalize_test.dart", | 113 "test/normalize_test.dart", |
117 "test/relative_test.dart", | 114 "test/relative_test.dart", |
118 "test/split_test.dart", | 115 "test/split_test.dart", |
119 ".gitignore", | 116 ".gitignore", |
120 "README.md", | 117 "README.md", |
121 "lib/path.dart", | 118 "lib/path.dart", |
122 "pubspec.yaml", | 119 "pubspec.yaml", |
123 "test/all_test.dart", | 120 "test/all_test.dart", |
124 "test/path_posix_test.dart", | 121 "test/path_posix_test.dart", |
125 "test/path_windows_test.dart" | 122 "test/path_windows_test.dart"]; |
126 ]; | |
127 | 123 |
128 expect(tree.fromFiles(files), equals(""" | 124 expect(tree.fromFiles(files), equals(""" |
129 |-- .gitignore | 125 |-- .gitignore |
130 |-- README.md | 126 |-- README.md |
131 |-- TODO | 127 |-- TODO |
132 |-- example | 128 |-- example |
133 | |-- console_example.dart | 129 | |-- console_example.dart |
134 | |-- main.dart | 130 | |-- main.dart |
135 | '-- web copy | 131 | '-- web copy |
136 | '-- web_example.dart | 132 | '-- web_example.dart |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
239 |-- g.dart | 235 |-- g.dart |
240 |-- h.dart | 236 |-- h.dart |
241 |-- i.dart | 237 |-- i.dart |
242 |-- j.dart | 238 |-- j.dart |
243 |-- k.dart | 239 |-- k.dart |
244 '-- l.dart | 240 '-- l.dart |
245 """)); | 241 """)); |
246 }); | 242 }); |
247 | 243 |
248 } | 244 } |
OLD | NEW |