tests/testthat/test-encoding.r

context('encoding')

test_that('source is read as UTF-8', {
    box::use(mod/a)
    expected_bytes = as.raw(c(0xE2, 0x98, 0x83))
    expect_equal(nchar(a$encoding_test(), 'bytes'), 3L)
    expect_equal(Encoding(a$encoding_test()), 'UTF-8')
    expect_equal(charToRaw(a$encoding_test()), expected_bytes)
})

Try the box package in your browser

Any scripts or data that you put into this service are public.

box documentation built on May 2, 2023, 9:14 a.m.