aboutsummaryrefslogtreecommitdiff
path: root/tests/unit_test_tests.bzl
diff options
context:
space:
mode:
Diffstat (limited to 'tests/unit_test_tests.bzl')
-rw-r--r--tests/unit_test_tests.bzl28
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/unit_test_tests.bzl b/tests/unit_test_tests.bzl
new file mode 100644
index 0000000..97ec99c
--- /dev/null
+++ b/tests/unit_test_tests.bzl
@@ -0,0 +1,28 @@
+"""Tests for unit_test."""
+
+load("//lib:unit_test.bzl", "unit_test")
+load("//lib:test_suite.bzl", "test_suite")
+
+def _test_basic(env):
+ _ = env # @unused
+
+def _test_with_setup(name):
+ unit_test(
+ name = name,
+ impl = _test_with_setup_impl,
+ attrs = {"custom_attr": attr.string(default = "default")},
+ )
+
+def _test_with_setup_impl(env):
+ env.expect.that_str(env.ctx.attr.custom_attr).equals("default")
+
+def unit_test_test_suite(name):
+ test_suite(
+ name = name,
+ tests = [
+ _test_with_setup,
+ ],
+ basic_tests = [
+ _test_basic,
+ ],
+ )