Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

asciiquarium: fix test logic #70297

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 19 additions & 10 deletions Formula/asciiquarium.rb
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
require "language/perl"

class Asciiquarium < Formula
include Language::Perl::Shebang

desc "Aquarium animation in ASCII art"
homepage "https://robobunny.com/projects/asciiquarium/html/"
url "https://robobunny.com/projects/asciiquarium/asciiquarium_1.1.tar.gz"
sha256 "1b08c6613525e75e87546f4e8984ab3b33f1e922080268c749f1777d56c9d361"
license "GPL-2.0"
revision 1
license "GPL-2.0-or-later"
revision 2

livecheck do
url "https://robobunny.com/projects/asciiquarium/"
Expand All @@ -20,11 +24,12 @@ class Asciiquarium < Formula
sha256 cellar: :any_skip_relocation, yosemite: "6b20abf264f40c7123e40f0f34cfc11f0c12a03b1a74a324e3f3a7ae75e94f3f"
end

uses_from_macos "perl"
depends_on "ncurses"
depends_on "perl"

resource "Curses" do
url "https://cpan.metacpan.org/authors/id/G/GI/GIRAFFED/Curses-1.34.tar.gz"
sha256 "808e44d5946be265af5ff0b90f3d0802108e7d1b39b0fe68a4a446fe284d322b"
url "https://cpan.metacpan.org/authors/id/G/GI/GIRAFFED/Curses-1.37.tar.gz"
sha256 "74707ae3ad19b35bbefda2b1d6bd31f57b40cdac8ab872171c8714c88954db20"
end

resource "Term::Animation" do
Expand All @@ -46,7 +51,7 @@ def install
# Disable dynamic selection of perl which may cause segfault when an
# incompatible perl is picked up.
# https://github.com/Homebrew/homebrew-core/issues/4936
inreplace "asciiquarium", "#!/usr/bin/env perl", "#!/usr/bin/perl"
rewrite_shebang detected_perl_shebang, "asciiquarium"

chmod 0755, "asciiquarium"
bin.install "asciiquarium"
Expand All @@ -66,10 +71,14 @@ def install

require "pty"
ENV["TERM"] = "xterm"
PTY.spawn(bin/"asciiquarium") do |stdin, _stdout, pid|
sleep 0.1
Process.kill "TERM", pid
output = stdin.read
PTY.spawn(bin/"asciiquarium") do |stdout, stdin, _pid|
sleep 1
stdin.write "q"
output = begin
stdout.gets
rescue Errno::EIO
nil
end
assert_match "\e[?10", output[0..4]
end
end
Expand Down