Skip to content

Commit a628137

Browse files
Added unit tests. And ran tests using
1 parent 6dae230 commit a628137

File tree

3 files changed

+20
-0
lines changed

3 files changed

+20
-0
lines changed
Loading
Loading

tests/testthat/test-ggplot-function.R

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
p <- ggplot(data = data.frame(x = 0), mapping = aes(x = x))
2+
3+
test_that("ggplotly correctly handles stat_function", {
4+
pl <- p +
5+
stat_function(fun = function(x) x^2+3) +
6+
xlim(1, 5)
7+
8+
expect_doppelganger(ggplotly(pl), "stat-function")
9+
})
10+
11+
test_that("ggplotly correctly handles stat_function", {
12+
pl <- p +
13+
geom_function(fun = function(x) x^2+3) +
14+
stat_function(fun = function(x) 5) +
15+
xlim(1, 5)
16+
17+
expect_doppelganger(ggplotly(pl), "geomfunction")
18+
})

0 commit comments

Comments
 (0)