Skip to content

Commit

Permalink
Add tests for issue #4
Browse files Browse the repository at this point in the history
  • Loading branch information
viking committed Nov 8, 2017
1 parent 292ab62 commit ef19737
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions pkg/tests/testthat/test_as_yaml.R
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,18 @@ test_that("unicode strings are escaped", {
expect_equal("\"\\xE9\"\n", result, expected.label = result)
})

test_that("unicode strings are not escaped by default", {
x <- list('é')
result <- as.yaml(x)
expect_equal("- é\n", result, expected.label = result)
})

test_that("named list with unicode character is correct converted", {
x <- list(special.char = "é")
result <- as.yaml(x)
expect_equal("special.char: é\n", result, expected.label = result)
})

test_that("unknown objects cause error", {
expect_that(as.yaml(expression(foo <- bar)), throws_error())
})
Expand Down

0 comments on commit ef19737

Please sign in to comment.