homebrew-core/Formula/bats-core.rb

32 lines
828 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.7.0.tar.gz"
sha256 "ac70c2a153f108b1ac549c2eaa4154dea4a7c1cc421e3352f0ce6ea49435454e"
license "MIT"
bottle do
sha256 cellar: :any_skip_relocation, all: "ca25618be85dfc2f86c31b7b6ea084a3d3108badcfbd28e036613958aa9094b6"
end
depends_on "coreutils"
uses_from_macos "bc" => :test
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