1 # This Source Code Form is subject to the terms of the Mozilla Public
2 # License, v. 2.0. If a copy of the MPL was not distributed with this
3 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
7 from mozbuild
.vendor
.vendor_manifest
import list_of_paths_to_readable_string
10 def test_list_of_paths_to_readable_string():
11 paths
= ["/tmp/a", "/tmp/b"]
12 s
= list_of_paths_to_readable_string(paths
)
13 assert not s
.endswith(", ]")
14 assert s
.endswith("]")
18 paths
= ["/tmp/a", "/tmp/b", "/tmp/c", "/tmp/d"]
19 s
= list_of_paths_to_readable_string(paths
)
20 assert not s
.endswith(", ")
21 assert s
.endswith("]")
22 assert "/tmp/a" not in s
23 assert "/tmp/b" not in s
24 assert "4 items in /tmp" in s
38 s
= list_of_paths_to_readable_string(paths
)
39 assert not s
.endswith(", ")
40 assert s
.endswith("]")
41 assert "/tmp/a" not in s
43 assert "/tmp/b" not in s
44 assert "10 (omitted) items in /tmp" in s
46 paths
= ["/tmp", "/foo"]
47 s
= list_of_paths_to_readable_string(paths
)
48 assert not s
.endswith(", ")
49 assert s
.endswith("]")
65 paths
.extend(["/foo/w", "/foo/x", "/foo/y", "/foo/z"])
66 paths
.extend(["/bar/m", "/bar/n"])
67 paths
.extend(["/etc"])
68 s
= list_of_paths_to_readable_string(paths
)
69 assert not s
.endswith(", ")
70 assert s
.endswith("]")
71 assert "/tmp/a" not in s
73 assert "/tmp/b" not in s
74 assert "10 (omitted) items in /tmp" in s
76 assert "/foo/w" not in s
77 assert "/foo/x" not in s
78 assert "4 items in /foo" in s
86 assert len(s
) < len(str(paths
))
89 if __name__
== "__main__":