Skip to content

Commit

Permalink
Updated expected data for width 1000 (instead of 129) to test the dif…
Browse files Browse the repository at this point in the history
…f due to bug #64
  • Loading branch information
aryoda committed May 17, 2021
1 parent 8d2785c commit be8b090
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 5 deletions.
54 changes: 50 additions & 4 deletions tests/testthat/build_log_output_test_data_2.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,25 +8,71 @@ Compact call stack:
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 <- condit
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$mes
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)

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))


2 changes: 1 addition & 1 deletion tests/testthat/test_build_log_output.R
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ source("init_unit_test.R")



options("width" = 129) # default value in R is 129
options("width" = 1000) # default value in R is 129 - changed from 129 to 1000 on May 17, 2021 as workaround for bug #64



Expand Down

0 comments on commit be8b090

Please sign in to comment.