Bug 1874684 - Part 28: Return DateDuration from DifferenceISODateTime. r=mgaudet
[gecko.git] / python / mozbuild / mozbuild / test / test_vendor_tools.py
blob271be6d7dace2ba871b347b7648bb52a0acdf542
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/.
5 import mozunit
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("]")
15 assert "/tmp/a" in s
16 assert "/tmp/b" in s
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
26 paths = [
27 "/tmp/a",
28 "/tmp/b",
29 "/tmp/c",
30 "/tmp/d",
31 "/tmp/d",
32 "/tmp/d",
33 "/tmp/d",
34 "/tmp/d",
35 "/tmp/d",
36 "/tmp/d",
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
42 assert " 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("]")
50 assert "/tmp" in s
51 assert "/foo" in s
53 paths = [
54 "/tmp/a",
55 "/tmp/b",
56 "/tmp/c",
57 "/tmp/d",
58 "/tmp/d",
59 "/tmp/d",
60 "/tmp/d",
61 "/tmp/d",
62 "/tmp/d",
63 "/tmp/d",
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
72 assert " d" 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
79 assert " w" in s
81 assert "/bar/m" in s
82 assert "/bar/n" in s
84 assert "/etc" in s
86 assert len(s) < len(str(paths))
89 if __name__ == "__main__":
90 mozunit.main()