Skip to content

Commit

Permalink
add cat output for format
Browse files Browse the repository at this point in the history
  • Loading branch information
IndrajeetPatil committed Dec 4, 2023
1 parent eaa05d5 commit 5e32893
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 9 deletions.
42 changes: 34 additions & 8 deletions tests/testthat/_snaps/methods.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,28 +55,54 @@
# format.lint, format.lints support optional message wrapping : width = 10

Code
format(lints)
cat(format(lints))
Output
[1] "<text>:1:1:\n warning:\n [test_linter]\n The\n quick\n brown\n fox\n jumps\n over\n the\n lazy\n dog.\na\n^\n"
<text>:1:1:
warning:
[test_linter]
The
quick
brown
fox
jumps
over
the
lazy
dog.
a
^

# format.lint, format.lints support optional message wrapping : width = 20

Code
format(lints)
cat(format(lints))
Output
[1] "<text>:1:1:\n warning:\n [test_linter]\n The quick brown\n fox jumps over\n the lazy dog.\na\n^\n"
<text>:1:1:
warning:
[test_linter]
The quick brown
fox jumps over
the lazy dog.
a
^

# format.lint, format.lints support optional message wrapping : width = 40

Code
format(lints)
cat(format(lints))
Output
[1] "<text>:1:1: warning: [test_linter] The\n quick brown fox jumps over the lazy\n dog.\na\n^\n"
<text>:1:1: warning: [test_linter] The
quick brown fox jumps over the lazy
dog.
a
^

# format.lint, format.lints support optional message wrapping : width = 80

Code
format(lints)
cat(format(lints))
Output
[1] "<text>:1:1: warning: [test_linter] The quick brown fox jumps over the lazy dog.\na\n^\n"
<text>:1:1: warning: [test_linter] The quick brown fox jumps over the lazy dog.
a
^

2 changes: 1 addition & 1 deletion tests/testthat/test-methods.R
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ local({
"format.lint, format.lints support optional message wrapping",
{
withr::local_options(c(lintr.format_width = width))
expect_snapshot(format(lints))
expect_snapshot(cat(format(lints)))
},
.test_name = test_names,
width = widths
Expand Down

0 comments on commit 5e32893

Please sign in to comment.