tests/testthat/test-utils.R

test_that("non-comment-helpers", {
  pd <- compute_parse_data_nested("a <- # hi \n x %>% b()")
  child <- pd$child[[1]]
  expect_equal(previous_non_comment(child, 4), 2)
  expect_equal(next_non_comment(child, 2), 4)
})

test_that("files with and without blank EOF line are read correctly", {
  expect_snapshot({
    read_utf8(test_path("reference-objects/missing-blank-at-EOF.R"))
  })

  expect_snapshot({
    read_utf8(test_path("reference-objects/non-missing-blank-at-EOF.R"))
  })
})
krlmlr/styler documentation built on April 8, 2024, 7:53 p.m.