Skip to content

Commit

Permalink
inlyne: update test to remove expect dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
cho-m committed Dec 28, 2024
1 parent 1879c7a commit 5c4c926
Showing 1 changed file with 14 additions and 18 deletions.
32 changes: 14 additions & 18 deletions Formula/i/inlyne.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ class Inlyne < Formula
depends_on "pkgconf" => :build
depends_on "rust" => :build

uses_from_macos "expect" => :test

on_linux do
depends_on "libxkbcommon"
depends_on "wayland"
Expand All @@ -42,22 +40,20 @@ def install
return if OS.linux? && ENV["HOMEBREW_GITHUB_ACTIONS"]

test_markdown = testpath/"test.md"
test_markdown.write <<~EOS
test_markdown.write <<~MARKDOWN
_lorem_ **ipsum** dolor **sit** _amet_
EOS

script = (testpath/"test.exp")
script.write <<~EOS
#!/usr/bin/env expect -f
set timeout 2
spawn #{bin}/inlyne #{test_markdown}
send -- "q\r"
expect eof
EOS

system "expect", "-f", "test.exp"
MARKDOWN

ENV["INLYNE_LOG"] = "inlyne=debug,cosmic_text=trace"
ENV["NO_COLOR"] = "1"

Open3.popen2e(bin/"inlyne", test_markdown) do |_stdin, stdout_and_stderr, wait_thread|
sleep 2
Process.kill "TERM", wait_thread.pid
output = stdout_and_stderr.read
assert_match "Line LTR: 'lorem ipsum dolor sit amet'", output
assert_match(/style: Italic,.*\n.*Run \[\]: 'lorem'/, output)
refute_match "ERROR", output
end
end
end

0 comments on commit 5c4c926

Please sign in to comment.