diff --git a/DESCRIPTION b/DESCRIPTION index 06164f3c9..0a3d11496 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -21,6 +21,7 @@ Imports: Rcpp Suggests: testthat, + withr, knitr, rmarkdown, Lahman (>= 3.0.1), diff --git a/R/type-sum.r b/R/type-sum.r index bd94a2e8a..ed9bf8149 100644 --- a/R/type-sum.r +++ b/R/type-sum.r @@ -16,9 +16,10 @@ #' obj_sum(mean) #' @export obj_sum <- function(x) UseMethod("obj_sum") + #' @export obj_sum.default <- function(x) { - paste0(type_sum(x), if (is_vector_s3(x)) size_sum(x)) + paste0(type_sum(x), size_sum(x)) } #' @export @@ -54,7 +55,7 @@ type_sum.default <- function(x) { } size_sum <- function(x) { - if (!is_vector(x)) return("") + if (!is_vector_s3(x)) return("") dim <- dim(x) %||% length(x) paste0(" [", paste0(dim, collapse = ","), "]" ) diff --git a/tests/testthat/output/glimpse/iris-empty-70.txt b/tests/testthat/output/glimpse/iris-empty-70.txt new file mode 100644 index 000000000..55f1ceb7b --- /dev/null +++ b/tests/testthat/output/glimpse/iris-empty-70.txt @@ -0,0 +1 @@ +Observations: 150 diff --git a/tests/testthat/output/trunc_mat/iris--70.txt b/tests/testthat/output/trunc_mat/iris--70.txt new file mode 100644 index 000000000..d08c54169 --- /dev/null +++ b/tests/testthat/output/trunc_mat/iris--70.txt @@ -0,0 +1,15 @@ +Source: local data frame [150 x 5] + + Sepal.Length Sepal.Width Petal.Length Petal.Width Species + +1 5.1 3.5 1.4 0.2 setosa +2 4.9 3.0 1.4 0.2 setosa +3 4.7 3.2 1.3 0.2 setosa +4 4.6 3.1 1.5 0.2 setosa +5 5.0 3.6 1.4 0.2 setosa +6 5.4 3.9 1.7 0.4 setosa +7 4.6 3.4 1.4 0.3 setosa +8 5.0 3.4 1.5 0.2 setosa +9 4.4 2.9 1.4 0.2 setosa +10 4.9 3.1 1.5 0.1 setosa +.. ... ... ... ... ... diff --git a/tests/testthat/output/trunc_mat/knit-120.txt b/tests/testthat/output/trunc_mat/knit-120.txt new file mode 100644 index 000000000..9ad39aef2 --- /dev/null +++ b/tests/testthat/output/trunc_mat/knit-120.txt @@ -0,0 +1,5 @@ +[1] "\n\n|a |b |c |d |e |f |g |h |\n|:-----|:-----|:-----|:-----|:------|:----------|:-------------------|:---------|\n| | | | | | |