CRAN Package Check Results for Package unittest

Last updated on 2022-08-15 08:50:11 CEST.

Flavor Version Tinstall Tcheck Ttotal Status Flags
r-devel-linux-x86_64-debian-clang 1.4-0 2.33 31.10 33.43 NOTE
r-devel-linux-x86_64-debian-gcc 1.4-0 1.94 24.68 26.62 NOTE
r-devel-linux-x86_64-fedora-clang 1.4-0 52.29 NOTE
r-devel-linux-x86_64-fedora-gcc 1.4-0 53.97 NOTE
r-devel-windows-x86_64 1.4-0 13.00 68.00 81.00 ERROR
r-patched-linux-x86_64 1.4-0 2.48 30.56 33.04 NOTE
r-release-linux-x86_64 1.4-0 1.85 30.45 32.30 NOTE
r-release-macos-arm64 1.4-0 20.00 NOTE
r-release-macos-x86_64 1.4-0 27.00 NOTE
r-release-windows-x86_64 1.4-0 16.00 67.00 83.00 ERROR
r-oldrel-macos-arm64 1.4-0 26.00 NOTE
r-oldrel-macos-x86_64 1.4-0 46.00 NOTE
r-oldrel-windows-ix86+x86_64 1.4-0 6.00 57.00 63.00 NOTE

Check Details

Version: 1.4-0
Check: LazyData
Result: NOTE
     'LazyData' is specified without a 'data' directory
Flavors: r-devel-linux-x86_64-debian-clang, r-devel-linux-x86_64-debian-gcc, r-devel-linux-x86_64-fedora-clang, r-devel-linux-x86_64-fedora-gcc, r-devel-windows-x86_64, r-patched-linux-x86_64, r-release-linux-x86_64, r-release-macos-arm64, r-release-macos-x86_64, r-release-windows-x86_64, r-oldrel-macos-arm64, r-oldrel-macos-x86_64, r-oldrel-windows-ix86+x86_64

