2
0
Fork 0
mirror of https://github.com/bazel-contrib/bazel-lib synced 2024-11-26 13:30:30 +00:00
bazel-lib/lib/tests/BUILD.bazel
2022-03-30 21:04:14 -07:00

50 lines
1.1 KiB
Python

"tests for libs"
load("@bazel_skylib//:bzl_library.bzl", "bzl_library")
load("@bazel_skylib//rules:write_file.bzl", "write_file")
load("//lib:expand_make_vars.bzl", "expand_template")
load(":expand_make_vars_test.bzl", "expand_make_vars_test_suite")
load(":utils_test.bzl", "utils_test_suite")
load(":paths_test.bzl", "paths_test_suite")
expand_make_vars_test_suite()
paths_test_suite()
utils_test_suite()
write_file(
name = "gen_template",
out = "template.txt",
content = [
"#!/bin/bash",
"set -o errexit",
"""[ "{thing}" == "stuff" ]""",
"""[ "%path%" == "BINDIR/lib/tests/template.txt" ]""",
],
)
expand_template(
name = "expand_template",
out = "expand_template_test.sh",
data = [":gen_template"],
is_executable = True,
substitutions = {
"{thing}": "stuff",
"%path%": "$(execpath :gen_template)",
"BINDIR": "$(BINDIR)",
},
template = "template.txt",
)
sh_test(
name = "expand_template_test",
srcs = ["expand_template"],
)
bzl_library(
name = "generate_outputs",
srcs = ["generate_outputs.bzl"],
visibility = ["//visibility:public"],
)