tests/testthat/test-Helpers.R

context("Helper Functions")

test_that("key-interpolation", {
    value <- "%(bar)s is %(baz)s"
    option1 <- ConfigParser:::interpolation_option(value)
    expect_equal(option1, "baz")
    value <- ConfigParser:::do_replacement(value, option1, "too short")
    option2 <- ConfigParser:::interpolation_option(value)
    expect_equal(option2, "bar")
    value <- ConfigParser:::do_replacement(value, option2, "Life")
    expect_equal(value, "Life is too short")
})

Try the ConfigParser package in your browser

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

ConfigParser documentation built on May 2, 2019, 7:57 a.m.