Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
hsonne committed Aug 6, 2023
1 parent 10e0109 commit 3038c4e
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion tests/testthat/test-function-duplicatesToFiles.R
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@ test_that("duplicatesToFiles() works", {
capture.output(path <- f(trees, fun_duplicates, function_name = "f1"))

expect_true(file.exists(path))
expect_true(length(dir(path, "^f1")) > 0L)
expect_true(any(grepl("^f1__", basename(path))))

})
6 changes: 4 additions & 2 deletions tests/testthat/test-function-get_elements_by_type.R
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
test_that("get_elements_by_type() works", {

f <- function(...) kwb.code:::get_elements_by_type(..., dbg = FALSE)
f <- function(...) {
kwb.code:::get_elements_by_type(..., dbg = FALSE)
}

expect_error(f())

x <- parse(text = "square <- function(x) x * x")

result <- f(x)
expect_output(result <- f(x))

expect_type(result, "list")
expect_true("language|call|<-|3|" %in% names(result))
Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/test-function-writeContentsToFiles.R
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ test_that("writeContentsToFiles() works", {

capture.output(f(list("a", "b"), target_dir, "f"))

expect_true(all(c("f_1.txt", "f_2.txt") %in% dir(target_dir)))
expect_true(all(c("f__1.txt", "f__2.txt") %in% dir(target_dir)))
})
2 changes: 1 addition & 1 deletion tests/testthat/test-function-writeContentsToLessFiles.R
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ test_that("writeContentsToLessFiles() works", {

capture.output(f(list("a", "b"), target_dir, "f"))

expect_true(all(c("f__v_1.txt", "f__v_2.txt") %in% dir(target_dir)))
expect_true(all(c("f__unique-1.txt", "f__unique-2.txt") %in% dir(target_dir)))
})

0 comments on commit 3038c4e

Please sign in to comment.