From 3f77c0bf22ccfd6a19957a7ab8b697dca5cd85f3 Mon Sep 17 00:00:00 2001 From: Hadley Wickham Date: Tue, 17 Sep 2024 07:45:06 -0500 Subject: [PATCH] Add a test that better reflects #130 --- src/pause.gcda | Bin 0 -> 128 bytes src/profvis-init.gcda | Bin 0 -> 76 bytes tests/testthat/test-profvis.R | 11 +++++++++++ 3 files changed, 11 insertions(+) create mode 100644 src/pause.gcda create mode 100644 src/profvis-init.gcda diff --git a/src/pause.gcda b/src/pause.gcda new file mode 100644 index 0000000000000000000000000000000000000000..ac0815e4f143db94209b03644875e9ee4076bae3 GIT binary patch literal 128 zcmYdHNlw?YFfg(H9QT@mfq{`3NPs}oPlY^)*g{4oAYY}Qj}a^ZRRiL@GON&psbK^1 XK^O!;>OnvPp=UA7T#z`-AP^e>>_-s+ literal 0 HcmV?d00001 diff --git a/src/profvis-init.gcda b/src/profvis-init.gcda new file mode 100644 index 0000000000000000000000000000000000000000..9751a608464ee07f313fcfc8df5983e73ec58a32 GIT binary patch literal 76 zcmYdHNlw?YFfe(d@GFXefq{`3NPs}ck!f2YVhb6WfP6-25i8BBIV`~cS literal 0 HcmV?d00001 diff --git a/tests/testthat/test-profvis.R b/tests/testthat/test-profvis.R index 424e46b..486f7f3 100644 --- a/tests/testthat/test-profvis.R +++ b/tests/testthat/test-profvis.R @@ -14,6 +14,17 @@ test_that("Irrelevant stack is trimmed from profiles (#123)", { expect_equal(profile_mode(out), "pause f") }) +test_that("Irrelevant stack is trimmed from profiles from inlined code", { + skip_on_cran() + skip_on_covr() + + out <- profvis(for (i in 1:1e4) rnorm(100), simplify = TRUE) + expect_equal(profile_mode(out), "rnorm") + + out <- profvis(for (i in 1:1e4) rnorm(100), simplify = FALSE) + expect_equal(profile_mode(out), "rnorm") +}) + test_that("defaults to elapsed timing", { skip_on_cran() skip_on_covr()