-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Remove mockery Fixes #57 I don't love the implementation for package.R. If there's a less-kludgey way to do that, I'd be happy to do so! * Address review comments. * Slightly clearer commenting about is_debugged(). * Simplify testing, to aboid changing the package code * Avoid whitespace changes * Simpligy tests --------- Co-authored-by: Gábor Csárdi <csardi.gabor@gmail.com>
- Loading branch information
1 parent
b4205eb
commit 121258f
Showing
7 changed files
with
43 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,3 +12,4 @@ | |
^codecov\.yml$ | ||
^LICENSE\.md$ | ||
^screencast.gif$ | ||
^debugme\.Rproj$ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,7 +18,6 @@ Imports: | |
grDevices | ||
Suggests: | ||
covr, | ||
mockery, | ||
R6, | ||
testthat (>= 3.0.0), | ||
withr | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
Version: 1.0 | ||
|
||
RestoreWorkspace: No | ||
SaveWorkspace: No | ||
AlwaysSaveHistory: Default | ||
|
||
EnableCodeIndexing: Yes | ||
UseSpacesForTab: Yes | ||
NumSpacesForTab: 2 | ||
Encoding: UTF-8 | ||
|
||
RnwWeave: Sweave | ||
LaTeX: pdfLaTeX | ||
|
||
BuildType: Package | ||
PackageUseDevtools: Yes | ||
PackageInstallArgs: --no-multiarch --with-keep.source | ||
PackageRoxygenize: rd,collate,namespace |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,21 @@ | ||
test_that("color palette is fine", { | ||
|
||
val <- NULL | ||
|
||
mockery::stub(initialize_colors, "assign", | ||
function(x, value, envir, ...) val <<- value) | ||
initialize_colors(c("foo", "bar")) | ||
expect_equal(names(val), c("foo", "bar")) | ||
expect_true(all(val %in% grDevices::colors())) | ||
expect_equal(names(debug_data[["palette"]]), c("foo", "bar")) | ||
expect_true(all(debug_data[["palette"]] %in% grDevices::colors())) | ||
|
||
initialize_colors(letters) | ||
expect_equal(names(val), letters) | ||
expect_true(all(val %in% c("silver", grDevices::colors()))) | ||
expect_equal(names(debug_data[["palette"]]), letters) | ||
expect_true(all(debug_data[["palette"]] %in% c("silver", grDevices::colors()))) | ||
}) | ||
|
||
## Quite an artificial test case... | ||
|
||
test_that("get a package style", { | ||
|
||
mockery::stub(get_package_style, "is_debugged", function(...) TRUE) | ||
mockery::stub(get_package_style, "make_style", function(x) substitute(x)) | ||
local_mocked_bindings( | ||
is_debugged = function(...) TRUE, | ||
make_style = function(x) substitute(x) | ||
) | ||
ret <- get_package_style("pkg") | ||
expect_equal(ret, quote(debug_data$palette[pkg])) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters