Skip to content

Commit

Permalink
Merge pull request #179327 from Homebrew/t-interpolated-bin-audit
Browse files Browse the repository at this point in the history
t*: Stop interpolating `bin`
  • Loading branch information
p-linnane authored Aug 1, 2024
2 parents 6964dd9 + d57fac3 commit 82ed8c0
Show file tree
Hide file tree
Showing 56 changed files with 68 additions and 68 deletions.
2 changes: 1 addition & 1 deletion Formula/t/tag.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def install
test_tag = "test_tag"
test_file = Pathname.pwd+"test_file"
touch test_file
system "#{bin}/tag", "--add", test_tag, test_file
system bin/"tag", "--add", test_tag, test_file
assert_equal test_tag, `#{bin}/tag --list --no-name #{test_file}`.chomp
end
end
2 changes: 1 addition & 1 deletion Formula/t/tailor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,6 @@ def install

test do
(testpath/"Test.swift").write "import Foundation\n"
system "#{bin}/tailor", testpath/"Test.swift"
system bin/"tailor", testpath/"Test.swift"
end
end
2 changes: 1 addition & 1 deletion Formula/t/tailwindcss-language-server.rb
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def install
}
JSON

Open3.popen3("#{bin}/tailwindcss-language-server", "--stdio") do |stdin, stdout|
Open3.popen3(bin/"tailwindcss-language-server", "--stdio") do |stdin, stdout|
stdin.write "Content-Length: #{json.size}\r\n\r\n#{json}"
sleep 3
assert_match(/^Content-Length: \d+/i, stdout.readline)
Expand Down
2 changes: 1 addition & 1 deletion Formula/t/tal.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,6 @@ def install
end

test do
system "#{bin}/tal", "/etc/passwd"
system bin/"tal", "/etc/passwd"
end
end
2 changes: 1 addition & 1 deletion Formula/t/tarlz.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def install
system bin/"tarlz", "-C", testpath, "-cf", lzipfilepath, "source"
assert_predicate lzipfilepath, :exist?

system "#{bin}/tarlz", "-C", dpath, "-xf", lzipfilepath
system bin/"tarlz", "-C", dpath, "-xf", lzipfilepath
assert_equal "TEST CONTENT", dtestfilepath.read
end
end
2 changes: 1 addition & 1 deletion Formula/t/task.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def install

test do
touch testpath/".taskrc"
system "#{bin}/task", "add", "Write", "a", "test"
system bin/"task", "add", "Write", "a", "test"
assert_match "Write a test", shell_output("#{bin}/task list")
end
end
2 changes: 1 addition & 1 deletion Formula/t/taskd.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,6 @@ def install
end

test do
system "#{bin}/taskd", "init", "--data", testpath
system bin/"taskd", "init", "--data", testpath
end
end
4 changes: 2 additions & 2 deletions Formula/t/tasksh.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ def install
end

test do
system "#{bin}/tasksh", "--version"
system bin/"tasksh", "--version"
(testpath/".taskrc").write "data.location=#{testpath}/.task\n"
assert_match "Created task 1.", pipe_output("#{bin}/tasksh", "add Test Task", 0)
assert_match "Created task 1.", pipe_output(bin/"tasksh", "add Test Task", 0)
end
end
2 changes: 1 addition & 1 deletion Formula/t/tcping.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,6 @@ def install
end

test do
system "#{bin}/tcping", "www.google.com", "80"
system bin/"tcping", "www.google.com", "80"
end
end
2 changes: 1 addition & 1 deletion Formula/t/tcpkali.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,6 @@ def install
end

test do
system "#{bin}/tcpkali", "-l1237", "-T0.5", "127.1:1237"
system bin/"tcpkali", "-l1237", "-T0.5", "127.1:1237"
end
end
2 changes: 1 addition & 1 deletion Formula/t/tcpsplit.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,6 @@ def install
end

