homebrew-core/Formula/bats-core.rb

28 lines
683 B
Ruby

class BatsCore < Formula
desc "Bash Automated Testing System"
homepage "https://github.com/bats-core/bats-core"
url "https://github.com/bats-core/bats-core/archive/v1.2.1.tar.gz"
sha256 "91c49b1fe6f0656c46491929ed728f8dfa9a96df0cce294963e8c6082bff87a2"
license "MIT"
bottle :unneeded
depends_on "coreutils"
conflicts_with "bats", because: "both install `bats` executables"
def install
system "./install.sh", prefix
end
test do
(testpath/"test.sh").write <<~EOS
@test "addition using bc" {
result="$(echo 2+2 | bc)"
[ "$result" -eq 4 ]
}
EOS
assert_match "addition", shell_output("#{bin}/bats test.sh")
end
end