Skip to content

Commit

Permalink
Remove tests for invalid crate names (#2387)
Browse files Browse the repository at this point in the history
Lovely and thorough though these tests are, they cause `bazel cquery
...` not work in the repo.

Fixes #2359

Co-authored-by: UebelAndre <[email protected]>
  • Loading branch information
illicitonion and UebelAndre authored Jan 2, 2024
1 parent 72a1818 commit 83a2b50
Showing 1 changed file with 1 addition and 46 deletions.
47 changes: 1 addition & 46 deletions test/unit/crate_name/crate_name_test.bzl
Original file line number Diff line number Diff line change
@@ -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")

Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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,
)
Expand Down Expand Up @@ -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"],
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
],
)

0 comments on commit 83a2b50

Please sign in to comment.