Skip to content

Commit aa8fe8a

Browse files
committed
use released version of lzstring
1 parent c1f1a4e commit aa8fe8a

File tree

2 files changed

+52
-7
lines changed

2 files changed

+52
-7
lines changed

DESCRIPTION

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,6 @@ Suggests:
2323
pkgdown (>= 2.0.0),
2424
testthat (>= 3.1.5),
2525
withr (>= 2.4.3)
26-
Remotes:
27-
lzstring=parmsam/lzstring-r
2826
Config/Needs/verdepcheck: tidyverse/glue, jeroen/jsonlite,
2927
lzstring=parmsam/lzstring-r, r-lib/roxygen2, tidyverse/stringr,
3028
r-lib/pkgdown, r-lib/testthat, r-lib/withr

tests/testthat/test-tag_examplesShinylive.R

Lines changed: 52 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ test_that("examplesShinylive tag - multiple occurrences", {
8484
)
8585
})
8686

87-
test_that("examplesShinylive tag - don't use previous example code", {
87+
test_that("examplesShinylive tag - on default use only next example code", {
8888
text <- "
8989
#' This is a title
9090
#'
@@ -94,10 +94,10 @@ test_that("examplesShinylive tag - don't use previous example code", {
9494
#' @export
9595
#'
9696
#' @examples
97-
#' x <- 'this is excluded'
97+
#' 'this is excluded'
9898
#' @examplesShinylive
9999
#' @examples
100-
#' f(1, 2)
100+
#' 'this is included'
101101
f <- function(x, y) x + y
102102
"
103103
expect_silent(block <- roxygen2::parse_text(text)[[1]])
@@ -108,11 +108,11 @@ test_that("examplesShinylive tag - don't use previous example code", {
108108
)
109109
expect_identical(
110110
roxygen2::block_get_tag(block, "examplesShinylive")$raw,
111-
"\nf(1, 2)"
111+
"\n'this is included'"
112112
)
113113
expect_identical(
114114
roxygen2::block_get_tag_value(block, "examplesShinylive"),
115-
"https://shinylive.io/r/app/#code=NobwRAdghgtgpmAXGKAHVA6ASmANGAYwHsIAXOMpMAHQgDMAKARlwAIAmASjAF8BdIA"
115+
"https://shinylive.io/r/app/#code=NobwRAdghgtgpmAXGKAHVA6ASmANGAYwHsIAXOMpMAHQgHJSALASwGcACNziAgGwFcAJnEF0wAXwC6QA"
116116
)
117117
})
118118

@@ -354,3 +354,50 @@ test_that("format returns Rd parsable to tidy HTML", {
354354
testthat::expect_setequal(tidy_res, character(0))
355355
})
356356
})
357+
358+
test_that("examplesShinylive tag - respect order of tags - before examples", {
359+
text <- "
360+
#' This is a title
361+
#'
362+
#' This is the description.
363+
#'
364+
#' @param x,y A number
365+
#' @export
366+
#' @examplesShinylive
367+
#' @examples
368+
#' f(1, 2)
369+
f <- function(x, y) x + y
370+
"
371+
expect_silent(block <- roxygen2::parse_text(text)[[1]])
372+
373+
block_tag_names <- vapply(block$tags, `[[`, character(1), "tag")
374+
375+
expect_lt(
376+
which(block_tag_names == "examplesShinylive"),
377+
which(block_tag_names == "examples")
378+
)
379+
})
380+
381+
test_that("examplesShinylive tag - respect order of tags - after examples", {
382+
text <- "
383+
#' This is a title
384+
#'
385+
#' This is the description.
386+
#'
387+
#' @param x,y A number
388+
#' @export
389+
#' @examples
390+
#' f(1, 2)
391+
#' @examplesShinylive
392+
#' {{ prev_example }}
393+
f <- function(x, y) x + y
394+
"
395+
expect_silent(block <- roxygen2::parse_text(text)[[1]])
396+
397+
block_tag_names <- vapply(block$tags, `[[`, character(1), "tag")
398+
399+
expect_gt(
400+
which(block_tag_names == "examplesShinylive"),
401+
which(block_tag_names == "examples")
402+
)
403+
})

0 commit comments

Comments
 (0)