Skip to content

locale / collation used in testhat #1181

@Christoph999

Description

@Christoph999

As discribed here testthat changed the locale which results in "wrong" test-results (I understand, that reproducibility is an issue). With "wrong" I mean the following: Assume I write a function this_is_tested_to_be_true() based on sort, which passes a test in testthat

this_is_tested_to_be_true <- function() {
  xx <- c("Schaffhausen", "Schwyz", "Seespital", "SRZ")
  r <- all(sort(xx) == c( "SRZ", "Schaffhausen", "Schwyz", "Seespital"))
  return(r)
}

and a test

test_that("test sort 2", {
  test_that(this_is_tested_to_be_true(), TRUE)
})

When I / others use this function in the package, all tests will pass, but in my daily work, it will return FALSE. To me this does not make sense.

What am I missing?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions