test_that("checkStyle returns correct type", {
testFile <- system.file("testScript_checkStyle.R", package = "INWTUtils")
expect_true(file.exists(testFile))
erg <- checkStyle(testFile, type = "script")
expect_s3_class(erg, "lints")
expect_true(all(sapply(erg, inherits, "lint")))
})
test_that("checkStyle returns correct content", {
erg <- checkStyle(system.file("testScript_checkStyle.R",
package = "INWTUtils"),
type = "script")
expect_true(erg[[2]]$message == "Use <-, not =, for assignment.")
expect_true(erg[[3]]$message == "Commas should always have a space after.")
expect_true(erg[[4]]$message == "Inappropriate spacing between elements in code content detected.")
expect_true(erg[[5]]$message == "Inappropriate spacing between elements in non-code content detected.")
expect_true(erg[[6]]$message == "Put spaces around all infix operators.")
expect_true(grepl("Lines should not be more than 100 characters", erg[[7]]$message))
expect_true(erg[[8]]$message == paste("Variable and function names should",
"not be longer than 30 characters."))
expect_true(paste0(strsplit(erg[[9]]$message, "\\. ")[[1]][1], ".") == "Operator `:::` is undesirable.")
expect_true(erg[[10]]$message == paste("Place a space before left",
"parenthesis, except in a function",
"call."))
expect_true(erg[[length(erg)]]$message == "Trailing blank lines are superfluous.")
})
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.