Skip to content

Commit

Permalink
Merge pull request #180218 from Homebrew/no-head-conditionals-in-test…
Browse files Browse the repository at this point in the history
…-blocks

*: Stop using `head?` conditionals in test blocks
  • Loading branch information
MikeMcQuaid authored Aug 7, 2024
2 parents 038810a + b487b5e commit 91fe5bc
Show file tree
Hide file tree
Showing 7 changed files with 6 additions and 15 deletions.
2 changes: 1 addition & 1 deletion Formula/g/goplus.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def install
# Run gop fmt, run, build
ENV.prepend "GO111MODULE", "on"

assert_equal "v#{version}", shell_output("#{bin}/gop env GOPVERSION").chomp unless head?
assert_equal "v#{version}", shell_output("#{bin}/gop env GOPVERSION").chomp
system bin/"gop", "fmt", "hello.gop"
assert_equal "Hello World\n", shell_output("#{bin}/gop run hello.gop")

Expand Down
2 changes: 1 addition & 1 deletion Formula/k/kdoctools.rb
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def install
(testpath/"CMakeLists.txt").write <<~EOS
cmake_minimum_required(VERSION 3.5)
include(FeatureSummary)
find_package(ECM #{version unless build.head?} NO_MODULE)
find_package(ECM #{version} NO_MODULE)
set_package_properties(ECM PROPERTIES TYPE REQUIRED)
set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} "#{pkgshare}/cmake")
find_package(Qt#{qt_major} #{qt.version} REQUIRED Core)
Expand Down
2 changes: 1 addition & 1 deletion Formula/k/ki18n.rb
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def install
(testpath/"CMakeLists.txt").write <<~EOS
cmake_minimum_required(VERSION 3.5)
include(FeatureSummary)
find_package(ECM #{version unless build.head?} NO_MODULE)
find_package(ECM #{version} NO_MODULE)
set_package_properties(ECM PROPERTIES TYPE REQUIRED)
set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} "#{pkgshare}/cmake")
set(CMAKE_CXX_STANDARD 17)
Expand Down
8 changes: 1 addition & 7 deletions Formula/lib/libvirt.rb
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,6 @@ def install
end

test do
if build.head?
output = shell_output("#{bin}/virsh -V")
assert_match "Compiled with support for:", output
else
output = shell_output("#{bin}/virsh -v")
assert_match version.to_s, output
end
assert_match version.to_s, shell_output("#{bin}/virsh -v")
end
end
3 changes: 1 addition & 2 deletions Formula/p/premake.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ def install
end

test do
expected_version = build.head? ? "-dev" : version.to_s
assert_match expected_version, shell_output("#{bin}/premake5 --version")
assert_match version.to_s, shell_output("#{bin}/premake5 --version")
end
end
3 changes: 1 addition & 2 deletions Formula/s/syncthing.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,7 @@ def install
end

test do
build_version = build.head? ? "v0.0.0-#{version}" : "v#{version}"
assert_match "syncthing #{build_version} ", shell_output("#{bin}/syncthing --version")
assert_match "syncthing v#{version} ", shell_output("#{bin}/syncthing --version")
system bin/"syncthing", "-generate", "./"
end
end
1 change: 0 additions & 1 deletion Formula/s/synergy-core.rb
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,6 @@ def caveats
"synergys: no configuration available\n"
assert_equal shell_output("#{opt_bin}/synergyc", 3).split("\n")[0],
"synergyc: a server address or name is required"
return if head?

version_string = Regexp.quote(version.major_minor_patch)
assert_match(/synergys #{version_string}[-.0-9a-z]*, protocol version/,
Expand Down

0 comments on commit 91fe5bc

Please sign in to comment.