Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use public interface to test internal functions: Part-2 #1721

Merged
merged 3 commits into from
Oct 16, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions tests/testthat/test-cache.R
Original file line number Diff line number Diff line change
Expand Up @@ -357,10 +357,9 @@ test_that("find_new_line returns the same if the line is the same", {
"foobar2",
"foobar3"
)
expect_identical(lintr:::find_new_line(1L, "foobar1", t1), 1L)

expect_identical(lintr:::find_new_line(1L, "foobar1", t1), 1L)
expect_identical(lintr:::find_new_line(2L, "foobar2", t1), 2L)

expect_identical(lintr:::find_new_line(3L, "foobar3", t1), 3L)
})

Expand All @@ -370,10 +369,9 @@ test_that("find_new_line returns the correct line if it is before the current li
"foobar2",
"foobar3"
)
expect_identical(lintr:::find_new_line(1L, "foobar1", t1), 1L)

expect_identical(lintr:::find_new_line(1L, "foobar1", t1), 1L)
expect_identical(lintr:::find_new_line(2L, "foobar1", t1), 1L)

expect_identical(lintr:::find_new_line(3L, "foobar1", t1), 1L)
})

Expand All @@ -383,10 +381,9 @@ test_that("find_new_line returns the correct line if it is after the current lin
"foobar2",
"foobar3"
)
expect_identical(lintr:::find_new_line(1L, "foobar3", t1), 3L)

expect_identical(lintr:::find_new_line(1L, "foobar3", t1), 3L)
expect_identical(lintr:::find_new_line(2L, "foobar3", t1), 3L)

expect_identical(lintr:::find_new_line(3L, "foobar3", t1), 3L)
})

Expand Down
10 changes: 1 addition & 9 deletions tests/testthat/test-error.R
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,7 @@ test_that("returns the correct linting", {
expect_lint("x = ;", rex::rex("unexpected ';'"), linter)

# no parsing error is expected for the equals-assignment in this code
expect_lint(
"purrr::partial(list, 1, ... = , 2)",
NULL,
linter
)

# Error message changed in R-devel as of 2020/12
old_lang <- lintr:::set_lang("en")
on.exit(lintr:::reset_lang(old_lang), add = TRUE)
expect_lint("purrr::partial(list, 1, ... = , 2)", NULL, linter)

# trigger error with base only, and extract it to match against
# what comes out from expect_lint.
Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/test-lint_package.R
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ test_that(
"jkl = 456",
"mno = 789"
)
lintr:::read_settings(NULL)

lints_from_outside <- lint_package(
pkg_path,
linters = list(assignment_linter())
Expand Down
17 changes: 0 additions & 17 deletions tests/testthat/test-namespace.R

This file was deleted.