2021-11-11 13:54:42 +00:00
|
|
|
"tests for libs"
|
|
|
|
|
2022-03-31 04:04:14 +00:00
|
|
|
load("@bazel_skylib//:bzl_library.bzl", "bzl_library")
|
2021-11-11 13:54:42 +00:00
|
|
|
load("@bazel_skylib//rules:write_file.bzl", "write_file")
|
2023-10-05 19:33:13 +00:00
|
|
|
load("//lib:expand_template.bzl", "expand_template")
|
2022-08-05 00:53:22 +00:00
|
|
|
load("//lib:testing.bzl", "assert_contains")
|
2023-09-29 21:42:33 +00:00
|
|
|
load(":base64_tests.bzl", "base64_test_suite")
|
2021-11-08 15:22:47 +00:00
|
|
|
load(":expand_make_vars_test.bzl", "expand_make_vars_test_suite")
|
2022-07-28 01:48:02 +00:00
|
|
|
load(":glob_match_test.bzl", "glob_match_test_suite")
|
2023-09-21 17:12:47 +00:00
|
|
|
load(":lists_test.bzl", "lists_test_suite")
|
2023-09-29 21:42:33 +00:00
|
|
|
load(":paths_test.bzl", "paths_test_suite")
|
|
|
|
load(":strings_tests.bzl", "strings_test_suite")
|
|
|
|
load(":utils_test.bzl", "utils_test_suite")
|
2021-11-08 15:22:47 +00:00
|
|
|
|
2023-01-06 18:29:45 +00:00
|
|
|
config_setting(
|
|
|
|
name = "experimental_allow_unresolved_symlinks",
|
|
|
|
values = {"experimental_allow_unresolved_symlinks": "true"},
|
|
|
|
visibility = ["//visibility:public"],
|
|
|
|
)
|
|
|
|
|
2021-11-09 23:13:30 +00:00
|
|
|
expand_make_vars_test_suite()
|
|
|
|
|
|
|
|
paths_test_suite()
|
|
|
|
|
|
|
|
utils_test_suite()
|
2021-11-11 13:54:42 +00:00
|
|
|
|
2022-07-28 01:48:02 +00:00
|
|
|
glob_match_test_suite()
|
|
|
|
|
2022-11-26 01:00:02 +00:00
|
|
|
base64_test_suite()
|
|
|
|
|
2023-05-15 19:15:55 +00:00
|
|
|
strings_test_suite()
|
|
|
|
|
2023-09-21 17:12:47 +00:00
|
|
|
lists_test_suite()
|
|
|
|
|
2021-11-11 13:54:42 +00:00
|
|
|
write_file(
|
|
|
|
name = "gen_template",
|
|
|
|
out = "template.txt",
|
|
|
|
content = [
|
2022-12-03 07:23:57 +00:00
|
|
|
"#!/usr/bin/env bash",
|
|
|
|
"set -o errexit -o nounset -o pipefail",
|
2021-11-11 13:54:42 +00:00
|
|
|
"""[ "{thing}" == "stuff" ]""",
|
2022-08-12 02:30:45 +00:00
|
|
|
"""[ "%path%" == "{BINDIR}/lib/tests/template.txt" ]""",
|
2021-11-11 13:54:42 +00:00
|
|
|
],
|
|
|
|
)
|
|
|
|
|
|
|
|
expand_template(
|
|
|
|
name = "expand_template",
|
|
|
|
out = "expand_template_test.sh",
|
|
|
|
data = [":gen_template"],
|
|
|
|
is_executable = True,
|
|
|
|
substitutions = {
|
|
|
|
"{thing}": "stuff",
|
|
|
|
"%path%": "$(execpath :gen_template)",
|
2022-08-12 02:30:45 +00:00
|
|
|
"{BINDIR}": "$(BINDIR)",
|
2021-11-11 13:54:42 +00:00
|
|
|
},
|
|
|
|
template = "template.txt",
|
|
|
|
)
|
|
|
|
|
|
|
|
sh_test(
|
|
|
|
name = "expand_template_test",
|
2022-08-20 19:53:12 +00:00
|
|
|
timeout = "short",
|
2021-11-11 13:54:42 +00:00
|
|
|
srcs = ["expand_template"],
|
|
|
|
)
|
2022-03-31 04:04:14 +00:00
|
|
|
|
2022-08-05 00:53:22 +00:00
|
|
|
assert_contains(
|
|
|
|
name = "expand_template_contains",
|
|
|
|
actual = "expand_template_test.sh",
|
|
|
|
expected = "stuff",
|
|
|
|
)
|
|
|
|
|
2022-03-31 04:04:14 +00:00
|
|
|
bzl_library(
|
|
|
|
name = "generate_outputs",
|
|
|
|
srcs = ["generate_outputs.bzl"],
|
|
|
|
visibility = ["//visibility:public"],
|
|
|
|
)
|