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 '../../../pkg/unittest/lib/unittest.dart'; | 7 import '../../../pkg/unittest/lib/unittest.dart'; |
8 import '../../pub/directory_tree.dart'; | 8 import '../../pub/directory_tree.dart'; |
9 | 9 |
10 main() { | 10 main() { |
11 test('no files', () { | 11 test('no files', () { |
12 expect(generateTree([]), equals("")); | 12 expect(generateTree([]), equals("")); |
13 }); | 13 }); |
14 | 14 |
15 test('up to ten files in one directory are shown', () { | 15 test('up to ten files in one directory are shown', () { |
16 var files = [ | 16 var files = [ |
17 "a.dart", | 17 "dir/a.dart", |
18 "b.dart", | 18 "dir/b.dart", |
19 "c.dart", | 19 "dir/c.dart", |
20 "d.dart", | 20 "dir/d.dart", |
21 "e.dart", | 21 "dir/e.dart", |
22 "f.dart", | 22 "dir/f.dart", |
23 "g.dart", | 23 "dir/g.dart", |
24 "h.dart", | 24 "dir/h.dart", |
25 "i.dart", | 25 "dir/i.dart", |
26 "j.dart" | 26 "dir/j.dart" |
27 ]; | 27 ]; |
28 expect(generateTree(files), equals(""" | 28 expect(generateTree(files), equals(""" |
29 |-- a.dart | 29 '-- dir |
30 |-- b.dart | 30 |-- a.dart |
31 |-- c.dart | 31 |-- b.dart |
32 |-- d.dart | 32 |-- c.dart |
33 |-- e.dart | 33 |-- d.dart |
34 |-- f.dart | 34 |-- e.dart |
35 |-- g.dart | 35 |-- f.dart |
36 |-- h.dart | 36 |-- g.dart |
37 |-- i.dart | 37 |-- h.dart |
38 '-- j.dart | 38 |-- i.dart |
| 39 '-- j.dart |
39 """)); | 40 """)); |
40 }); | 41 }); |
41 | 42 |
42 test('files are elided if there are more than ten', () { | 43 test('files are elided if there are more than ten', () { |
43 var files = [ | 44 var files = [ |
| 45 "dir/a.dart", |
| 46 "dir/b.dart", |
| 47 "dir/c.dart", |
| 48 "dir/d.dart", |
| 49 "dir/e.dart", |
| 50 "dir/f.dart", |
| 51 "dir/g.dart", |
| 52 "dir/h.dart", |
| 53 "dir/i.dart", |
| 54 "dir/j.dart", |
| 55 "dir/k.dart" |
| 56 ]; |
| 57 expect(generateTree(files), equals(""" |
| 58 '-- dir |
| 59 |-- a.dart |
| 60 |-- b.dart |
| 61 |-- c.dart |
| 62 | (5 more...) |
| 63 |-- i.dart |
| 64 |-- j.dart |
| 65 '-- k.dart |
| 66 """)); |
| 67 }); |
| 68 |
| 69 test('files are not elided at the top level', () { |
| 70 var files = [ |
44 "a.dart", | 71 "a.dart", |
45 "b.dart", | 72 "b.dart", |
46 "c.dart", | 73 "c.dart", |
47 "d.dart", | 74 "d.dart", |
48 "e.dart", | 75 "e.dart", |
49 "f.dart", | 76 "f.dart", |
50 "g.dart", | 77 "g.dart", |
51 "h.dart", | 78 "h.dart", |
52 "i.dart", | 79 "i.dart", |
53 "j.dart", | 80 "j.dart", |
54 "k.dart" | 81 "k.dart" |
55 ]; | 82 ]; |
56 expect(generateTree(files), equals(""" | 83 expect(generateTree(files), equals(""" |
57 |-- a.dart | 84 |-- a.dart |
58 |-- b.dart | 85 |-- b.dart |
59 |-- c.dart | 86 |-- c.dart |
60 | (5 more...) | 87 |-- d.dart |
| 88 |-- e.dart |
| 89 |-- f.dart |
| 90 |-- g.dart |
| 91 |-- h.dart |
61 |-- i.dart | 92 |-- i.dart |
62 |-- j.dart | 93 |-- j.dart |
63 '-- k.dart | 94 '-- k.dart |
64 """)); | 95 """)); |
65 }); | 96 }); |
66 | 97 |
67 test('a complex example', () { | 98 test('a complex example', () { |
68 var files = [ | 99 var files = [ |
69 "TODO", | 100 "TODO", |
70 "example/console_example.dart", | 101 "example/console_example.dart", |
(...skipping 27 matching lines...) Expand all Loading... |
98 | |-- main.dart | 129 | |-- main.dart |
99 | '-- web copy | 130 | '-- web copy |
100 | '-- web_example.dart | 131 | '-- web_example.dart |
101 |-- lib | 132 |-- lib |
102 | '-- path.dart | 133 | '-- path.dart |
103 |-- pubspec.yaml | 134 |-- pubspec.yaml |
104 '-- test | 135 '-- test |
105 |-- absolute_test.dart | 136 |-- absolute_test.dart |
106 |-- all_test.dart | 137 |-- all_test.dart |
107 |-- basename_test.dart | 138 |-- basename_test.dart |
108 | (7 more...) | 139 | (7 more...) |
109 |-- path_windows_test.dart | 140 |-- path_windows_test.dart |
110 |-- relative_test.dart | 141 |-- relative_test.dart |
111 '-- split_test.dart | 142 '-- split_test.dart |
112 """)); | 143 """)); |
113 }); | 144 }); |
114 } | 145 } |
OLD | NEW |