-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
First attempt to fix failing unit tests (bug #64)
- Loading branch information
Showing
5 changed files
with
124 additions
and
58 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
32 changes: 32 additions & 0 deletions
32
tests/testthat/build_log_output_test_data_2_since_R_05_2021.txt
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,32 @@ | ||
[ERROR] msg | ||
|
||
Compact call stack: | ||
1 tryLog(log("abc")) | ||
2 tryLog.R#49: tryCatchLog(expr = expr, dump.errors.to.file = dump.errors.to.file, error = function(e) { | ||
3 tryCatchLog.R#135: tryCatch(withCallingHandlers(expr, error = function(e) { | ||
|
||
Full call stack: | ||
1 tryLog(log("abc")) | ||
2 tryLog.R#49: tryCatchLog(expr = expr, dump.errors.to.file = dump.errors.to.file, error = function(e) { | ||
msg <- conditi | ||
3 tryCatchLog.R#135: tryCatch(withCallingHandlers(expr, error = function(e) { | ||
call.stack <- sys.calls() | ||
{ | ||
|
||
4 tryCatchList(expr, classes, parentenv, handlers) | ||
5 tryCatchOne(expr, names, parentenv, handlers[[1]]) | ||
6 doTryCatch(return(expr), name, parentenv, handler) | ||
7 withCallingHandlers(expr, error = function(e) { | ||
call.stack <- sys.calls() | ||
{ | ||
.doTrace(browser()) | ||
|
||
8 .handleSimpleError(function (e) | ||
{ | ||
call.stack <- sys.calls() | ||
{ | ||
.doTrace(browser()) | ||
lo | ||
9 h(simpleError(msg, call)) | ||
|
||
|
68 changes: 68 additions & 0 deletions
68
tests/testthat/expected_full_stack_trace_since_R_05_2021.txt.txt
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,68 @@ | ||
1 tryLog(log("abc")) | ||
2 tryLog.R#49: tryCatchLog(expr = expr, dump.errors.to.file = dump.errors.to.file, error = function(e) { | ||
msg <- conditionMessage(e) | ||
invisible(structure(msg, class = "try-error", condition = e)) | ||
}, silent.warnings = silent.warnings, silent.messages = silent.messages) | ||
3 tryCatchLog.R#135: tryCatch(withCallingHandlers(expr, error = function(e) { | ||
call.stack <- sys.calls() | ||
{ | ||
.doTrace(browser()) | ||
log.message <- e$message | ||
} | ||
if (dump.errors.to.file == TRUE) { | ||
dump.file.name <- format(Sys.time(), format = "dump_%Y%m%d_%H%M%S") | ||
utils::dump.frames() | ||
save.image(file = paste0(dump.file.name, ".rda")) | ||
log.message <- paste0(log.message, "\nCall stack environments dumped into file: ", dump.file.name, ".rda") | ||
} | ||
log.entry <- build.log.entry(names(futile.logger::ERROR), log.message, call.stack, 1) | ||
log.msg <- buildLogMessage(log.message, call.stack, 1) | ||
append.to.last.tryCatchLog.result(log.entry) | ||
futile.logger::flog.error(log.msg) | ||
}, warning = function(w) { | ||
call.stack <- sys.calls() | ||
log.entry <- build.log.entry(names(futile.logger::WARN), w$message, call.stack, 1) | ||
log.msg <- buildLogMessage(w$message, call.stack, 1 | ||
4 tryCatchList(expr, classes, parentenv, handlers) | ||
5 tryCatchOne(expr, names, parentenv, handlers[[1]]) | ||
6 doTryCatch(return(expr), name, parentenv, handler) | ||
7 withCallingHandlers(expr, error = function(e) { | ||
call.stack <- sys.calls() | ||
{ | ||
.doTrace(browser()) | ||
log.message <- e$message | ||
} | ||
if (dump.errors.to.file == TRUE) { | ||
dump.file.name <- format(Sys.time(), format = "dump_%Y%m%d_%H%M%S") | ||
utils::dump.frames() | ||
save.image(file = paste0(dump.file.name, ".rda")) | ||
log.message <- paste0(log.message, "\nCall stack environments dumped into file: ", dump.file.name, ".rda") | ||
} | ||
log.entry <- build.log.entry(names(futile.logger::ERROR), log.message, call.stack, 1) | ||
log.msg <- buildLogMessage(log.message, call.stack, 1) | ||
append.to.last.tryCatchLog.result(log.entry) | ||
futile.logger::flog.error(log.msg) | ||
}, warning = function(w) { | ||
call.stack <- sys.calls() | ||
log.entry <- build.log.entry(names(futile.logger::WARN), w$message, call.stack, 1) | ||
log.msg <- buildLogMessage(w$message, call.stack, 1) | ||
append.to.last.tryC | ||
8 .handleSimpleError(function (e) | ||
{ | ||
call.stack <- sys.calls() | ||
{ | ||
.doTrace(browser()) | ||
log.message <- e$message | ||
} | ||
if (dump.errors.to.file == TRUE) { | ||
dump.file.name <- format(Sys.time(), format = "dump_%Y%m%d_%H%M%S") | ||
utils::dump.frames() | ||
save.image(file = paste0(dump.file.name, ".rda")) | ||
log.message <- paste0(log.message, "\nCall stack environments dumped into file: ", dump.file.name, ".rda") | ||
} | ||
log.entry <- build.log.entry(names(futile.logger::ERROR), log.message, call.stack, 1) | ||
log.msg <- buildLogMessage(log.message, call.stack, 1) | ||
append.to.last.tryCatchLog.result(log.entry) | ||
futile.logger::flog.error(log.msg) | ||
}, "non-numeric argument to mathematical function", quote(log("abc"))) | ||
9 h(simpleError(msg, call)) |
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