Skip to content

Commit

Permalink
Ugly fix for julia v1.6 change in printing
Browse files Browse the repository at this point in the history
from Array{Int,1} to Vector{Int}
  • Loading branch information
carlobaldassi committed Dec 5, 2020
1 parent 0d5172f commit 30705e8
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions test/argparse_test03.jl
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,21 @@ end
let s = ap_settings3()
ap_test3(args) = parse_args(args, s)

## ugly workaround for the change of printing Vectors in julia 1.6,
## from Array{Int,1} to Vector{Int}
array_help_lines = if string(Vector{Any}) == "Vector{Any}"
"""
--array ARRAY create an array (type: Vector{$Int}, default:
$([7, 3, 2]))
"""
else
"""
--array ARRAY create an array (type: Array{$Int,1},
default: $([7, 3, 2]))
"""
end
array_help_lines = array_help_lines[1:end-1] # remove an extra newline

@test stringhelp(s) == """
usage: $(basename(Base.source_path())) [--opt1] [--opt2] [-k] [-u] [--array ARRAY]
[--custom CUSTOM] [--oddint ODDINT]
Expand All @@ -91,8 +106,7 @@ let s = ap_settings3()
--opt2 append O2
-k provide the answer
-u provide the answer as floating point
--array ARRAY create an array (type: Array{$Int,1},
default: $([7, 3, 2]))
$array_help_lines
--custom CUSTOM the only accepted argument is "custom" (type:
CustomType, default: CustomType())
--oddint ODDINT an odd integer (type: $Int, default: 1)
Expand Down

0 comments on commit 30705e8

Please sign in to comment.