Skip to content

Commit

Permalink
another test
Browse files Browse the repository at this point in the history
  • Loading branch information
mailund committed Feb 7, 2018
1 parent b12cdd6 commit 7d8a1a2
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions tests/testthat/test-loop-transformation.R
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,13 @@ test_that("we can transform a simple function", {
expect_equal(factorial_acc(i), transformed(i))
}
})

test_that("we cannot transform a non-tail-recursive function", {
factorial <- function(n, acc = 1)
if (n <= 1) acc else n * factorial(n - 1)

expect_warning(
expect_equal(factorial, transform(factorial)),
"Could not build .*"
)
})

0 comments on commit 7d8a1a2

Please sign in to comment.