test do
system "#{bin}/tcpsplit", "--version"
system bin/"tcpsplit", "--version"
end
end
2 changes: 1 addition & 1 deletion Formula/t/td.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def install

test do
(testpath/".todos").write "[]\n"
system "#{bin}/td", "a", "todo of test"
system bin/"td", "a", "todo of test"
todos = (testpath/".todos").read
assert_match "todo of test", todos
assert_match "pending", todos
Expand Down
4 changes: 2 additions & 2 deletions Formula/t/telegraf.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class Telegraf < Formula
def install
ldflags = "-s -w -X github.com/influxdata/telegraf/internal.Version=#{version}"
system "go", "build", *std_go_args(ldflags:), "./cmd/telegraf"
(etc/"telegraf.conf").write Utils.safe_popen_read("#{bin}/telegraf", "config")
(etc/"telegraf.conf").write Utils.safe_popen_read(bin/"telegraf", "config")
end

def post_install
Expand All @@ -45,7 +45,7 @@ def post_install
test do
assert_match version.to_s, shell_output("#{bin}/telegraf --version")
(testpath/"config.toml").write shell_output("#{bin}/telegraf -sample-config")
system "#{bin}/telegraf", "-config", testpath/"config.toml", "-test",
system bin/"telegraf", "-config", testpath/"config.toml", "-test",
"-input-filter", "cpu:mem"
end
end
4 changes: 2 additions & 2 deletions Formula/t/termius.rb
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ def install
end

test do
system "#{bin}/termius", "host", "--address", "localhost", "-L", "test_host"
system "#{bin}/termius", "host", "--delete", "test_host"
system bin/"termius", "host", "--address", "localhost", "-L", "test_host"
system bin/"termius", "host", "--delete", "test_host"
end
end
2 changes: 1 addition & 1 deletion Formula/t/termrec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,6 @@ def install
end

test do
system "#{bin}/termrec", "--help"
system bin/"termrec", "--help"
end
end
2 changes: 1 addition & 1 deletion Formula/t/terraform-docs.rb
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,6 @@ def install
value = "vpc-5c1f55fd"
}
EOS
system "#{bin}/terraform-docs", "json", testpath
system bin/"terraform-docs", "json", testpath
end
end
4 changes: 2 additions & 2 deletions Formula/t/terraform.rb
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def caveats
count = 4
}
EOS
system "#{bin}/terraform", "init"
system "#{bin}/terraform", "graph"
system bin/"terraform", "init"
system bin/"terraform", "graph"
end
end
2 changes: 1 addition & 1 deletion Formula/t/testdisk.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,6 @@ def install
path = "test.dmg"
cp test_fixtures(path + ".gz"), path + ".gz"
system "gunzip", path
system "#{bin}/testdisk", "/list", path
system bin/"testdisk", "/list", path
end
end
2 changes: 1 addition & 1 deletion Formula/t/texapp.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,6 @@ def install
end

test do
assert_match "trying to find cURL ...", pipe_output("#{bin}/texapp", "^C")
assert_match "trying to find cURL ...", pipe_output(bin/"texapp", "^C")
end
end
2 changes: 1 addition & 1 deletion Formula/t/texi2html.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def install
@end ifnottex
@bye
EOS
system "#{bin}/texi2html", "test.texinfo"
system bin/"texi2html", "test.texinfo"
assert_match "Hello World!", File.read("test.html")
end
end
2 changes: 1 addition & 1 deletion Formula/t/texlab.rb
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,6 @@ def rpc(json)

output = /Content-Length: \d+\r\n\r\n/

assert_match output, pipe_output("#{bin}/texlab", input, 0)
assert_match output, pipe_output(bin/"texlab", input, 0)
end
end
2 changes: 1 addition & 1 deletion Formula/t/tgif.rb
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def install
]).
EOS
system "#{bin}/tgif", "-print", "-text", "-quiet", "test.obj"
system bin/"tgif", "-print", "-text", "-quiet", "test.obj"
assert_predicate testpath/"test.txt", :exist?
end
end
Expand Down
2 changes: 1 addition & 1 deletion Formula/t/thrift.rb
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ def install
}
EOS

