From b049b9caa62fb6b3a62aece242f33b2be99b0a9d Mon Sep 17 00:00:00 2001 From: JamesThompsonC Date: Wed, 2 Jul 2025 14:41:05 -0400 Subject: [PATCH] Update expectations.R use the first value returned by class() to construct error message --- pkg/R/expectations.R | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/R/expectations.R b/pkg/R/expectations.R index d844e2b..1079164 100644 --- a/pkg/R/expectations.R +++ b/pkg/R/expectations.R @@ -395,7 +395,7 @@ expect_true <- function(current, info=NA_character_){ this <- if ( isFALSE(current) ) "FALSE" else if ( length(current) == 1 && is.na(current)) "NA" else if ( is.logical(current)) sprintf("'logical' of length %d",length(current)) - else sprintf("object of class '%s'",class(current)) + else sprintf("object of class '%s'",class(current)[1]) diff <- sprintf("Expected TRUE, got %s", this) short <- shortdiff(TRUE, FALSE) tinytest(result, call=call,diff=diff, short=short, info=info) @@ -413,7 +413,7 @@ expect_false <- function(current, info=NA_character_){ this <- if ( isTRUE(current) ) "TRUE" else if (length(current) == 1 && is.na(current)) "NA" else if (is.logical(current)) sprintf("'logical' of length %d",length(current)) - else sprintf("object of class '%s'",class(current)) + else sprintf("object of class '%s'",class(current)[1]) diff <- sprintf("Expected FALSE, got %s", this) short <- shortdiff(TRUE, FALSE) tinytest(result, call=call,diff=diff, short=short, info=info)