Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Cristian Le <[email protected]>
- Loading branch information
Showing
1 changed file
with
39 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
class Beakerlib < Formula | ||
desc "Shell-level integration testing library" | ||
homepage "https://github.com/beakerlib/beakerlib" | ||
url "https://github.com/beakerlib/beakerlib/archive/refs/tags/1.30.tar.gz" | ||
sha256 "bd06fc61b32d9caf4324587706a8363e37e771355da8297d0c5ba0023ae31098" | ||
license "GPL-2.0-only" | ||
|
||
uses_from_macos "gnu-getopt", since: :ventura | ||
on_macos do | ||
# Fix `readlink` | ||
depends_on "coreutils" | ||
end | ||
|
||
def install | ||
Check failure on line 14 in Formula/b/beakerlib.rb GitHub Actions / macOS 14-arm64`brew install --verbose --build-bottle beakerlib` failed on macOS Sonoma (14) on Apple Silicon!
Check failure on line 14 in Formula/b/beakerlib.rb GitHub Actions / macOS 13-arm64`brew install --verbose --build-bottle beakerlib` failed on macOS Ventura (13) on Apple Silicon!
|
||
system "make", "DD=#{prefix}", "install" | ||
(prefix.glob "**/*.sh").each do |f| | ||
inreplace f, "readlink", "#{Formula["coreutils"].opt_bin}/greadlink", false if OS.mac? | ||
inreplace f, "getopt", "#{Formula["gnu-getopt"].opt_bin}/getopt", false if OS.mac? | ||
end | ||
end | ||
|
||
test do | ||
(testpath/"test.sh").write <<~EOS | ||
#!/usr/bin/env bash | ||
source #{share}/beakerlib/beakerlib.sh || exit 1 | ||
rlJournalStart | ||
rlPhaseStartTest | ||
rlPass "All works" | ||
rlPhaseEnd | ||
rlJournalEnd | ||
EOS | ||
expected_journal = /\[\s*PASS\s*\]\s*::\s*All works/ | ||
ENV["BEAKERLIB_DIR"] = testpath | ||
system "bash", "#{testpath}/test.sh" | ||
assert_match expected_journal, File.read(testpath/"journal.txt") | ||
assert_match "TESTRESULT_STATE=complete", File.read(testpath/"TestResults") | ||
assert_match "TESTRESULT_RESULT_STRING=PASS", File.read(testpath/"TestResults") | ||
end | ||
end |