-
Notifications
You must be signed in to change notification settings - Fork 84
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
use a new utiliity fxn for safe reading of csv files with more informative error message export lcd_cache and make manual file for it so that users can manage the lcd cache change internal fxn read_csv to storms_read_csv as it was only used for storms add utilities tests file, add test for lcd() for bad files
- Loading branch information
Showing
7 changed files
with
157 additions
and
6 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
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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 @@ | ||
test_that("safe_read_csv",{ | ||
expect_is(safe_read_csv, "function") | ||
expect_error(safe_read_csv()) | ||
expect_error(safe_read_csv(5), "class") | ||
|
||
# file doesn't exist, throws warning on read.csv | ||
file1 <- tempfile() | ||
expect_error(safe_read_csv(file1), "No such file") | ||
|
||
# file empty | ||
file2 <- tempfile() | ||
file.create(file2) | ||
expect_error(safe_read_csv(file2), "malformed") | ||
|
||
# file with a single newline | ||
file3 <- tempfile() | ||
cat("\n", file = file3) | ||
expect_error(safe_read_csv(file3), "malformed") | ||
|
||
# cleanup | ||
invisible(lapply(c(file1, file2, file3), unlink)) | ||
}) |