diff --git a/DESCRIPTION b/DESCRIPTION
index 5ef666c..21744c0 100644
--- a/DESCRIPTION
+++ b/DESCRIPTION
@@ -31,7 +31,7 @@ Suggests:
covr,
bit64,
withr
-RoxygenNote: 7.3.2
+RoxygenNote: 7.3.3
Roxygen: list(markdown = TRUE)
VignetteBuilder: knitr
License: MIT + file LICENSE
diff --git a/R/diffdf.R b/R/diffdf.R
index fc1ceb6..1039512 100644
--- a/R/diffdf.R
+++ b/R/diffdf.R
@@ -113,8 +113,15 @@ diffdf <- function(
class(COMPARE) <- c("diffdf", "list")
- BASE_NAME <- deparse(substitute(base))
- COMP_NAME <- deparse(substitute(compare))
+ BASE_NAME <- deparse(substitute(base), width.cutoff = 30L)
+ if (length(BASE_NAME) > 1) {
+ BASE_NAME <- ""
+ }
+ COMP_NAME <- deparse(substitute(compare), width.cutoff = 30L)
+ if (length(COMP_NAME) > 1) {
+ COMP_NAME <- ""
+ }
+
COMPARE[["DataSummary"]] <- construct_issue(
value = describe_dataframe(BASE, COMP, BASE_NAME, COMP_NAME),
message = "Summary of BASE and COMPARE"
diff --git a/tests/testthat/_snaps/miscellaneous.md b/tests/testthat/_snaps/miscellaneous.md
index f6ffc21..798a7be 100644
--- a/tests/testthat/_snaps/miscellaneous.md
+++ b/tests/testthat/_snaps/miscellaneous.md
@@ -305,6 +305,154 @@
+# #133 - Nested calls don't throw error with deparse
+
+ Code
+ diffdf(d1, d2, suppress_warnings = TRUE)
+ Output
+ Differences found between the objects!
+
+ Summary of BASE and COMPARE
+ ==================================================================
+ PROPERTY BASE COMP
+ ------------------------------------------------------------------
+ Name d1 d2
+ Class "tbl_df, tbl, data.frame" "tbl_df, tbl, data.frame"
+ Rows(#) 4 4
+ Columns(#) 2 2
+ ------------------------------------------------------------------
+
+
+ Not all Values Compared Equal
+ =============================
+ Variable No of Differences
+ -----------------------------
+ x 4
+ -----------------------------
+
+
+ ========================================
+ VARIABLE ..ROWNUMBER.. BASE COMPARE
+ ----------------------------------------
+ x 1 1 2
+ x 2 2 3
+ x 3 3 4
+ x 4 4 5
+ ----------------------------------------
+
+
+
+---
+
+ Code
+ diffdf(d1, dplyr::mutate(d1, x = x + 1), suppress_warnings = TRUE)
+ Output
+ Differences found between the objects!
+
+ Summary of BASE and COMPARE
+ =======================================================================
+ PROPERTY BASE COMP
+ -----------------------------------------------------------------------
+ Name d1 "dplyr::mutate(d1, x = x + 1)"
+ Class "tbl_df, tbl, data.frame" "tbl_df, tbl, data.frame"
+ Rows(#) 4 4
+ Columns(#) 2 2
+ -----------------------------------------------------------------------
+
+
+ Not all Values Compared Equal
+ =============================
+ Variable No of Differences
+ -----------------------------
+ x 4
+ -----------------------------
+
+
+ ========================================
+ VARIABLE ..ROWNUMBER.. BASE COMPARE
+ ----------------------------------------
+ x 1 1 2
+ x 2 2 3
+ x 3 3 4
+ x 4 4 5
+ ----------------------------------------
+
+
+
+---
+
+ Code
+ diffdf(d1, dplyr::mutate(d1, x = x + x + x + x), suppress_warnings = TRUE)
+ Output
+ Differences found between the objects!
+
+ Summary of BASE and COMPARE
+ ==================================================================
+ PROPERTY BASE COMP
+ ------------------------------------------------------------------
+ Name d1
+ Class "tbl_df, tbl, data.frame" "tbl_df, tbl, data.frame"
+ Rows(#) 4 4
+ Columns(#) 2 2
+ ------------------------------------------------------------------
+
+
+ Not all Values Compared Equal
+ =============================
+ Variable No of Differences
+ -----------------------------
+ x 4
+ -----------------------------
+
+
+ ========================================
+ VARIABLE ..ROWNUMBER.. BASE COMPARE
+ ----------------------------------------
+ x 1 1 4
+ x 2 2 8
+ x 3 3 12
+ x 4 4 16
+ ----------------------------------------
+
+
+
+---
+
+ Code
+ diffdf(dplyr::mutate(d1, x = x + x + x + x), d1, suppress_warnings = TRUE)
+ Output
+ Differences found between the objects!
+
+ Summary of BASE and COMPARE
+ ==================================================================
+ PROPERTY BASE COMP
+ ------------------------------------------------------------------
+ Name d1
+ Class "tbl_df, tbl, data.frame" "tbl_df, tbl, data.frame"
+ Rows(#) 4 4
+ Columns(#) 2 2
+ ------------------------------------------------------------------
+
+
+ Not all Values Compared Equal
+ =============================
+ Variable No of Differences
+ -----------------------------
+ x 4
+ -----------------------------
+
+
+ ========================================
+ VARIABLE ..ROWNUMBER.. BASE COMPARE
+ ----------------------------------------
+ x 1 4 1
+ x 2 8 2
+ x 3 12 3
+ x 4 16 4
+ ----------------------------------------
+
+
+
# `as_ascii_table() can handle missing datetimes (#132)
Code
diff --git a/tests/testthat/test-miscellaneous.R b/tests/testthat/test-miscellaneous.R
index 28e7255..78b12e7 100644
--- a/tests/testthat/test-miscellaneous.R
+++ b/tests/testthat/test-miscellaneous.R
@@ -254,6 +254,44 @@ test_that("datetimes compare as expected", {
})
+test_that("#133 - Nested calls don't throw error with deparse", {
+ d1 <- tibble(id = c(1, 2, 3, 4), x = c(1, 2, 3, 4))
+
+ expect_no_condition({
+ tibble(id = c(1, 2, 3, 4), x = c(1, 2, 3, 4)) |>
+ dplyr::mutate(x = x + 1) |>
+ diffdf(d1, suppress_warnings = TRUE)
+ })
+
+ d2 <- tibble(id = c(1, 2, 3, 4), x = c(1, 2, 3, 4) + 1)
+ expect_snapshot(diffdf(d1, d2, suppress_warnings = TRUE))
+
+ expect_snapshot(
+ diffdf(
+ d1,
+ d1 |> dplyr::mutate(x = x + 1),
+ suppress_warnings = TRUE
+ )
+ )
+
+ expect_snapshot(
+ diffdf(
+ d1,
+ d1 |> dplyr::mutate(x = x + x + x + x),
+ suppress_warnings = TRUE
+ )
+ )
+
+ expect_snapshot(
+ diffdf(
+ d1 |> dplyr::mutate(x = x + x + x + x),
+ d1,
+ suppress_warnings = TRUE
+ )
+ )
+})
+
+
testthat::test_that("#138 - No partial arg matches", {
withr::local_options(
list(
@@ -287,6 +325,7 @@ testthat::test_that("#138 - No partial arg matches", {
})
})
+
test_that("`as_ascii_table() can handle missing datetimes (#132)", {
d1 <- tibble(
id = c(1, 2, 3),