Skip to content

Commit

Permalink
Merge pull request #202149 from Homebrew/dps8m-test
Browse files Browse the repository at this point in the history
dps8m: replace `expect` dependency with Ruby libs
  • Loading branch information
BrewTestBot authored Dec 22, 2024
2 parents c4734fd + 2fd46ea commit ff53977
Showing 1 changed file with 16 additions and 28 deletions.
44 changes: 16 additions & 28 deletions Formula/d/dps8m.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,37 +26,25 @@ 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
(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 "expect"
require "pty"
timeout = 10
PTY.spawn(bin/"dps8", "-t") do |r, w, pid|
refute_nil r.expect("sim>", timeout), "Expected sim>"
w.write "SH VE\r"
refute_nil r.expect("Version:", timeout), "Expected Version:"
w.write "q\r"
refute_nil r.expect("Goodbye", timeout), "Expected Goodbye"
ensure
r.close
w.close
Process.wait(pid)
end
end
end

0 comments on commit ff53977

Please sign in to comment.