Skip to content

Commit

Permalink
Use %s in 'should be TRUE or FALSE' messages (#6075)
Browse files Browse the repository at this point in the history
* refactor should be TF messages

* revert R-level message

* consistency

* changed msg in nafill, changed test 2003.2 to align with consistency

---------

Co-authored-by: Michael Chirico <michaelchirico4@gmail.com>
  • Loading branch information
joshhwuu and MichaelChirico authored Apr 11, 2024
1 parent 2de34e7 commit 3171397
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion inst/tests/tests.Rraw
Original file line number Diff line number Diff line change
Expand Up @@ -14366,7 +14366,7 @@ test(2002.12, rbind(DT1, DT2, idcol='id'), data.table(id=integer(), a=logica

#rbindlist coverage
test(2003.1, rbindlist(list(), use.names=1), error="use.names= should be TRUE, FALSE, or not used [(]\"check\" by default[)]")
test(2003.2, rbindlist(list(), fill=1), error="fill= should be TRUE or FALSE")
test(2003.2, rbindlist(list(), fill=1), error="fill should be TRUE or FALSE")
test(2003.3, rbindlist(list(data.table(a=1:2), data.table(b=3:4)), fill=TRUE, use.names=FALSE),
data.table(a=c(1:4)))
test(2003.4, rbindlist(list(data.table(a=1:2,c=5:6), data.table(b=3:4)), fill=TRUE, use.names=FALSE),
Expand Down
2 changes: 1 addition & 1 deletion src/fastmean.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ SEXP fastmean(SEXP args)
if (length(args)>2) {
tmp = CADDR(args);
if (!isLogical(tmp) || LENGTH(tmp)!=1 || LOGICAL(tmp)[0]==NA_LOGICAL)
error(_("narm should be TRUE or FALSE")); // # nocov ; [.data.table should construct the .External call correctly
error(_("%s should be TRUE or FALSE"), "narm"); // # nocov ; [.data.table should construct the .External call correctly
narm=LOGICAL(tmp)[0];
}
PROTECT(ans = allocNAVector(REALSXP, 1));
Expand Down
2 changes: 1 addition & 1 deletion src/nafill.c
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ SEXP nafillR(SEXP obj, SEXP type, SEXP fill, SEXP nan_is_na_arg, SEXP inplace, S

bool binplace = LOGICAL(inplace)[0];
if (!IS_TRUE_OR_FALSE(nan_is_na_arg))
error(_("nan_is_na must be TRUE or FALSE")); // # nocov
error(_("%s must be TRUE or FALSE"), "nan_is_na"); // # nocov
bool nan_is_na = LOGICAL(nan_is_na_arg)[0];

SEXP x = R_NilValue;
Expand Down
2 changes: 1 addition & 1 deletion src/rbindlist.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
SEXP rbindlist(SEXP l, SEXP usenamesArg, SEXP fillArg, SEXP idcolArg)
{
if (!isLogical(fillArg) || LENGTH(fillArg) != 1 || LOGICAL(fillArg)[0] == NA_LOGICAL)
error(_("fill= should be TRUE or FALSE"));
error(_("%s should be TRUE or FALSE"), "fill");
if (!isLogical(usenamesArg) || LENGTH(usenamesArg)!=1)
error(_("use.names= should be TRUE, FALSE, or not used (\"check\" by default)")); // R levels converts "check" to NA
if (!length(l)) return(l);
Expand Down

0 comments on commit 3171397

Please sign in to comment.