From b976148545ab905fa9885c077696f4e12f507ac0 Mon Sep 17 00:00:00 2001 From: Jamison Lahman Date: Fri, 19 Nov 2021 02:07:35 -0800 Subject: [PATCH] load coverage --- tests/BUILD.bazel | 11 +++++++++++ tests/hello_world_load.bats | 9 +++++++++ tests/helper.bash | 5 +++++ 3 files changed, 25 insertions(+) create mode 100644 tests/hello_world_load.bats create mode 100644 tests/helper.bash diff --git a/tests/BUILD.bazel b/tests/BUILD.bazel index b7b0dfa..1f92ab3 100644 --- a/tests/BUILD.bazel +++ b/tests/BUILD.bazel @@ -1,5 +1,16 @@ load("@bazel_bats//:rules.bzl", "bats_test") +sh_library( + name = "helper", + srcs = ["helper.bash"], +) + +bats_test( + name = "hello_world_load_test", + srcs = ["hello_world_load.bats"], + deps = [":helper"], +) + bats_test( name = "hello_world_test", srcs = ["hello_world.bats"], diff --git a/tests/hello_world_load.bats b/tests/hello_world_load.bats new file mode 100644 index 0000000..c806573 --- /dev/null +++ b/tests/hello_world_load.bats @@ -0,0 +1,9 @@ +#!/usr/bin/env bats + +load "helper" + +@test "can run function from loaded library" { + run echo4 + [ $status -eq 0 ] + [ "$output" == "4" ] +} diff --git a/tests/helper.bash b/tests/helper.bash new file mode 100644 index 0000000..9f27a6f --- /dev/null +++ b/tests/helper.bash @@ -0,0 +1,5 @@ +#!/usr/bin/env bash + +function echo4() { + echo "4" +}