22
33load ("@bazel_skylib//lib:unittest.bzl" , "asserts" , "unittest" )
44load ("//rust/platform:triple.bzl" , "triple" )
5- load ("//rust/platform:triple_mappings.bzl" , "SUPPORTED_PLATFORM_TRIPLES" )
5+ load ("//rust/platform:triple_mappings.bzl" , "SUPPORTED_PLATFORM_TRIPLES" , "system_to_staticlib_ext" )
66
77def _construct_platform_triple_test_impl (ctx ):
88 env = unittest .begin (ctx )
@@ -152,10 +152,24 @@ def _construct_known_triples_test_impl(ctx):
152152
153153 return unittest .end (env )
154154
155+ def _wasm_staticlib_ext_test_impl (ctx ):
156+ env = unittest .begin (ctx )
157+
158+ for system in ["threads" , "unknown" , "wasi" , "wasip1" , "wasip2" ]:
159+ asserts .equals (
160+ env ,
161+ ".a" ,
162+ system_to_staticlib_ext (system ),
163+ "{} should use a static archive extension" .format (system ),
164+ )
165+
166+ return unittest .end (env )
167+
155168construct_platform_triple_test = unittest .make (_construct_platform_triple_test_impl )
156169construct_minimal_platform_triple_test = unittest .make (_construct_minimal_platform_triple_test_impl )
157170supported_platform_triples_test = unittest .make (_supported_platform_triples_test_impl )
158171construct_known_triples_test = unittest .make (_construct_known_triples_test_impl )
172+ wasm_staticlib_ext_test = unittest .make (_wasm_staticlib_ext_test_impl )
159173
160174def platform_triple_test_suite (name , ** kwargs ):
161175 """Define a test suite for testing the `triple` constructor
@@ -176,6 +190,9 @@ def platform_triple_test_suite(name, **kwargs):
176190 construct_known_triples_test (
177191 name = "construct_known_triples_test" ,
178192 )
193+ wasm_staticlib_ext_test (
194+ name = "wasm_staticlib_ext_test" ,
195+ )
179196
180197 native .test_suite (
181198 name = name ,
@@ -184,6 +201,7 @@ def platform_triple_test_suite(name, **kwargs):
184201 ":construct_minimal_platform_triple_test" ,
185202 ":supported_platform_triples_test" ,
186203 ":construct_known_triples_test" ,
204+ ":wasm_staticlib_ext_test" ,
187205 ],
188206 ** kwargs
189207 )
0 commit comments