我制作了一个自制配方,现在只能在我的本地水龙头上访问。我想向 homebrew-core 发送拉取请求。现在我需要为我的公式编写测试。如何根据下面的示例编写它?
test do
output = shell_output("#{bin}/balance 2>&1", 64)
assert_match "this is balance #{version}", output
end
Run Code Online (Sandbox Code Playgroud)
我的公式
#!/usr/bin/env ruby
def match
files = Dir.glob("*")
if ARGV.length == 0
puts "usage: match <keyword>"
return
end
files.each { |x|
if File.directory?(x)
puts "#{x}_ found directory"
puts "***"
next
end
found = false
File.open(x).each_line.with_index do |line, index|
if line.include? ARGV[0]
puts "#{x}_ #{index+1} #{line}"
found = true
end
end
puts "***" if found
}
end
match
Run Code Online (Sandbox Code Playgroud)
冲泡配方
class Match < Formula
desc …Run Code Online (Sandbox Code Playgroud)