mirror of
https://github.com/Homebrew/brew.git
synced 2025-07-14 16:09:03 +08:00

It would be possible to work around this but I'm not convinced it's worth it given https://github.com/Homebrew/homebrew-core/issues/63290 Fixes #9194
45 lines
1.5 KiB
Ruby
45 lines
1.5 KiB
Ruby
# typed: false
|
|
# frozen_string_literal: true
|
|
|
|
require "language/java"
|
|
|
|
describe Language::Java do
|
|
describe "::java_home" do
|
|
if !OS.mac? || MacOS.version < :big_sur
|
|
it "returns valid JAVA_HOME if version is specified", :needs_java do
|
|
java_home = described_class.java_home("1.6+")
|
|
expect(java_home/"bin/java").to be_an_executable
|
|
end
|
|
end
|
|
|
|
it "returns valid JAVA_HOME if version is not specified", :needs_java do
|
|
java_home = described_class.java_home
|
|
expect(java_home/"bin/java").to be_an_executable
|
|
end
|
|
end
|
|
|
|
describe "::java_home_env" do
|
|
it "returns java_home path with version if version specified", :needs_macos do
|
|
java_home = described_class.java_home_env("blah")
|
|
expect(java_home[:JAVA_HOME]).to include("--version blah")
|
|
end
|
|
|
|
it "returns java_home path without version if version is not specified", :needs_java do
|
|
java_home = described_class.java_home_env
|
|
expect(java_home[:JAVA_HOME]).not_to include("--version")
|
|
end
|
|
end
|
|
|
|
describe "::overridable_java_home_env" do
|
|
it "returns java_home path with version if version specified", :needs_macos do
|
|
java_home = described_class.overridable_java_home_env("blah")
|
|
expect(java_home[:JAVA_HOME]).to include("--version blah")
|
|
end
|
|
|
|
it "returns java_home path without version if version is not specified", :needs_java do
|
|
java_home = described_class.overridable_java_home_env
|
|
expect(java_home[:JAVA_HOME]).not_to include("--version")
|
|
end
|
|
end
|
|
end
|