Skip to content

Commit

Permalink
#55 add test
Browse files Browse the repository at this point in the history
  • Loading branch information
jmbarbone committed Apr 26, 2023
1 parent ef12fb6 commit a7e8059
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions tests/testthat/test-class-args.R
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,22 @@ test_that("new_arg(action = 'default')", {
expect_identical(new_arg(options = list(no = FALSE))$action, "flag")
})

test_that("action = 'flag' allows TRUE [#55]", {
ca <- command_args()
expect_warning(
ca$add_argument("--foo", action = "flag", default = TRUE),
NA
)
obj <- ca$parse()
exp <- list(foo = TRUE)
expect_identical(obj, exp)

ca$set_input("--foo")
obj <- ca$parse()
exp <- list(foo = FALSE)
expect_identical(obj, exp)
})

test_that("snapshots", {
arg <- new_arg("...", info = "help text")
expect_output(arg$show())
Expand Down

0 comments on commit a7e8059

Please sign in to comment.