From a9a83aafe7092c523d8655d36fcd838ccce0975d Mon Sep 17 00:00:00 2001 From: Indrajeet Patil Date: Thu, 29 Dec 2022 20:14:42 +0100 Subject: [PATCH] address review comments --- .../test-implicit_assignment_linter.R | 59 +++++++++++++++++-- 1 file changed, 54 insertions(+), 5 deletions(-) diff --git a/tests/testthat/test-implicit_assignment_linter.R b/tests/testthat/test-implicit_assignment_linter.R index 8535b3fd8..54a452a53 100644 --- a/tests/testthat/test-implicit_assignment_linter.R +++ b/tests/testthat/test-implicit_assignment_linter.R @@ -165,11 +165,60 @@ test_that("implicit_assignment_linter respects except argument", { test_that("implicit_assignment_linter skips allowed usages with braces", { linter <- implicit_assignment_linter(except = character(0L)) - expect_lint("output <- capture.output({ x <- f() })", NULL, linter) - expect_lint("quote({ a <- 1L })", NULL, linter) - expect_lint("bquote({ a <- 1L })", NULL, linter) - expect_lint("expression({ a <- 1L })", NULL, linter) - expect_lint("local({ a <- 1L })", NULL, linter) + expect_lint( + trim_some(" + foo({ + a <- 1L + }) + "), + NULL, + linter + ) + expect_lint( + trim_some(" + output <- capture.output({ + x <- f() + }) + "), + NULL, + linter + ) + expect_lint( + trim_some(" + quote({ + a <- 1L + }) + "), + NULL, + linter + ) + expect_lint( + trim_some(" + bquote({ + a <- 1L + }) + "), + NULL, + linter + ) + expect_lint( + trim_some(" + expression({ + a <- 1L + }) + "), + NULL, + linter + ) + expect_lint( + trim_some(" + local({ + a <- 1L + }) + "), + NULL, + linter + ) }) test_that("implicit_assignment_linter makes exceptions for functions that capture side-effects", {