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.29.3.tar.gz" | ||
sha256 "f792b86bac8be1a4593dd096c32c1a061102c802c6f5760259a5753b13f6caa1" | ||
license "GPL-2.0-only" | ||
|
||
on_macos do | ||
# Fix `readlink` | ||
depends_on "coreutils" | ||
depends_on "gnu-getopt" | ||
end | ||
|
||
def install | ||
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 | ||
Check failure on line 22 in Formula/b/beakerlib.rb GitHub Actions / Linux`brew test --verbose beakerlib` failed on Linux!
|
||
(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 |