Version: 1.4-0
Check: tests
Result: ERROR
     Running 'test_non_interactive.R' [6s]
     Running 'test_ok.R' [1s]
     Running 'test_ok_group.R' [0s]
     Running 'test_ut_cmp.R' [2s]
     Running 'test_ut_cmp_error.R' [0s]
    Running the tests in 'tests/test_ut_cmp.R' failed.
    Complete output:
     > options(useFancyQuotes = FALSE) # Force to stabilise all.equal output
     >
     > library(unittest)
     >
     > # Compare character output of a (failing) cmp function, ignoring colors
     > cmp_lines <- function (actual, ...) {
     + # Remove color escape codes
     + no_color <- gsub('\033\\[.*?m', '', actual, perl = TRUE)
     + if(identical(no_color, c(...)[!is.null(c(...))])) {
     + return(TRUE)
     + }
     + # utils::str(no_color, vec.len = 1000, digits.d = 5, nchar.max = 1000)
     + return(actual)
     + }
     >
     > # Mock (fn) in namespace with (replacement) whilst (block) is being evaluated
     > mock <- function (fn, replacement, block) {
     + # Get the name of the function from the unevaluated argument,
     + # assuming it's of the form package::name
     + fn_name <- as.character(as.list(sys.call()[[2]])[[3]])
     + ns <- environment(fn)
     +
     + orig_fn <- get(fn_name, env = ns)
     + unlockBinding(fn_name, env = ns)
     + assign(fn_name, replacement, envir = ns)
     + on.exit(assign(fn_name, orig_fn, envir = ns), add = TRUE)
     +
     + block
     + }
     >
     > ok_group("ut_cmp_equal", (function () {
     + ok(isTRUE(ut_cmp_equal(4, 4)), "Identical objects return true")
     + ok(isTRUE(ut_cmp_equal(as.integer(4), 4)), "Equivalent objects return true (i.e. integer vs. number)")
     + ok(isTRUE(ut_cmp_equal(0.01, 0.02, tolerance = 0.1)), "Additional arguments passed through to all.equal")
     +
     + if (!file.exists(unittest:::git_binary())) {
     + ok(TRUE, "# skip git not available")
     + return()
     + }
     +
     + ok(cmp_lines(ut_cmp_equal(c(2,4,2,8), c(5,4,2,1)),
     + 'Mean relative difference: 1',
     + '--- c(2, 4, 2, 8)',
     + '+++ c(5, 4, 2, 1)',
     + '[1] [-2-]{+5+} 4 2 [-8-]{+1+}',
     + NULL), "Vectors filtered by str, individual differences highlighted")
     +
     + ok(!withVisible(ut_cmp_equal("apples", "oranges"))$visible,
     + "Output of comparision isn't visible (we should print it at a real console though)")
     +
     + do_a_thing <- function (x) seq(x)
     + ok(cmp_lines(ut_cmp_equal(do_a_thing(4), do_a_thing(1 + 2)),
     + 'Numeric: lengths (4, 3) differ',
     + '--- do_a_thing(4)',
     + '+++ do_a_thing(1 + 2)',
     + '[1] 1 2 3[-4-]',
     + NULL), "The ---/+++ lines show expressions handed to ut_cmp_equal()")
     +
     + ok(cmp_lines(ut_cmp_equal(list(c(1, 2, 8), c(2, 3, 2), 10, 11, 12, 13), list(c(1, 2, 3), c(2, 3, 2), 10, 11, 12, 13)),
     + "Component 1: Mean relative difference: 0.625",
     + "--- list(c(1, 2, 8), c(2, 3, 2), 10, 11, 12, 13)",
     + "+++ list(c(1, 2, 3), c(2, 3, 2), 10, 11, 12, 13)",
     + "[[1]]",
     + "[1] 1 2 [-8-]{+3+}",
     + "",
     + "[[2]]",
     + "[1] 2 3 2",
     + "",
     + "[[3]]",
     + "[1] 10",
     + "",
     + "[[4]]",
     + "[1] 11",
     + "",
     + "[[5]]",
     + "[1] 12",
     + "",
     + "[[6]]",
     + "[1] 13",
     + NULL), "We return the whole file as context, not just the usual 3 lines")
     +
     + ok(cmp_lines(ut_cmp_equal(c("'Ouch!' he said,", "it was an iron bar."), c("Ooops!", "it was an accident.")),
     + '2 string mismatches',
     + '--- c("\'Ouch!\' he said,", "it was an iron bar.")',
     + '+++ c("Ooops!", "it was an accident.")',
     + "[-'Ouch!' he said,-]{+Ooops!+}",
     + 'it was an [-iron bar.-]{+accident.+}',
     + NULL), "Character vectors get compared one per line")
     +
     + ok(cmp_lines(ut_cmp_equal(as.environment(list(a=3, b=4)), as.environment(list(a=5, b=4, c=9))),
     + 'Length mismatch: comparison on first 2 components',
     + 'Component "a": Mean relative difference: 0.6666667',
     + '--- as.environment(list(a = 3, b = 4))',
     + '+++ as.environment(list(a = 5, b = 4, c = 9))',
     + '{+$c+}',
     + '{+[1] 9+}',
     + '',
     + '$b',
     + '[1] 4',
     + '',
     + '$a',
     + '[1] [-3-]{+5+}',
     + NULL), "Environments get converted to lists")
     + })())
     # ut_cmp_equal
     ok - Identical objects return true
     ok - Equivalent objects return true (i.e. integer vs. number)
     ok - Additional arguments passed through to all.equal
     ok - Vectors filtered by str, individual differences highlighted
     ok - Output of comparision isn't visible (we should print it at a real console though)
     ok - The ---/+++ lines show expressions handed to ut_cmp_equal()
     ok - We return the whole file as context, not just the usual 3 lines
     ok - Character vectors get compared one per line
     not ok - Environments get converted to lists
     # Test returned non-TRUE value:
     # Length mismatch: comparison on first 2 components
     # Component "a": Mean relative difference: 0.6666667
     # <1b>[1m--- as.environment(list(a = 3, b = 4))<1b>[m
     # <1b>[1m+++ as.environment(list(a = 5, b = 4, c = 9))<1b>[m
     # <1b>[32m{+$c
     +}<1b>[m
     # <1b>[32m{+[1] 9+}<1b>[m
     #
     # $b<1b>[m
     # [1] 4<1b>[m
     #
     # $a<1b>[m
     # [1] <1b>[31m[-3-]<1b>[m<1b>[32m{+5+}<1b>[m
     >
     > # Mock git_binary(), so we don't find git even if it is available
     > ok_group("ut_cmp_equal:nogit", mock(unittest:::git_binary, function () "/not-here", {
     + ok(cmp_lines(ut_cmp_equal(c(2,4,2,8), c(5,4,2,1)),
     + 'Mean relative difference: 1',
     + '--- c(2, 4, 2, 8)',
     + '[1] 2 4 2 8',
     + '+++ c(5, 4, 2, 1)',
     + '[1] 5 4 2 1',
     + NULL), "No git available, so show outputs side by side")
     +
     + ok(cmp_lines(ut_cmp_equal(as.environment(list(a=3, b=4)), as.environment(list(a=5, b=4, c=9))),
     + 'Length mismatch: comparison on first 2 components',
     + 'Component "a": Mean relative difference: 0.6666667',
     + '--- as.environment(list(a = 3, b = 4))',
     + '$b',
     + '[1] 4',
     + '',
     + '$a',
     + '[1] 3',
     + '',
     + '+++ as.environment(list(a = 5, b = 4, c = 9))',
     + '$c',
     + '[1] 9',
     + '',
     + '$b',
     + '[1] 4',
     + '',
     + '$a',
     + '[1] 5',
     + '',
     + NULL), "Environments get converted to lists")
     + }))
     # ut_cmp_equal:nogit
     ok - No git available, so show outputs side by side
     ok - Environments get converted to lists
     >
     > ok_group("ut_cmp_identical", (function () {
     + if (!file.exists(unittest:::git_binary())) {
     + ok(TRUE, "# skip git not available")
     + return()
     + }
     +
     + ok(isTRUE(ut_cmp_identical(4, 4)), "Identical objects return true")
     + ok(cmp_lines(ut_cmp_identical(as.integer(4), 4),
     + '--- as.integer(4)',
     + '+++ 4',
     + ' [-int-]{+num+} 4',
     + NULL), "Equivalent objects do not, unlike ut_cmp_equal(). We also fall back to using str(), as print() will produce identical output")
     + })())
     # ut_cmp_identical
     ok - Identical objects return true
     ok - Equivalent objects do not, unlike ut_cmp_equal(). We also fall back to using str(), as print() will produce identical output
     >
     > ok_group("ut_cmp_identical:nogit", mock(unittest:::git_binary, function () "/not-here", {
     + ok(isTRUE(ut_cmp_identical(4, 4)), "Identical objects return true")
     + ok(cmp_lines(ut_cmp_identical(as.integer(4), 4),
     + '--- as.integer(4)',
     + ' int 4',
     + '+++ 4',
     + ' num 4',
     + NULL), "Equivalent objects do not, unlike ut_cmp_equal(). We also fall back to using str(), as print() will produce identical output")
     + }))
     # ut_cmp_identical:nogit
     ok - Identical objects return true
     ok - Equivalent objects do not, unlike ut_cmp_equal(). We also fall back to using str(), as print() will produce identical output
     >
     > proc.time()
     user system elapsed
     0.45 0.06 2.25
     # Looks like you failed 1 of 15 tests.
Flavor: r-devel-windows-x86_64

Version: 1.4-0
Check: tests
Result: ERROR
     Running 'test_non_interactive.R' [6s]
     Running 'test_ok.R' [1s]
     Running 'test_ok_group.R' [0s]
     Running 'test_ut_cmp.R' [2s]
     Running 'test_ut_cmp_error.R' [0s]
    Running the tests in 'tests/test_ut_cmp.R' failed.
    Complete output:
     > options(useFancyQuotes = FALSE) # Force to stabilise all.equal output
     >
     > library(unittest)
     >
     > # Compare character output of a (failing) cmp function, ignoring colors
     > cmp_lines <- function (actual, ...) {
     + # Remove color escape codes
     + no_color <- gsub('\033\\[.*?m', '', actual, perl = TRUE)
     + if(identical(no_color, c(...)[!is.null(c(...))])) {
     + return(TRUE)
     + }
     + # utils::str(no_color, vec.len = 1000, digits.d = 5, nchar.max = 1000)
     + return(actual)
     + }
     >
     > # Mock (fn) in namespace with (replacement) whilst (block) is being evaluated
     > mock <- function (fn, replacement, block) {
     + # Get the name of the function from the unevaluated argument,
     + # assuming it's of the form package::name
     + fn_name <- as.character(as.list(sys.call()[[2]])[[3]])
     + ns <- environment(fn)
     +
     + orig_fn <- get(fn_name, env = ns)
     + unlockBinding(fn_name, env = ns)
     + assign(fn_name, replacement, envir = ns)
     + on.exit(assign(fn_name, orig_fn, envir = ns), add = TRUE)
     +
     + block
     + }
     >
     > ok_group("ut_cmp_equal", (function () {
     + ok(isTRUE(ut_cmp_equal(4, 4)), "Identical objects return true")
     + ok(isTRUE(ut_cmp_equal(as.integer(4), 4)), "Equivalent objects return true (i.e. integer vs. number)")
     + ok(isTRUE(ut_cmp_equal(0.01, 0.02, tolerance = 0.1)), "Additional arguments passed through to all.equal")
     +
     + if (!file.exists(unittest:::git_binary())) {
     + ok(TRUE, "# skip git not available")
     + return()
     + }
     +
     + ok(cmp_lines(ut_cmp_equal(c(2,4,2,8), c(5,4,2,1)),
     + 'Mean relative difference: 1',
     + '--- c(2, 4, 2, 8)',
     + '+++ c(5, 4, 2, 1)',
     + '[1] [-2-]{+5+} 4 2 [-8-]{+1+}',
     + NULL), "Vectors filtered by str, individual differences highlighted")
     +
     + ok(!withVisible(ut_cmp_equal("apples", "oranges"))$visible,
     + "Output of comparision isn't visible (we should print it at a real console though)")
     +
     + do_a_thing <- function (x) seq(x)
     + ok(cmp_lines(ut_cmp_equal(do_a_thing(4), do_a_thing(1 + 2)),
     + 'Numeric: lengths (4, 3) differ',
     + '--- do_a_thing(4)',
     + '+++ do_a_thing(1 + 2)',
     + '[1] 1 2 3[-4-]',
     + NULL), "The ---/+++ lines show expressions handed to ut_cmp_equal()")
     +
     + ok(cmp_lines(ut_cmp_equal(list(c(1, 2, 8), c(2, 3, 2), 10, 11, 12, 13), list(c(1, 2, 3), c(2, 3, 2), 10, 11, 12, 13)),
     + "Component 1: Mean relative difference: 0.625",
     + "--- list(c(1, 2, 8), c(2, 3, 2), 10, 11, 12, 13)",
     + "+++ list(c(1, 2, 3), c(2, 3, 2), 10, 11, 12, 13)",
     + "[[1]]",
     + "[1] 1 2 [-8-]{+3+}",
     + "",
     + "[[2]]",
     + "[1] 2 3 2",
     + "",
     + "[[3]]",
     + "[1] 10",
     + "",
     + "[[4]]",
     + "[1] 11",
     + "",
     + "[[5]]",
     + "[1] 12",
     + "",
     + "[[6]]",
     + "[1] 13",
     + NULL), "We return the whole file as context, not just the usual 3 lines")
     +
     + ok(cmp_lines(ut_cmp_equal(c("'Ouch!' he said,", "it was an iron bar."), c("Ooops!", "it was an accident.")),
     + '2 string mismatches',
     + '--- c("\'Ouch!\' he said,", "it was an iron bar.")',
     + '+++ c("Ooops!", "it was an accident.")',
     + "[-'Ouch!' he said,-]{+Ooops!+}",
     + 'it was an [-iron bar.-]{+accident.+}',
     + NULL), "Character vectors get compared one per line")
     +
     + ok(cmp_lines(ut_cmp_equal(as.environment(list(a=3, b=4)), as.environment(list(a=5, b=4, c=9))),
     + 'Length mismatch: comparison on first 2 components',
     + 'Component "a": Mean relative difference: 0.6666667',
     + '--- as.environment(list(a = 3, b = 4))',
     + '+++ as.environment(list(a = 5, b = 4, c = 9))',
     + '{+$c+}',
     + '{+[1] 9+}',
     + '',
     + '$b',
     + '[1] 4',
     + '',
     + '$a',
     + '[1] [-3-]{+5+}',
     + NULL), "Environments get converted to lists")
     + })())
     # ut_cmp_equal
     ok - Identical objects return true
     ok - Equivalent objects return true (i.e. integer vs. number)
     ok - Additional arguments passed through to all.equal
     ok - Vectors filtered by str, individual differences highlighted
     ok - Output of comparision isn't visible (we should print it at a real console though)
     ok - The ---/+++ lines show expressions handed to ut_cmp_equal()
     ok - We return the whole file as context, not just the usual 3 lines
     ok - Character vectors get compared one per line
     not ok - Environments get converted to lists
     # Test returned non-TRUE value:
     # Length mismatch: comparison on first 2 components
     # Component "a": Mean relative difference: 0.6666667
     # <1b>[1m--- as.environment(list(a = 3, b = 4))<1b>[m
     # <1b>[1m+++ as.environment(list(a = 5, b = 4, c = 9))<1b>[m
     # <1b>[32m{+$c
     +}<1b>[m
     # <1b>[32m{+[1] 9+}<1b>[m
     #
     # $b<1b>[m
     # [1] 4<1b>[m
     #
     # $a<1b>[m
     # [1] <1b>[31m[-3-]<1b>[m<1b>[32m{+5+}<1b>[m
     >
     > # Mock git_binary(), so we don't find git even if it is available
     > ok_group("ut_cmp_equal:nogit", mock(unittest:::git_binary, function () "/not-here", {
     + ok(cmp_lines(ut_cmp_equal(c(2,4,2,8), c(5,4,2,1)),
     + 'Mean relative difference: 1',
     + '--- c(2, 4, 2, 8)',
     + '[1] 2 4 2 8',
     + '+++ c(5, 4, 2, 1)',
     + '[1] 5 4 2 1',
     + NULL), "No git available, so show outputs side by side")
     +
     + ok(cmp_lines(ut_cmp_equal(as.environment(list(a=3, b=4)), as.environment(list(a=5, b=4, c=9))),
     + 'Length mismatch: comparison on first 2 components',
     + 'Component "a": Mean relative difference: 0.6666667',
     + '--- as.environment(list(a = 3, b = 4))',
     + '$b',
     + '[1] 4',
     + '',
     + '$a',
     + '[1] 3',
     + '',
     + '+++ as.environment(list(a = 5, b = 4, c = 9))',
     + '$c',
     + '[1] 9',
     + '',
     + '$b',
     + '[1] 4',
     + '',
     + '$a',
     + '[1] 5',
     + '',
     + NULL), "Environments get converted to lists")
     + }))
     # ut_cmp_equal:nogit
     ok - No git available, so show outputs side by side
     ok - Environments get converted to lists
     >
     > ok_group("ut_cmp_identical", (function () {
     + if (!file.exists(unittest:::git_binary())) {
     + ok(TRUE, "# skip git not available")
     + return()
     + }
     +
     + ok(isTRUE(ut_cmp_identical(4, 4)), "Identical objects return true")
     + ok(cmp_lines(ut_cmp_identical(as.integer(4), 4),
     + '--- as.integer(4)',
     + '+++ 4',
     + ' [-int-]{+num+} 4',
     + NULL), "Equivalent objects do not, unlike ut_cmp_equal(). We also fall back to using str(), as print() will produce identical output")
     + })())
     # ut_cmp_identical
     ok - Identical objects return true
     ok - Equivalent objects do not, unlike ut_cmp_equal(). We also fall back to using str(), as print() will produce identical output
     >
     > ok_group("ut_cmp_identical:nogit", mock(unittest:::git_binary, function () "/not-here", {
     + ok(isTRUE(ut_cmp_identical(4, 4)), "Identical objects return true")
     + ok(cmp_lines(ut_cmp_identical(as.integer(4), 4),
     + '--- as.integer(4)',
     + ' int 4',
     + '+++ 4',
     + ' num 4',
     + NULL), "Equivalent objects do not, unlike ut_cmp_equal(). We also fall back to using str(), as print() will produce identical output")
     + }))
     # ut_cmp_identical:nogit
     ok - Identical objects return true
     ok - Equivalent objects do not, unlike ut_cmp_equal(). We also fall back to using str(), as print() will produce identical output
     >
     > proc.time()
     user system elapsed
     0.40 0.14 2.35
     # Looks like you failed 1 of 15 tests.
Flavor: r-release-windows-x86_64