system "#{bin}/thrift", "-r", "--gen", "cpp", "test.thrift"
system bin/"thrift", "-r", "--gen", "cpp", "test.thrift"

system ENV.cxx, "-std=c++11", "gen-cpp/MultiplicationService.cpp",
"gen-cpp/MultiplicationService_server.skeleton.cpp",
Expand Down
2 changes: 1 addition & 1 deletion Formula/t/thriftgo.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def install
Response echo(1: Request req)
}
EOS
system "#{bin}/thriftgo", "-o=.", "-g=go", "test.thrift"
system bin/"thriftgo", "-o=.", "-g=go", "test.thrift"
assert_predicate testpath/"api"/"test.go", :exist?
refute_predicate (testpath/"api"/"test.go").size, :zero?
end
Expand Down
2 changes: 1 addition & 1 deletion Formula/t/tiff2png.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,6 @@ def install
end

test do
system "#{bin}/tiff2png", test_fixtures("test.tiff")
system bin/"tiff2png", test_fixtures("test.tiff")
end
end
2 changes: 1 addition & 1 deletion Formula/t/tika.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def install

port = free_port
pid = fork do
exec "#{bin}/tika-rest-server", "--port=#{port}"
exec bin/"tika-rest-server", "--port=#{port}"
end

sleep 10
Expand Down
2 changes: 1 addition & 1 deletion Formula/t/tile38.rb
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def caveats
test do
port = free_port
pid = fork do
exec "#{bin}/tile38-server", "-q", "-p", port.to_s
exec bin/"tile38-server", "-q", "-p", port.to_s
end
sleep 2
# remove `$408` in the first line output
Expand Down
8 changes: 4 additions & 4 deletions Formula/t/timg.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,10 @@ def install
end

test do
system "#{bin}/timg", "--version"
system "#{bin}/timg", "-g10x10", test_fixtures("test.gif")
system "#{bin}/timg", "-g10x10", test_fixtures("test.png")
system "#{bin}/timg", "-pq", "-g10x10", "-o", testpath/"test-output.txt", test_fixtures("test.jpg")
system bin/"timg", "--version"
system bin/"timg", "-g10x10", test_fixtures("test.gif")
system bin/"timg", "-g10x10", test_fixtures("test.png")
system bin/"timg", "-pq", "-g10x10", "-o", testpath/"test-output.txt", test_fixtures("test.jpg")
assert_match "38;2;255;38;0;49m", (testpath/"test-output.txt").read
end
end
2 changes: 1 addition & 1 deletion Formula/t/timidity.rb
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,6 @@ def install
end

test do
system "#{bin}/timidity"
system bin/"timidity"
end
end
2 changes: 1 addition & 1 deletion Formula/t/tin.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,6 @@ def install
end

test do
system "#{bin}/tin", "-H"
system bin/"tin", "-H"
end
end
2 changes: 1 addition & 1 deletion Formula/t/tinymist.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def install
JSON

input = "Content-Length: #{json.size}\r\n\r\n#{json}"
output = IO.popen("#{bin}/tinymist", "w+") do |pipe|
output = IO.popen(bin/"tinymist", "w+") do |pipe|
pipe.write(input)
sleep 1
pipe.close_write
Expand Down
2 changes: 1 addition & 1 deletion Formula/t/tinyproxy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def post_install
inreplace testpath/"tinyproxy.conf", "Port 8888", "Port #{port}"

pid = fork do
exec "#{bin}/tinyproxy", "-c", testpath/"tinyproxy.conf"
exec bin/"tinyproxy", "-c", testpath/"tinyproxy.conf"
end
sleep 2

