Skip to content

Commit

Permalink
test error messages
Browse files Browse the repository at this point in the history
  • Loading branch information
tdhock committed Jul 1, 2023
1 parent d597620 commit e8ecedc
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions inst/tests/tests.Rraw
Original file line number Diff line number Diff line change
Expand Up @@ -17194,7 +17194,7 @@ test(2183.00002, melt(DTid, measure.vars=measurev(list(value.name=NULL, num=as.c
test(2183.00004, melt(DTid, measure.vars=measurev(list(value.name=NULL, istr=NULL), pattern="([ab])([12])"))[order(b)], data.table(id=1, istr=paste(c(1,2)), a=c(NA, 2), b=c(1,2)))
test(2183.00005, melt(DTid, measure.vars=measurev(list(column=NULL, istr=NULL), pattern="([ab])([12])", multiple.keyword="column"))[order(b)], data.table(id=1, istr=paste(c(1,2)), a=c(NA, 2), b=c(1,2)))#same computation but different multiple.keyword
iris.dt = data.table(datasets::iris)
test(2183.00020, melt(iris.dt, measure.vars=measurev(value.name, dim, sep=".", pattern="foo")), error="both sep and pattern arguments used; must use either sep or pattern (not both)")
test(2183.00020, melt(iris.dt, measure.vars=measurev(list(value.name=NULL, dim=NULL), sep=".", pattern="foo")), error="both sep and pattern arguments used; must use either sep or pattern (not both)")
test(2183.000201, melt(iris.dt, measure.vars=measurev(list(NULL, dim=NULL), sep=".")), error="in measurev, elements of fun.list must be named, problems: [1]")
test(2183.000202, melt(iris.dt, measure.vars=measurev(list(NULL, NULL), sep=".")), error="in measurev, elements of fun.list must be named, problems: [1, 2]")
test(2183.00027, melt(iris.dt, measure.vars=measurev(list(value.name=NULL, dim="bar"), sep=".")), error="in the measurev fun.list, each non-NULL element must be a function with at least one argument, problem: dim")
Expand Down Expand Up @@ -17284,9 +17284,10 @@ test(2183.74, melt(DTid, measure.vars=measure(letter, number, multiple.keyword=a
test(2183.75, melt(DTid, measure.vars=measure(letter, number, multiple.keyword=NA_character_, pattern="([ab])([12])")), error="multiple.keyword must be a character string")
test(2183.76, melt(DTid, measure.vars=measure(letter, number, multiple.keyword="", pattern="([ab])([12])")), error="multiple.keyword must be a character string with nchar>0")
test(2183.77, melt(DTid, measure.vars=measure(letter, cols, pattern="([ab])([12])")), error="group names specified in ... conflict with measure argument names; please fix by changing group names: [cols]")
test(2183.78, melt(DTid, measure.vars=measure(letter, cols=as.integer, pattern="([ab])([12])")), error="cols must be a character vector of column names")
test(2183.78, melt(DTid, measure.vars=measure(letter, cols=as.integer, pattern="([ab])([12])")), error="user should not provide cols argument to measure")
test(2183.79, melt(DTid, measure.vars=measure(letter, number, pattern=as.integer)), error="pattern must be character string")
test(2183.80, melt(DTid, measure.vars=measure(letter, number, sep=as.integer)), error="sep must be character string")
test(2183.81, data.table:::measure(cols=as.integer), error="cols must be a character vector of column names")

# `keyby` allows mixing eval/get with direct columns, #4981
dt <- data.table(a=c(1,2), b=c(3,4), c=c(1,0))
Expand Down

0 comments on commit e8ecedc

Please sign in to comment.