test_that("e_to_afl handles basic inputs", {
expect_equal(aflutils$e_to_afl(rlang::exprs(1)), "1")
expect_equal(aflutils$e_to_afl(rlang::exprs(-1)), "-1")
expect_equal(aflutils$e_to_afl(rlang::exprs(a)), "a")
expect_equal(aflutils$e_to_afl(rlang::exprs(A)), "A")
expect_equal(aflutils$e_to_afl(rlang::exprs(1-1)), "1 - 1")
expect_equal(aflutils$e_to_afl(rlang::exprs(2 + 1)), "2 + 1")
})
test_that("e_to_afl 'if then else' to 'iff()'", {
expect_equal(aflutils$e_to_afl(rlang::exprs(if(a==2) x else y)),
"iif(a = 2,x,y)")
expect_equal(aflutils$e_to_afl(rlang::exprs(if(a==2) -1 else y)),
"iif(a = 2,-1,y)")
expect_equal(aflutils$e_to_afl(rlang::exprs(if(a==2) 4-1 else x-y)),
"iif(a = 2,4 - 1,x - y)")
})
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.