Expand Down
2 changes: 1 addition & 1 deletion Formula/t/tippecanoe.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def install
(testpath/"test.json").write <<~EOS
{"type":"Feature","properties":{},"geometry":{"type":"Point","coordinates":[0,0]}}
EOS
safe_system "#{bin}/tippecanoe", "-o", "test.mbtiles", "test.json"
safe_system bin/"tippecanoe", "-o", "test.mbtiles", "test.json"
assert_predicate testpath/"test.mbtiles", :exist?, "tippecanoe generated no output!"
end
end
2 changes: 1 addition & 1 deletion Formula/t/tkdiff.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,6 @@ def install
# Fails with: no display name and no $DISPLAY environment variable on GitHub Actions
return if OS.linux? && ENV["HOMEBREW_GITHUB_ACTIONS"].present?

system "#{bin}/tkdiff", "--help"
system bin/"tkdiff", "--help"
end
end
8 changes: 4 additions & 4 deletions Formula/t/tm.rb
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def install
assert_match "Triggermesh CLI, version v#{version}", version_output

# node
system "#{bin}/tm", "generate", "node", "foo-node"
system bin/"tm", "generate", "node", "foo-node"
assert_predicate testpath/"foo-node/serverless.yaml", :exist?
assert_predicate testpath/"foo-node/handler.js", :exist?

Expand All @@ -70,7 +70,7 @@ def install
assert_match "runtime: #{runtime}", yaml

# python
system "#{bin}/tm", "generate", "python", "foo-python"
system bin/"tm", "generate", "python", "foo-python"
assert_predicate testpath/"foo-python/serverless.yaml", :exist?
assert_predicate testpath/"foo-python/handler.py", :exist?

Expand All @@ -79,7 +79,7 @@ def install
assert_match "runtime: #{runtime}", yaml

# go
system "#{bin}/tm", "generate", "go", "foo-go"
system bin/"tm", "generate", "go", "foo-go"
assert_predicate testpath/"foo-go/serverless.yaml", :exist?
assert_predicate testpath/"foo-go/main.go", :exist?

Expand All @@ -88,7 +88,7 @@ def install
assert_match "runtime: #{runtime}", yaml

# ruby
system "#{bin}/tm", "generate", "ruby", "foo-ruby"
system bin/"tm", "generate", "ruby", "foo-ruby"
assert_predicate testpath/"foo-ruby/serverless.yaml", :exist?
assert_predicate testpath/"foo-ruby/handler.rb", :exist?

Expand Down
2 changes: 1 addition & 1 deletion Formula/t/tmate.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,6 @@ def install
end

test do
system "#{bin}/tmate", "-V"
system bin/"tmate", "-V"
end
end
2 changes: 1 addition & 1 deletion Formula/t/tmuxinator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def install
list_output = shell_output("#{bin}/tmuxinator list")
assert_match "tmuxinator projects:", list_output

system "#{bin}/tmuxinator", "new", "test"
system bin/"tmuxinator", "new", "test"
list_output = shell_output("#{bin}/tmuxinator list")
assert_equal "tmuxinator projects:\ntest\n", list_output
end
Expand Down
2 changes: 1 addition & 1 deletion Formula/t/tnef.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,6 @@ def install
end

test do
system "#{bin}/tnef", "--version"
system bin/"tnef", "--version"
end
end
2 changes: 1 addition & 1 deletion Formula/t/toilet.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,6 @@ def install
end

test do
system "#{bin}/toilet", "--version"
system bin/"toilet", "--version"
end
end
2 changes: 1 addition & 1 deletion Formula/t/torsocks.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,6 @@ def install
end

test do
system "#{bin}/torsocks", "--help"
system bin/"torsocks", "--help"
end
end
2 changes: 1 addition & 1 deletion Formula/t/tracy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def install
assert_match "Tracy Profiler #{version}", shell_output("#{bin}/tracy --help")

pid = fork do
exec "#{bin}/tracy", "-p", port.to_s
exec bin/"tracy", "-p", port.to_s
end
sleep 1
ensure
Expand Down
Loading

0 comments on commit 82ed8c0

Please sign in to comment.