From aa218815cd52af409d87f5f59fd60b51903652e7 Mon Sep 17 00:00:00 2001 From: Daniel Wagner-Hall Date: Tue, 2 Jan 2024 15:41:27 +0000 Subject: [PATCH] Remove tests for invalid crate names Lovely and thorough though these tests are, they cause `bazel cquery ...` not work in the repo. Fixes #2359 --- test/unit/crate_name/crate_name_test.bzl | 47 +----------------------- 1 file changed, 1 insertion(+), 46 deletions(-) diff --git a/test/unit/crate_name/crate_name_test.bzl b/test/unit/crate_name/crate_name_test.bzl index 8671951211..e960e89c53 100644 --- a/test/unit/crate_name/crate_name_test.bzl +++ b/test/unit/crate_name/crate_name_test.bzl @@ -1,6 +1,6 @@ """Unit tests for crate names.""" -load("@bazel_skylib//lib:unittest.bzl", "analysistest", "asserts") +load("@bazel_skylib//lib:unittest.bzl", "analysistest") load("//rust:defs.bzl", "rust_binary", "rust_library", "rust_shared_library", "rust_static_library", "rust_test") load("//test/unit:common.bzl", "assert_argv_contains", "assert_argv_contains_prefix_not") @@ -46,16 +46,6 @@ def _custom_crate_name_test_test_impl(ctx): assert_argv_contains(env, tut.actions[0], "--crate-name=custom_name") return analysistest.end(env) -def _invalid_default_crate_name_test_impl(ctx): - env = analysistest.begin(ctx) - asserts.expect_failure(env, "contains invalid character(s): @") - return analysistest.end(env) - -def _invalid_custom_crate_name_test_impl(ctx): - env = analysistest.begin(ctx) - asserts.expect_failure(env, "contains invalid character(s): -") - return analysistest.end(env) - def _slib_library_name_test_impl(ctx): """Regression test for extra-filename. @@ -102,14 +92,6 @@ default_crate_name_test_test = analysistest.make( custom_crate_name_test_test = analysistest.make( _custom_crate_name_test_test_impl, ) -invalid_default_crate_name_test = analysistest.make( - _invalid_default_crate_name_test_impl, - expect_failure = True, -) -invalid_custom_crate_name_test = analysistest.make( - _invalid_custom_crate_name_test_impl, - expect_failure = True, -) slib_library_name_test = analysistest.make( _slib_library_name_test_impl, ) @@ -157,21 +139,6 @@ def _crate_name_test(): edition = "2018", ) - rust_library( - name = "invalid@default-crate-name", - srcs = ["lib.rs"], - edition = "2018", - tags = ["manual", "norustfmt"], - ) - - rust_library( - name = "invalid-custom-crate-name", - crate_name = "hyphens-not-allowed", - srcs = ["lib.rs"], - edition = "2018", - tags = ["manual", "norustfmt"], - ) - rust_library( name = "slib", srcs = ["slib.rs"], @@ -225,16 +192,6 @@ def _crate_name_test(): target_under_test = ":custom-crate-name-test", ) - invalid_default_crate_name_test( - name = "invalid_default_crate_name_test", - target_under_test = ":invalid@default-crate-name", - ) - - invalid_custom_crate_name_test( - name = "invalid_custom_crate_name_test", - target_under_test = ":invalid-custom-crate-name", - ) - no_extra_filename_test( name = "no_extra_filename_for_shared_library_test", target_under_test = ":shared_lib", @@ -263,7 +220,5 @@ def crate_name_test_suite(name): ":custom_crate_name_binary_test", ":default_crate_name_test_test", ":custom_crate_name_test_test", - ":invalid_default_crate_name_test", - ":invalid_custom_crate_name_test", ], )