Skip to content

Commit

Permalink
Handle both positive and negative case in non_integer
Browse files Browse the repository at this point in the history
  • Loading branch information
Bisaloo committed Jun 8, 2024
1 parent 9c1aa38 commit 36a8c0c
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions R/expect_identical_linter.R
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,13 @@ expect_identical_linter <- function() {
# - skip cases like expect_equal(x, 1.02) or the constant vector version
# where a numeric constant indicates inexact testing is preferable
# - skip calls using dots (`...`); see tests
non_integer <- "NUM_CONST[contains(text(), '.')]"
non_integer_negative <- glue::glue("
OP-MINUS
and count(expr) = 1
and expr[{non_integer}]
non_integer <- glue::glue("
NUM_CONST[contains(text(), '.')]
or (
OP-MINUS
and count(expr) = 1
and expr[NUM_CONST[contains(text(), '.')]]
)
")

expect_equal_xpath <- glue::glue("
Expand All @@ -73,11 +75,9 @@ expect_identical_linter <- function() {
or following-sibling::expr[
(
expr[1][SYMBOL_FUNCTION_CALL[text() = 'c']]
and expr[
{non_integer} or {non_integer_negative}
]
and expr[{non_integer}]
) or (
{non_integer} or {non_integer_negative}
{non_integer}
) or (
OP-MINUS
and count(expr) = 1
Expand Down

0 comments on commit 36a8c0c

Please sign in to comment.