Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
admercs committed Jan 9, 2024
1 parent 1237b72 commit 5c5d364
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ using Test
@testset "Testset empty constructor" begin
p = ArgumentParser()
@test isempty(p.description)
@test isempty(p.author)
@test isempty(p.authors)
@test isempty(p.documentation)
@test isempty(p.repository)
@test isempty(p.license)
Expand All @@ -25,7 +25,7 @@ using Test
add_help=true
)
@test "test" == p.description
@test "first last" == p.author
@test ["first last <first.last@foo.bar>"] == p.authors
@test "server/docs" == p.documentation
@test "server/repo" == p.repository
@test "license" == p.license
Expand All @@ -39,25 +39,23 @@ using Test
@test "bar" == get_value(p, "--foo")
@test "bar" == get_value(p, "-f")
@test "bar" == get_value(p, "f")
@test_throws MethodError add_argument(p)
end

@testset "Testset get" begin
@testset "Testset get_value" begin
p = ArgumentParser()
p = add_argument(p, "-f", "--foo", type=String, default="bar", description="baz")
@test isnothing(get_value(p, "--missing"))
@test "bar" == get_value(p, "--foo")
@test "bar" == get_value(p, "-f")
@test "bar" == get_value(p, "f")
@test isa(get_value(p, "--foo"), String)
@test_throws MethodError SimpleArgParse.get_value(p, 3)
@test isa(get_value(p, "foo"), String)
end

@testset "Testset set" begin
@testset "Testset set_value" begin
p = ArgumentParser()
p = add_argument(p, "-f", "--foo", type=String, default="bar")
@test "bar" == get_value(p, "--foo")
p = SimpleArgParse.set(p, "--foo", "baz")
p = set_value(p, "--foo", "baz")
@test "baz" == get_value(p, "--foo")
end

Expand Down

0 comments on commit 5c5d364

Please sign in to comment.