-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use a better helper for testing output types
And eliminate tests of length if we're testing the output types
- Loading branch information
Showing
4 changed files
with
62 additions
and
63 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
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,22 @@ | ||
output_type <- function(x) { | ||
if (is.character(x)) { | ||
"text" | ||
} else if (inherits(x, "error")) { | ||
"error" | ||
} else if (inherits(x, "warning")) { | ||
"warning" | ||
} else if (inherits(x, "message")) { | ||
"message" | ||
} else if (inherits(x, "recordedplot")) { | ||
"plot" | ||
} else if (inherits(x, "source")) { | ||
"source" | ||
} else { | ||
class(x)[[1]] | ||
} | ||
} | ||
output_types <- function(x) vapply(x, output_type, character(1)) | ||
|
||
expect_output_types <- function(x, types) { | ||
expect_equal(output_types(x), types) | ||
} |
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