R-vctrs/0001-Skip-some-tests-on-big-endian-machines.patch
2022-07-20 19:16:36 +08:00

95 lines
3.0 KiB
Diff

From 6ada17c4c4c38716ece922e99493027c3d04f467 Mon Sep 17 00:00:00 2001
From: Elliott Sales de Andrade <quantum.analyst@gmail.com>
Date: Sun, 25 Apr 2021 02:35:26 -0400
Subject: [PATCH] Skip some tests on big-endian machines.
Signed-off-by: Elliott Sales de Andrade <quantum.analyst@gmail.com>
---
tests/testthat/test-assert.R | 1 +
tests/testthat/test-cast.R | 1 +
tests/testthat/test-partial-factor.R | 36 +++++++++++++++-------------
3 files changed, 22 insertions(+), 16 deletions(-)
diff --git a/tests/testthat/test-assert.R b/tests/testthat/test-assert.R
index 8c073931..02d02362 100644
--- a/tests/testthat/test-assert.R
+++ b/tests/testthat/test-assert.R
@@ -192,6 +192,7 @@ test_that("unspecified is finalised before assertion", {
test_that("assertion failures are explained", {
expect_known_output(file = test_path("test-assert-explanations.txt"), {
+ skip_if(.Platform$endian == "big")
local_no_stringsAsFactors()
local_options(rlang_backtrace_on_error = "none")
diff --git a/tests/testthat/test-cast.R b/tests/testthat/test-cast.R
index e4fc08ec..83d0ac06 100644
--- a/tests/testthat/test-cast.R
+++ b/tests/testthat/test-cast.R
@@ -56,6 +56,7 @@ test_that("cast common preserves names", {
test_that("cast errors create helpful messages (#57, #225)", {
expect_known_output(file = test_path("test-cast-error-nested.txt"), {
+ skip_if(.Platform$endian == "big")
# Lossy cast
try2(vec_cast("foo", 10))
diff --git a/tests/testthat/test-partial-factor.R b/tests/testthat/test-partial-factor.R
index 7bf52365..c25a4aaf 100644
--- a/tests/testthat/test-partial-factor.R
+++ b/tests/testthat/test-partial-factor.R
@@ -1,16 +1,18 @@
test_that("has ok print method", {
- partial <- partial_factor("x")
- expect_known_output(
- print(partial),
- test_path("test-partial-factor-print-partial.txt")
- )
+ if (.Platform$endian == "little") {
+ partial <- partial_factor("x")
+ expect_known_output(
+ print(partial),
+ test_path("test-partial-factor-print-partial.txt")
+ )
- both <- vec_ptype2(partial, factor("y"))
- expect_known_output(
- print(both),
- test_path("test-partial-factor-print-both.txt")
- )
+ both <- vec_ptype2(partial, factor("y"))
+ expect_known_output(
+ print(both),
+ test_path("test-partial-factor-print-both.txt")
+ )
+ }
empty <- partial_factor()
expect_known_output(
@@ -18,13 +20,15 @@ test_that("has ok print method", {
test_path("test-partial-factor-print-empty.txt")
)
- learned <- vec_ptype2(empty, factor("y"))
- expect_known_output(
- print(learned),
- test_path("test-partial-factor-print-learned.txt")
- )
+ if (.Platform$endian == "little") {
+ learned <- vec_ptype2(empty, factor("y"))
+ expect_known_output(
+ print(learned),
+ test_path("test-partial-factor-print-learned.txt")
+ )
- expect_equal(vec_ptype_abbr(partial), "prtl_fctr")
+ expect_equal(vec_ptype_abbr(partial), "prtl_fctr")
+ }
})
test_that("order of levels comes from data", {
--
2.29.2