Skip to content

Commit 3a5ab38

Browse files
committed
Use expect_no_lint() where appropriate
1 parent ffc47fd commit 3a5ab38

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

tests/testthat/test-sprintf_linter.R

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@ patrick::with_parameters_test_that(
44
linter <- sprintf_linter()
55

66
# NB: using paste0, not sprintf, to avoid escaping '%d' in sprint fmt=
7-
expect_lint(paste0(call_name, "('hello %d', 1)"), NULL, linter)
8-
expect_lint(paste0(call_name, "('hello %d', x)"), NULL, linter)
9-
expect_lint(paste0(call_name, "('hello %d', x + 1)"), NULL, linter)
10-
expect_lint(paste0(call_name, "('hello %d', f(x))"), NULL, linter)
11-
expect_lint(paste0(call_name, "('hello %1$s %1$s', x)"), NULL, linter)
12-
expect_lint(paste0(call_name, "('hello %1$s %1$s %2$d', x, y)"), NULL, linter)
13-
expect_lint(paste0(call_name, "('hello %1$s %1$s %2$d %3$s', x, y, 1.5)"), NULL, linter)
7+
expect_no_lint(paste0(call_name, "('hello %d', 1)"), linter)
8+
expect_no_lint(paste0(call_name, "('hello %d', x)"), linter)
9+
expect_no_lint(paste0(call_name, "('hello %d', x + 1)"), linter)
10+
expect_no_lint(paste0(call_name, "('hello %d', f(x))"), linter)
11+
expect_no_lint(paste0(call_name, "('hello %1$s %1$s', x)"), linter)
12+
expect_no_lint(paste0(call_name, "('hello %1$s %1$s %2$d', x, y)"), linter)
13+
expect_no_lint(paste0(call_name, "('hello %1$s %1$s %2$d %3$s', x, y, 1.5)"), linter)
1414
},
1515
.test_name = c("sprintf", "gettextf"),
1616
call_name = c("sprintf", "gettextf")
@@ -104,13 +104,13 @@ local({
104104
patrick::with_parameters_test_that(
105105
"piping into sprintf works",
106106
{
107-
expect_lint(paste("x", pipe, "sprintf(fmt = '%s')"), NULL, linter)
107+
expect_no_lint(paste("x", pipe, "sprintf(fmt = '%s')"), linter)
108108
# no fmt= specified -> this is just 'sprintf("%s", "%s%s")', which won't lint
109-
expect_lint(paste('"%s"', pipe, 'sprintf("%s%s")'), NULL, linter)
109+
expect_no_lint(paste('"%s"', pipe, 'sprintf("%s%s")'), linter)
110110
expect_lint(paste("x", pipe, "sprintf(fmt = '%s%s')"), unused_fmt_msg, linter)
111111

112112
# Cannot evaluate statically --> skip
113-
expect_lint(paste("x", pipe, 'sprintf("a")'), NULL, linter)
113+
expect_no_lint(paste("x", pipe, 'sprintf("a")'), linter)
114114
# Nested pipes
115115
expect_lint(
116116
paste("'%%sb'", pipe, "sprintf('%s')", pipe, "sprintf('a')"),

0 commit comments

Comments
 (0)