-
Notifications
You must be signed in to change notification settings - Fork 70
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix quotes and comment charactes in glue
Closes #383.
- Loading branch information
1 parent
979e2f4
commit 64a389e
Showing
6 changed files
with
87 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# glue quotes and comments | ||
|
||
Code | ||
cli_dl(c(test_1 = "all good", test_2 = "not #good")) | ||
Message <cliMessage> | ||
test_1: all good | ||
test_2: not #good | ||
Code | ||
cli::cli_dl(c(test_3 = "no' good either")) | ||
Message <cliMessage> | ||
test_3: no' good either | ||
Code | ||
cli::cli_dl(c(test_4 = "no\" good also")) | ||
Message <cliMessage> | ||
test_4: no" good also | ||
Code | ||
cli::cli_text("{.url https://example.com/#section}") | ||
Message <cliMessage> | ||
<https://example.com/#section> | ||
Code | ||
cli::cli_alert_success("Qapla'") | ||
Message <cliMessage> | ||
v Qapla' | ||
|
||
# quotes, etc. within expressions are still OK | ||
|
||
Code | ||
cli::cli_text("{.url URL} {x <- 'foo'; nchar(x)}") | ||
Message <cliMessage> | ||
<URL> 3 | ||
Code | ||
cli::cli_text("{.url URL} {x <- \"foo\"; nchar(x)}") | ||
Message <cliMessage> | ||
<URL> 3 | ||
Code | ||
cli::cli_text("{.url URL} {1 + 1 # + 1} {1 + 1}") | ||
Message <cliMessage> | ||
<URL> 2 2 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
|
||
# https://github.com/r-lib/cli/issues/370 | ||
|
||
test_that("glue quotes and comments", { | ||
expect_snapshot({ | ||
cli_dl( | ||
c( | ||
"test_1" = "all good", | ||
"test_2" = "not #good" | ||
) | ||
) | ||
cli::cli_dl(c("test_3" = "no' good either")) | ||
cli::cli_dl(c("test_4" = "no\" good also")) | ||
cli::cli_text("{.url https://example.com/#section}") | ||
cli::cli_alert_success("Qapla'") | ||
}) | ||
}) | ||
|
||
test_that("quotes, etc. within expressions are still OK", { | ||
expect_snapshot({ | ||
cli::cli_text("{.url URL} {x <- 'foo'; nchar(x)}") | ||
cli::cli_text("{.url URL} {x <- \"foo\"; nchar(x)}") | ||
cli::cli_text("{.url URL} {1 + 1 # + 1} {1 + 1}") | ||
}) | ||
}) |