Skip to content

Commit

Permalink
Attempting to fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Kirill Kondrashov committed Jan 22, 2024
1 parent 49baa67 commit b120958
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
6 changes: 3 additions & 3 deletions src/Configuration.jl
Original file line number Diff line number Diff line change
Expand Up @@ -402,16 +402,16 @@ end

function _convert_to_flags(options::CompilerOptions)::Vector{String}
option_list = String[]
exclude_list = Symbol[]
exclude_list = String[]

if VERSION < v"1.9"
append!(exclude_list, [:heap_size_hint])
push!(exclude_list, "--heap-size-hint")
end

for name in fieldnames(CompilerOptions)
flagname = string("--", replace(String(name), "_" => "-"))
value = getfield(options, name)
if value !== nothing && value exclude_list
if value !== nothing && flagname exclude_list
push!(option_list, string(flagname, "=", value))
end
end
Expand Down
10 changes: 6 additions & 4 deletions test/Configuration.jl
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,13 @@ end
end

@testset "flag conversion" begin
@test _convert_to_flags(Configuration.CompilerOptions(threads="123")) ==
["--heap-size-hint=1G", "--startup-file=no", "--history-file=no", "--threads=123"]
reference_flags = ["--startup-file=no", "--history-file=no", "--threads=123"]
if VERSION v"1.9"
pushfirst!(reference_flags, "--heap-size-hint=2G")
end

@test _convert_to_flags(Configuration.CompilerOptions(threads=123)) ==
["--heap-size-hint=1G", "--startup-file=no", "--history-file=no", "--threads=123"]
@test _convert_to_flags(Configuration.CompilerOptions(threads="123")) == reference_flags
@test _convert_to_flags(Configuration.CompilerOptions(threads=123)) == reference_flags

@test _convert_to_flags(Configuration.CompilerOptions())
["--startup-file=no", "--history-file=no"]
Expand Down

0 comments on commit b120958

Please sign in to comment.