Skip to content

Commit

Permalink
#55 revert value switch on flag
Browse files Browse the repository at this point in the history
  • Loading branch information
jmbarbone committed Apr 29, 2023
1 parent 2895f42 commit 40c10f1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
5 changes: 0 additions & 5 deletions R/arg.R
Original file line number Diff line number Diff line change
Expand Up @@ -349,11 +349,6 @@ arg_parse_value <- function(self, ca) {
},
flag = {
value <- !grepl("^--?no-", ca_get_working(ca)[m + off])

if (value) {
value <- !self$get_default()
}

ca_remove_working(ca, m)
}
)
Expand Down
5 changes: 5 additions & 0 deletions tests/testthat/test-class-args.R
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,11 @@ test_that("action = 'flag' allows TRUE [#55]", {

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

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

0 comments on commit 40c10f1

Please sign in to comment.