Skip to content

Commit

Permalink
Merge pull request #202097 from Homebrew/blades-test
Browse files Browse the repository at this point in the history
blades: update test to drop `expect` dependency
  • Loading branch information
BrewTestBot authored Dec 22, 2024
2 parents cc8d8d0 + 311bd0f commit 1811b01
Showing 1 changed file with 13 additions and 18 deletions.
31 changes: 13 additions & 18 deletions Formula/b/blades.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,30 +20,25 @@ class Blades < Formula
end

depends_on "rust" => :build
uses_from_macos "expect" => :test

def install
system "cargo", "install", *std_cargo_args
end

test do
script = (testpath/"script.exp")
script.write <<~EXPECT
#!/usr/bin/expect -f
set timeout 2
spawn #{bin}/blades init
expect -exact "Name:"
send -- "brew\r"
expect -exact "Author:"
send -- "test\r"
expect eof
EXPECT

system "expect", "-f", "script.exp"
assert_predicate testpath/"content", :exist?
require "expect"
require "pty"

timeout = 5
PTY.spawn(bin/"blades", "init") do |r, w, pid|
refute_nil r.expect("Name:", timeout), "Expected name input"
w.write "brew\r"
refute_nil r.expect("Author:", timeout), "Expected author input"
w.write "test\r"
Process.wait pid
end

assert_path_exists testpath/"content"
assert_match "title = \"brew\"", (testpath/"Blades.toml").read

assert_match "blades #{version}", shell_output("#{bin}/blades --version")
Expand Down

0 comments on commit 1811b01

Please sign in to comment.