Page MenuHomePhabricator

Unit tests are failing on Ubuntu due to mismatching messages
Closed, ResolvedPublic

Description

Unit tests that expect message strings having escaped quotation marks are failing on Ubuntu 18.04 (R version 4.0.3, testthat 3.0.0).

Example:

── Failure (test-aggregateThenRank.R:131:3): aggregate-then-rank raises error fo
`challenge %>% aggregateThenRank(FUN = mean, ties.method = "maxx")` threw an error with unexpected message.
Expected match: "'arg' should be one of \"average\", \"first\", \"last\", \"random\", \"max\", \"min\""
Actual message: "'arg' should be one of “average”, “first”, “last”, “random”, “max”, “min”"

Event Timeline

eisenman created this task.
eisenman moved this task from Backlog to In Progress on the challengeR (v1.0) board.

After investing several hour trying different encodings, e.g. using raw strings, I still don't find a way to make this work. I also don't see a way of changing the source message, because it's originating from another package.

What about testing only for the beginning of the message?
"'arg' should be one of"

good idea!
otherwise you could use a platform dependent expect_equal but I think your idea is sufficient

platform is output with Sys.info(); linux and Mac systems are equal and windows may differ