AMR/tests/testthat/test-misc.R

21 lines
614 B
R
Raw Normal View History

2018-03-27 17:43:42 +02:00
context("misc.R")
test_that("`like` works", {
expect_true("test" %like% "^t")
expect_true("test" %like% "test")
expect_true("test" %like% "TEST")
expect_true(as.factor("test") %like% "TEST")
})
test_that("percentages works", {
expect_equal(percent(0.25), "25%")
expect_equal(percent(0.5), "50%")
expect_equal(percent(0.1234), "12.3%")
})
test_that("quasiquotation works", {
expect_equal(quasiquotate(deparse(substitute("test")), "test"), "test")
expect_equal(quasiquotate(deparse(substitute('test')), "'test'"), "test")
expect_equal(quasiquotate(deparse(substitute(test)), test), "test")
})