Skip to content

Commit

Permalink
One more test
Browse files Browse the repository at this point in the history
I am not sure why it doesn't hit the line that is missing in the coverage report, but one more test is usually welcome anyway.
  • Loading branch information
mailund committed Feb 8, 2018
1 parent 5d5b988 commit decd85d
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions tests/testthat/test-loop-transformation.R
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,15 @@ test_that("We report errors gracefully", {
test_that("we can transform a simple function", {
factorial_acc <- function(n, acc = 1)
if (n <= 1) acc else factorial_acc(n - 1, n * acc)
transformed <- loop_transform(factorial_acc)

for (i in 1:10) {
expect_equal(factorial_acc(i), transformed(i))
}

# also when the return value is in a call...
factorial_acc <- function(n, acc = 1)
if (n <= 1) identity(acc) else factorial_acc(n - 1, n * acc)
transformed <- loop_transform(factorial_acc)

for (i in 1:10) {
Expand Down

0 comments on commit decd85d

Please sign in to comment.