# ---------------------------------------------------------------
#
# Author : Damian Skrzypiec <damian.j.skrzypiec@gmail.com>
#
# Date : 2017-12-29 23:40:35
#
# Description: Test for structure analysis funcs.
#
# ---------------------------------------------------------------
testthat::context("Structure Analysis")
testthat::test_that("is.file func", {
testthat::expect_equal(object = is.file("file.txt"), expected = TRUE)
testthat::expect_equal(object = is.file("SomeFile_asd.R"), expected = TRUE)
testthat::expect_equal(object = is.file("file.txt.R.txt"), expected = FALSE)
testthat::expect_equal(object = is.file("fileName"), expected = FALSE)
})
testthat::test_that("is.Rfile func", {
testthat::expect_false(is.Rfile("random"))
testthat::expect_false(is.Rfile("file.txt"))
testthat::expect_false(is.Rfile("file.cpp"))
testthat::expect_false(is.Rfile(""))
testthat::expect_true(is.Rfile("someName.R"))
testthat::expect_true(is.Rfile(".R"))
testthat::expect_true(is.Rfile("^.R"))
testthat::expect_true(is.Rfile("Another.R"))
})
testthat::test_that("getLastEleOfPath func", {
testthat::expect_error(getLastEleOfPath("randomText"))
testthat::expect_error(getLastEleOfPath(.GlobalEnv))
})
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.