@@ -65,5 +65,76 @@ def test_verify_ignores_in_subdir(ctx):
6565t0_test = unittest .make (test_verify_ignores_in_root )
6666t1_test = unittest .make (test_verify_ignores_in_subdir )
6767
68+ # buildifier: disable=function-docstring
69+ def test_verify_gather_package_content_works_with_simple_name (ctx ):
70+ env = unittest .begin (ctx )
71+ actual = helpers_testonly .gather_package_content_excludes (
72+ {
73+ "packageA" : ["pattern1" , "pattern2" ],
74+ },
75+ "packageA" ,
76+ )
77+ expected = ["pattern1" , "pattern2" ]
78+ asserts .equals (env , expected , actual )
79+ return unittest .end (env )
80+
81+ # buildifier: disable=function-docstring
82+ def test_verify_gather_package_content_works_with_star_pattern (ctx ):
83+ env = unittest .begin (ctx )
84+ actual = helpers_testonly .gather_package_content_excludes (
85+ {
86+ "*" : ["pattern1" , "pattern2" ],
87+ },
88+ "packageA" ,
89+ )
90+ expected = ["pattern1" , "pattern2" ]
91+ asserts .equals (env , expected , actual )
92+ return unittest .end (env )
93+
94+ # buildifier: disable=function-docstring
95+ def test_verify_gather_package_content_works_with_simple_name_and_single_pattern (ctx ):
96+ env = unittest .begin (ctx )
97+ actual = helpers_testonly .gather_package_content_excludes (
98+ {
99+ "packageA" : "pattern1" ,
100+ },
101+ "packageA" ,
102+ )
103+ expected = ["pattern1" ]
104+ asserts .equals (env , expected , actual )
105+ return unittest .end (env )
106+
107+ # buildifier: disable=function-docstring
108+ def test_verify_gather_package_content_works_with_star_pattern_and_only_one_exclude_pattern (ctx ):
109+ env = unittest .begin (ctx )
110+ actual = helpers_testonly .gather_package_content_excludes (
111+ {
112+ "*" : "pattern1" ,
113+ },
114+ "packageA" ,
115+ )
116+ expected = ["pattern1" ]
117+ asserts .equals (env , expected , actual )
118+ return unittest .end (env )
119+
120+ # buildifier: disable=function-docstring
121+ def test_verify_gather_package_content_returns_none_when_no_matches (ctx ):
122+ env = unittest .begin (ctx )
123+ actual = helpers_testonly .gather_package_content_excludes (
124+ {
125+ "packageB" : "pattern1" ,
126+ },
127+ "packageA" ,
128+ )
129+ expected = None
130+ asserts .equals (env , expected , actual )
131+ return unittest .end (env )
132+
133+ t2_test = unittest .make (test_verify_gather_package_content_works_with_simple_name )
134+ t3_test = unittest .make (test_verify_gather_package_content_works_with_star_pattern )
135+ t4_test = unittest .make (test_verify_gather_package_content_works_with_simple_name_and_single_pattern )
136+ t5_test = unittest .make (test_verify_gather_package_content_works_with_star_pattern_and_only_one_exclude_pattern )
137+ t6_test = unittest .make (test_verify_gather_package_content_returns_none_when_no_matches )
138+
68139def translate_lock_helpers_tests (name ):
69- unittest .suite (name , t0_test , t1_test )
140+ unittest .suite (name , t0_test , t1_test , t2_test , t3_test , t4_test , t5_test , t6_test )
0 commit comments