From 9d88032504ee6a265e24cbd468511b5da22a2292 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=A1bor=20Cs=C3=A1rdi?= Date: Sat, 25 Sep 2021 22:52:39 +0200 Subject: [PATCH 1/3] Update GHA platforms and R versions * Use R versions up to R 4.1. * Remove old R versions, 3.2, 3.3, they are not supported any more. * Update Ubuntu to 18.04. --- .github/workflows/R-CMD-check.yaml | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/.github/workflows/R-CMD-check.yaml b/.github/workflows/R-CMD-check.yaml index e7d8cfb..26a4061 100644 --- a/.github/workflows/R-CMD-check.yaml +++ b/.github/workflows/R-CMD-check.yaml @@ -19,13 +19,14 @@ jobs: matrix: config: - {os: windows-latest, r: '3.6'} + - {os: windows-latest, r: '4.1'} - {os: macOS-latest, r: '3.6'} - {os: macOS-latest, r: 'devel'} - - {os: ubuntu-16.04, r: '3.2', rspm: "https://demo.rstudiopm.com/all/__linux__/xenial/latest"} - - {os: ubuntu-16.04, r: '3.3', rspm: "https://demo.rstudiopm.com/all/__linux__/xenial/latest"} - - {os: ubuntu-16.04, r: '3.4', rspm: "https://demo.rstudiopm.com/all/__linux__/xenial/latest"} - - {os: ubuntu-16.04, r: '3.5', rspm: "https://demo.rstudiopm.com/all/__linux__/xenial/latest"} - - {os: ubuntu-16.04, r: '3.6', rspm: "https://demo.rstudiopm.com/all/__linux__/xenial/latest"} + - {os: ubuntu-18.04, r: '3.4', rspm: "https://demo.rstudiopm.com/all/__linux__/bionic/latest"} + - {os: ubuntu-18.04, r: '3.5', rspm: "https://demo.rstudiopm.com/all/__linux__/bionic/latest"} + - {os: ubuntu-18.04, r: '3.6', rspm: "https://demo.rstudiopm.com/all/__linux__/bionic/latest"} + - {os: ubuntu-18.04, r: '4.0', rspm: "https://demo.rstudiopm.com/all/__linux__/bionic/latest"} + - {os: ubuntu-18.04, r: '4.1', rspm: "https://demo.rstudiopm.com/all/__linux__/bionic/latest"} env: R_REMOTES_NO_ERRORS_FROM_WARNINGS: true @@ -51,8 +52,8 @@ jobs: uses: actions/cache@v1 with: path: ${{ env.R_LIBS_USER }} - key: ${{ runner.os }}-r-${{ matrix.config.r }}-${{ hashFiles('depends.Rds') }} - restore-keys: ${{ runner.os }}-r-${{ matrix.config.r }}- + key: ${{ runner.os }}-r-${{ matrix.config.r }}-1-${{ hashFiles('depends.Rds') }} + restore-keys: ${{ runner.os }}-r-${{ matrix.config.r }}-1- - name: Install system dependencies if: runner.os == 'Linux' From 2c9459b50985b51af8a435aae9bea9418b5380df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=A1bor=20Cs=C3=A1rdi?= Date: Sat, 25 Sep 2021 23:07:12 +0200 Subject: [PATCH 2/3] Make untermiated quotes error Closes #219. --- src/glue.c | 6 ++++++ tests/testthat/test-glue.R | 5 +++++ 2 files changed, 11 insertions(+) diff --git a/src/glue.c b/src/glue.c index 12cdee4..2682565 100644 --- a/src/glue.c +++ b/src/glue.c @@ -176,6 +176,12 @@ SEXP glue_(SEXP x, SEXP f, SEXP open_arg, SEXP close_arg) { if (state == delim) { free(str); Rf_error("Expecting '%s'", close); + } else if (state == single_quote) { + free(str); + Rf_error("Unterminated quote (')"); + } else if (state == double_quote) { + free(str); + Rf_error("Unterminated quote (\")"); } free(str); diff --git a/tests/testthat/test-glue.R b/tests/testthat/test-glue.R index a9d8ed1..f4507e1 100644 --- a/tests/testthat/test-glue.R +++ b/tests/testthat/test-glue.R @@ -424,3 +424,8 @@ test_that("+ method for glue works", { x <- 1 expect_identical(glue("x = ") + "{x}", glue("x = {x}")) }) + +test_that("unterminated quotes are error", { + expect_error(glue("{this doesn\"t work}"), "Unterminated quote") + expect_error(glue("{this doesn't work}"), "Unterminated quote") +}) From 382c38d23062b7752bfc2c81a1bf961a47a1b0eb Mon Sep 17 00:00:00 2001 From: Jim Hester Date: Mon, 27 Sep 2021 16:23:57 -0400 Subject: [PATCH 3/3] Add note to NEWS --- NEWS.md | 1 + 1 file changed, 1 insertion(+) diff --git a/NEWS.md b/NEWS.md index bec0bfa..8926803 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,5 +1,6 @@ # glue 1.4.2 +* Unterminated quotes in glue expressions now throw an error (#226, @gaborcsardi) * `glue_safe()` gives a slightly nicer error message * The required version of R is now 3.2 (#189) * `glue_sql()` now collapses `DBI::SQL()` elements correctly (#192 @shrektan)