Skip to content

Commit

Permalink
Added another test for #832.
Browse files Browse the repository at this point in the history
  • Loading branch information
arunsrinivasan committed Feb 9, 2015
1 parent 559f58c commit 880b884
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
5 changes: 4 additions & 1 deletion R/data.table.R
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,10 @@ print.data.table <- function(x,
is.formula <- function(x) class(x) == "formula"

format.data.table <- function (x, ..., justify="none") {
format.item <- function(x) {
if (is.atomic(x) && !is.null(x)) {
stop("Internal structure doesn't seem to be a list. Possibly corrupt data.table.")
}
format.item <- function(x) {
if (is.atomic(x) || is.formula(x)) # FR #2591 - format.data.table issue with columns of class "formula"
paste(c(format(head(x,6), justify=justify, ...), if(length(x)>6)""),collapse=",") # fix for #5435 - format has to be added here...
else
Expand Down
6 changes: 5 additions & 1 deletion inst/tests/tests.Rraw
Original file line number Diff line number Diff line change
Expand Up @@ -5982,7 +5982,11 @@ test(1486.2, as.data.frame(ans2.1), as.data.frame(ans2.1))
# Fix for #832
x <- matrix(1:9, ncol=3)
setattr(x, "names", paste("V", seq_len(length(x)), sep = ""))
test(1486.3, setattr(x, "class", c("data.table", "data.frame")), error="Internal structure doesn't seem to be a list")
test(1487.1, setattr(x, "class", c("data.table", "data.frame")), error="Internal structure doesn't seem to be a list")
x <- matrix(1:9, ncol=3)
class(x) = c("data.table", "data.frame")
# not sure how to test this one, so using `tryCatch`
test(1487.2, tryCatch(print(x), error=function(k) "bla"), "bla")

##########################

Expand Down

0 comments on commit 880b884

Please sign in to comment.