Skip to content

Commit

Permalink
Merge pull request #203733 from Homebrew/heksa-test
Browse files Browse the repository at this point in the history
heksa: update test
  • Loading branch information
chenrui333 authored Jan 15, 2025
2 parents 1c2bf37 + 7a18388 commit bc6c558
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions Formula/h/heksa.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,11 @@ def install
test do
require "pty"

r, _w, pid = PTY.spawn("#{bin}/heksa -l 16 -f asc -o no #{test_fixtures("test.png")}")

# remove ANSI colors
begin
output = r.read.gsub(/\e\[([;\d]+)?m/, "")
PTY.spawn("#{bin}/heksa -l 16 -f asc -o no #{test_fixtures("test.png")}") do |r, _w, pid|
output = r.readline.gsub(/\e\[([;\d]+)?m/, "")
assert_match(/^.PNG/, output)
rescue Errno::EIO
# GNU/Linux raises EIO when read is done on closed pty
ensure
Process.wait pid
end

Process.wait(pid)
assert_equal 0, $CHILD_STATUS.exitstatus
end
end

0 comments on commit bc6c558

Please sign in to comment.