From 451c05ff1164ad2509cd4d5393c7573a8caeafd9 Mon Sep 17 00:00:00 2001 From: Kevin Squire Date: Thu, 20 Feb 2020 13:49:30 -0800 Subject: [PATCH] Fix add_argument deprecation * It's a good idea to actually call `add_argument!(...)` * It's also a good idea to test the deprecated function --- src/argument_parser.jl | 3 ++- test/runtests.jl | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/argument_parser.jl b/src/argument_parser.jl index 24e958c..0c7be19 100644 --- a/src/argument_parser.jl +++ b/src/argument_parser.jl @@ -37,7 +37,8 @@ end function add_argument(args...; kwargs...) @warn """add_argument(...) is deprecated and will be removed before ArgParse2 is registered. - Please use add_argument!(...)""" maxlog=1 + Please use add_argument!(...)""" maxlog = 1 + add_argument!(args...; kwargs...) end function add_argument!(parser::ArgumentParser, name_or_flags::String...; kwargs...) diff --git a/test/runtests.jl b/test/runtests.jl index e061ab3..c1a18ae 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -414,6 +414,7 @@ end parser = ArgumentParser(description="Test missing prog") @test_logs (:warn, r"add_argument\(...\) is deprecated.*") add_argument(parser, "foo") + @test parse_args(parser, ["bar"]) === (foo = "bar",) end nothing