-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move UTF-8 tests to another file to conceal them from platforms that …
…cannot parse them
- Loading branch information
Neal Richardson
committed
Apr 14, 2015
1 parent
544198d
commit 7f74971
Showing
2 changed files
with
37 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,7 @@ | ||
context("UTF-8 Encoding") | ||
|
||
if (run.integration.tests) { | ||
test_that("encoding + JSON reads correctly", { | ||
s <- iconv("aided_follow_grid:ElCorteInglés", to="UTF-8") | ||
expect_identical(Encoding(s), "UTF-8") | ||
expect_true(grepl("Inglés", s)) | ||
sj <- toJSON(s) | ||
expect_true(grepl("Inglés", sj)) | ||
s2 <- fromJSON(sj) | ||
expect_identical(s2, s) | ||
expect_identical(fromJSON("utf-test.json"), "Budějovický Budvar") | ||
}) | ||
|
||
with(fake.HTTP, { | ||
ds <- loadDataset("test ds") | ||
test_that("Reading UTF in tests", { | ||
expect_identical(description(ds$mymrset), "Budějovický Budvar") | ||
}) | ||
}) | ||
|
||
with(test.authentication, { | ||
with(test.dataset(df), { | ||
test_that("Properly encoded UTF is sent and received", { | ||
s <- iconv("aided_follow_grid:ElCorteInglés", to="UTF-8") | ||
name(ds$v1) <- s | ||
expect_identical(name(ds$v1), s) | ||
expect_identical(name(refresh(ds)$v1), s) | ||
s2 <- "Budějovický Budvar" | ||
name(ds$v2) <- s2 | ||
expect_identical(name(ds$v2), s2) | ||
expect_identical(name(refresh(ds)$v2), s2) | ||
}) | ||
}) | ||
}) | ||
## Move the actual tests to a different file so that non-Unicode | ||
## environments won't fail to parse (even if not running these tests) | ||
source("utftesting.R", local=TRUE) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
test_that("encoding + JSON reads correctly", { | ||
s <- iconv("aided_follow_grid:ElCorteInglés", to="UTF-8") | ||
expect_identical(Encoding(s), "UTF-8") | ||
expect_true(grepl("Inglés", s)) | ||
sj <- toJSON(s) | ||
expect_true(grepl("Inglés", sj)) | ||
s2 <- fromJSON(sj) | ||
expect_identical(s2, s) | ||
expect_identical(fromJSON("utf-test.json"), "Budějovický Budvar") | ||
}) | ||
|
||
with(fake.HTTP, { | ||
ds <- loadDataset("test ds") | ||
test_that("Reading UTF in tests", { | ||
expect_identical(description(ds$mymrset), "Budějovický Budvar") | ||
}) | ||
}) | ||
|
||
with(test.authentication, { | ||
with(test.dataset(df), { | ||
test_that("Properly encoded UTF is sent and received", { | ||
s <- iconv("aided_follow_grid:ElCorteInglés", to="UTF-8") | ||
name(ds$v1) <- s | ||
expect_identical(name(ds$v1), s) | ||
expect_identical(name(refresh(ds)$v1), s) | ||
s2 <- "Budějovický Budvar" | ||
name(ds$v2) <- s2 | ||
expect_identical(name(ds$v2), s2) | ||
expect_identical(name(refresh(ds)$v2), s2) | ||
}) | ||
}) | ||
}) | ||
|
||
( |