Skip to content
Open
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
26 changes: 4 additions & 22 deletions Formula/t/tinymist.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,28 +32,10 @@ def install
test do
system bin/"tinymist", "probe"

json = <<~JSON
{
"jsonrpc": "2.0",
"id": 1,
"method": "initialize",
"params": {
"rootUri": null,
"capabilities": {}
}
}
JSON
(testpath/"test.typ").write("= Hello from tinymist\n")
system bin/"tinymist", "compile", "test.typ", "test.pdf"

input = "Content-Length: #{json.size}\r\n\r\n#{json}"
output = IO.popen([bin/"tinymist", "lsp"], "w+") do |pipe|
pipe.write(input)
sleep 1
pipe.close_write
pipe.read
end

assert_match(/^Content-Length: \d+/i, output)
json_dump = output.lines.last.strip
assert_equal 1, JSON.parse(json_dump)["id"]
assert_path_exists testpath/"test.pdf"
assert_equal "%PDF-", (testpath/"test.pdf").binread(5)
end
end
Loading