File: test-checkstyle_output.R

package info (click to toggle)
r-cran-lintr 3.2.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 4,396 kB
  • sloc: sh: 13; xml: 10; makefile: 2
file content (35 lines) | stat: -rw-r--r-- 902 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
test_that("return lint report as checkstyle xml", {
  lints <- list(
    Lint(
      filename = "test_file",
      line_number = 1L,
      column_number = 2L,
      type = "error",
      line = "a line",
      message = "foo"
    ),
    Lint(
      filename = "test_file",
      line_number = 2L,
      column_number = 1L,
      type = "style",
      line = "another line",
      message = "bar"
    ),
    Lint(
      filename = "test_file2",
      line_number = 1L,
      column_number = 1L,
      type = "warning",
      line = "yet another line",
      message = "baz"
    )
  )
  class(lints) <- "lints"
  tmp <- withr::local_tempfile()
  checkstyle_output(lints, tmp)

  # The second line is the checkstyle version, so we ignore it during the
  # check, so we don't have to update the version every release.
  expect_identical(readLines(tmp)[-2L], readLines(test_path("checkstyle.xml"))[-2L])
})