homebrew-core/Formula/bats-core.rb

34 lines
962 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.5.0.tar.gz"
sha256 "36a3fd4413899c0763158ae194329af8f48bb1ff0d1338090b80b3416d5793af"
license "MIT"
bottle do
sha256 cellar: :any_skip_relocation, all: "6911a873446605176d6cfb219b335f1bd073da5be1834290829b062497443420"
end
depends_on "coreutils"
uses_from_macos "bc" => :test
conflicts_with "bats", because: "both install `bats` executables"
def install
system "./install.sh", prefix
# Replace `/usr/local` references for uniform bottles
inreplace lib/"bats-core/formatter.bash", "/usr/local", HOMEBREW_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