diff options
author | nickreid <nickreid@google.com> | 2022-07-29 21:20:20 -0700 |
---|---|---|
committer | Copybara-Service <copybara-worker@google.com> | 2022-07-29 21:20:52 -0700 |
commit | fbb4252b58ae8c87ccb5db0e188526c24bd40e0d (patch) | |
tree | 25541903335fafaf58144f30f89ce8b9985ff7a8 /tests/analysis/jvm_compile_test.bzl | |
parent | 09d89590f3f7e36b2c5d7c7fcfd7791e8bbb17eb (diff) | |
download | bazelbuild-kotlin-rules-fbb4252b58ae8c87ccb5db0e188526c24bd40e0d.tar.gz |
Consolidate all the definitions of _failure_test
PiperOrigin-RevId: 464216490
Diffstat (limited to 'tests/analysis/jvm_compile_test.bzl')
-rw-r--r-- | tests/analysis/jvm_compile_test.bzl | 23 |
1 files changed, 5 insertions, 18 deletions
diff --git a/tests/analysis/jvm_compile_test.bzl b/tests/analysis/jvm_compile_test.bzl index b04a479..936ae27 100644 --- a/tests/analysis/jvm_compile_test.bzl +++ b/tests/analysis/jvm_compile_test.bzl @@ -19,8 +19,8 @@ load("@//kotlin:jvm_compile.bzl", "compile") load("@//tests/analysis:util.bzl", "ONLY_FOR_ANALYSIS_TEST_TAGS", "create_dir", "create_file") load("@//toolchains/kotlin_jvm:java_toolchains.bzl", "java_toolchains") load("@//toolchains/kotlin_jvm:kt_jvm_toolchains.bzl", "kt_jvm_toolchains") -load("@bazel_skylib//lib:unittest.bzl", "analysistest", "asserts") load("@bazel_skylib//rules:build_test.bzl", "build_test") +load(":assert_failure_test.bzl", "assert_failure_test") def _impl(ctx): # As additional capabilites need to be tested, this rule should support @@ -80,19 +80,6 @@ _kt_jvm_compile = rule( toolchains = [kt_jvm_toolchains.type], ) -def _failure_test_impl(ctx): - env = analysistest.begin(ctx) - asserts.expect_failure(env, ctx.attr.expected_failure_msg) - return analysistest.end(env) - -_failure_test = analysistest.make( - _failure_test_impl, - expect_failure = True, - attrs = { - "expected_failure_msg": attr.string(mandatory = True), - }, -) - def _test_kt_jvm_compile_using_kt_jvm_compile_with_r_java(): test_name = "kt_jvm_compile_using_kt_jvm_compile_with_r_java_test" @@ -181,10 +168,10 @@ fun bar(): String = "Bar" tags = ONLY_FOR_ANALYSIS_TEST_TAGS, r_java = ":foo", ) - _failure_test( + assert_failure_test( name = test_name, target_under_test = ":kt_jvm_compile_with_illegal_r_java", - expected_failure_msg = "illegal dependency provided for r_java", + msg_contains = "illegal dependency provided for r_java", ) return test_name @@ -355,10 +342,10 @@ def _test_kt_jvm_compile_unsupported_src_artifacts(): tags = ONLY_FOR_ANALYSIS_TEST_TAGS, ) - _failure_test( + assert_failure_test( name = test_name, target_under_test = test_name + "_unexpected_lib", - expected_failure_msg = "/src.unexpected", + msg_contains = "/src.unexpected", ) return test_name |