Skip to content

Commit

Permalink
dps8m: replace expect dependency with Ruby libs
Browse files Browse the repository at this point in the history
  • Loading branch information
cho-m committed Dec 22, 2024
1 parent e6391ac commit d4885d9
Showing 1 changed file with 17 additions and 28 deletions.
45 changes: 17 additions & 28 deletions Formula/d/dps8m.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,37 26,26 @@ class Dps8m < Formula

depends_on "libuv"

uses_from_macos "expect" => :test

def install
# Reported 23 Jul 2017 "make doesn't create bin directory"
# See https://sourceforge.net/p/dps8m/mailman/message/35960505/
bin.mkpath

system "make"
bin.install %w[src/dps8/dps8 src/punutil/punutil src/prt2pdf/prt2pdf]
system "make", "install", "PREFIX=#{prefix}"
bin.install %w[src/punutil/punutil src/prt2pdf/prt2pdf]
end

test do

Check failure on line 34 in Formula/d/dps8m.rb

View workflow job for this annotation

GitHub Actions / macOS 13-x86_64

`brew test --verbose dps8m` failed on macOS Ventura (13)!

/usr/local/Homebrew/Library/Homebrew/test.rb:54:in `<main>'
(testpath/"test.exp").write <<~EXPECT
spawn #{bin}/dps8 -t
set timeout 30
expect {
timeout { exit 1 }
">"
}
set timeout 10
send "SH VE\r"
expect {
timeout { exit 2 }
"Version:"
}
send "q\r"
expect {
timeout { exit 3 }
eof
}
EXPECT
system("expect", "-f", "test.exp")
require "pty"
PTY.spawn(bin/"dps8", "-t") do |r, w, pid|
sleep 1
assert_match "sim>", r.read_nonblock(1024)
w.write "SH VE\r"
sleep 1
assert_match "Version:", r.read_nonblock(1024)
w.write "q\r"
sleep 1
assert_match "Goodbye", r.read_nonblock(1024)
ensure
r.close
w.close
Process.wait(pid)
end
end
end

0 comments on commit d4885d9

Please sign in to comment.