Skip to content

Commit

Permalink
Follow up to #3385: warn instead of message; update unit tests to ref…
Browse files Browse the repository at this point in the history
…lect some parameters can now succeed when others fail (#3652)
  • Loading branch information
cpsievert committed Jun 14, 2022
1 parent 8a5da25 commit 474f140
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion R/bookmark-state.R
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ RestoreContext <- R6Class("RestoreContext",
safeFromJSON(value),
error = function(e) {
varsUnparsed <<- c(varsUnparsed, name)
message("Failed to parse URL parameter \"", name, "\"")
warning("Failed to parse URL parameter \"", name, "\"")
}
)
}
Expand Down
6 changes: 3 additions & 3 deletions tests/testthat/test-bookmarking.R
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,12 @@ test_that("Inputs and values in query string", {
suppress_stacktrace(expect_warning(expect_warning(RestoreContext$new("?_inputs_&a=1&_inputs_&b=2"))))
suppress_stacktrace(expect_warning(expect_warning(RestoreContext$new("?_inputs_&a=1&_values_&b=2&_inputs_&"))))
suppress_stacktrace(expect_warning(expect_warning(RestoreContext$new("?_values_&a=1&_values_"))))
suppress_stacktrace(expect_warning(expect_warning(RestoreContext$new("?_inputs_&a=1&_values_&_values&b=2"))))
suppress_stacktrace(expect_warning(RestoreContext$new("?_inputs_&a=1&_values_&_values&b=2")))

# If there's an error in the conversion from query string, should have
# blank values.
suppress_stacktrace(expect_warning(expect_warning(rc <- RestoreContext$new("?_inputs_&a=[x&b=1"))))
expect_identical(rc$input$asList(), list())
suppress_stacktrace(expect_warning(rc <- RestoreContext$new("?_inputs_&a=[x&b=1")))
expect_identical(rc$input$asList(), list(b=1L))
expect_identical(as.list(rc$values), list())
expect_identical(rc$dir, NULL)

Expand Down

0 comments on commit 474f140

Please sign in to comment.