File tree Expand file tree Collapse file tree 4 files changed +6
-32
lines changed Expand file tree Collapse file tree 4 files changed +6
-32
lines changed Original file line number Diff line number Diff line change 11# rlang (development version)
22
3+ * ` englue() ` now allows omitting ` {{ ` . This is to make it easier to
4+ embed in external functions that need to support either ` { ` and ` {{ `
5+ (#1601 ).
6+
37* Fix for CRAN checks.
48
59* ` stop_input_type() ` now handles ` I() ` input literally in ` arg `
Original file line number Diff line number Diff line change @@ -449,18 +449,6 @@ englue <- function(x,
449449 error_call = current_env(),
450450 error_arg = " x" ) {
451451 check_string(x , arg = error_arg , call = error_call )
452-
453- if (! grepl(" {{" , x , fixed = TRUE )) {
454- abort(
455- c(
456- " Must use `{{`." ,
457- i = " Use `glue::glue()` for interpolation with `{`."
458- ),
459- arg = error_arg ,
460- call = error_call
461- )
462- }
463-
464452 glue_embrace(x , env = env )
465453}
466454
Original file line number Diff line number Diff line change 5050 <error/rlang_error>
5151 Error in `my_englue()`:
5252 ! `text` must be a single string, not an environment.
53- Code
54- (expect_error(my_englue("{'foo'}")))
55- Output
56- <error/rlang_error>
57- Error in `my_englue()`:
58- ! Must use `{{`.
59- i Use `glue::glue()` for interpolation with `{`.
6053 Code
6154 (expect_error(fn()))
6255 Output
6356 <error/rlang_error>
6457 Error in `fn()`:
6558 ! `x` is absent but must be supplied.
6659
67- # englue() works
68-
69- Code
70- err(englue("{'foo'}"), "Must use")
71- Output
72- <error/rlang_error>
73- Error in `englue()`:
74- ! Must use `{{`.
75- i Use `glue::glue()` for interpolation with `{`.
76-
7760# englue() checks for the size of its result (#1492 )
7861
7962 Code
Original file line number Diff line number Diff line change @@ -681,11 +681,11 @@ test_that("can wrap englue() (#1565)", {
681681 }
682682
683683 expect_equal(fn(bar ), " bar_QUX_FOO" )
684+ expect_equal(my_englue(" {'foo'}" ), " foo" )
684685
685686 expect_snapshot({
686687 (expect_error(my_englue(c(" a" , " b" ))))
687688 (expect_error(my_englue(env())))
688- (expect_error(my_englue(" {'foo'}" )))
689689 (expect_error(fn()))
690690 })
691691})
@@ -820,8 +820,7 @@ test_that("englue() works", {
820820
821821 g <- function (var ) englue(" prefix_{{ var }}_suffix" )
822822 expect_equal(g(cyl ), " prefix_cyl_suffix" )
823-
824- expect_snapshot(err(englue(" {'foo'}" ), " Must use" ))
823+ expect_equal(englue(" {'foo'}" ), " foo" )
825824})
826825
827826test_that(" englue() checks for the size of its result (#1492)" , {
You can’t perform that action at this time.
0 commit comments