diff --git a/tests/testthat/parsing/repeated_parsing-in.R b/tests/testthat/parsing/repeated_parsing-in.R deleted file mode 100644 index 28d1e49c0..000000000 --- a/tests/testthat/parsing/repeated_parsing-in.R +++ /dev/null @@ -1,21 +0,0 @@ -# -# -# -r <- function(y, s, g = 10) { - b("", "") - - # - q <- g(d(i), function(i) { - d(op(t[[p]]), n(i = i)) - }) - f(calls) <- f(g) - - mb <- j(c( - q(a::b), r, - y(u = 1) - )) - k(b) -} - -# -# diff --git a/tests/testthat/parsing/repeated_parsing-in_tree b/tests/testthat/parsing/repeated_parsing-in_tree deleted file mode 100644 index c43c3b88e..000000000 --- a/tests/testthat/parsing/repeated_parsing-in_tree +++ /dev/null @@ -1,152 +0,0 @@ -ROOT (token: short_text [lag_newlines/spaces] {pos_id}) - ¦--COMMENT: # [0/0] {1} - ¦--COMMENT: # [1/0] {2} - ¦--COMMENT: # [1/0] {3} - ¦--expr: r <- [1/0] {4} - ¦ ¦--expr: r [0/1] {6} - ¦ ¦ °--SYMBOL: r [0/0] {5} - ¦ ¦--LEFT_ASSIGN: <- [0/1] {7} - ¦ °--expr: funct [0/0] {8} - ¦ ¦--FUNCTION: funct [0/0] {9} - ¦ ¦--'(': ( [0/0] {10} - ¦ ¦--SYMBOL_FORMALS: y [0/0] {11} - ¦ ¦--',': , [0/1] {12} - ¦ ¦--SYMBOL_FORMALS: s [0/0] {13} - ¦ ¦--',': , [0/1] {14} - ¦ ¦--SYMBOL_FORMALS: g [0/1] {15} - ¦ ¦--EQ_FORMALS: = [0/1] {16} - ¦ ¦--expr: 10 [0/0] {18} - ¦ ¦ °--NUM_CONST: 10 [0/0] {17} - ¦ ¦--')': ) [0/1] {19} - ¦ °--expr: { - b [0/0] {20} - ¦ ¦--'{': { [0/2] {21} - ¦ ¦--expr: b("", [1/2] {22} - ¦ ¦ ¦--expr: b [0/0] {24} - ¦ ¦ ¦ °--SYMBOL_FUNCTION_CALL: b [0/0] {23} - ¦ ¦ ¦--'(': ( [0/0] {25} - ¦ ¦ ¦--expr: "" [0/0] {27} - ¦ ¦ ¦ °--STR_CONST: "" [0/0] {26} - ¦ ¦ ¦--',': , [0/1] {28} - ¦ ¦ ¦--expr: "" [0/0] {30} - ¦ ¦ ¦ °--STR_CONST: "" [0/0] {29} - ¦ ¦ °--')': ) [0/0] {31} - ¦ ¦--COMMENT: # [2/2] {32} - ¦ ¦--expr: q <- [1/2] {33} - ¦ ¦ ¦--expr: q [0/1] {35} - ¦ ¦ ¦ °--SYMBOL: q [0/0] {34} - ¦ ¦ ¦--LEFT_ASSIGN: <- [0/1] {36} - ¦ ¦ °--expr: g(d(i [0/0] {37} - ¦ ¦ ¦--expr: g [0/0] {39} - ¦ ¦ ¦ °--SYMBOL_FUNCTION_CALL: g [0/0] {38} - ¦ ¦ ¦--'(': ( [0/0] {40} - ¦ ¦ ¦--expr: d(i) [0/0] {41} - ¦ ¦ ¦ ¦--expr: d [0/0] {43} - ¦ ¦ ¦ ¦ °--SYMBOL_FUNCTION_CALL: d [0/0] {42} - ¦ ¦ ¦ ¦--'(': ( [0/0] {44} - ¦ ¦ ¦ ¦--expr: i [0/0] {46} - ¦ ¦ ¦ ¦ °--SYMBOL: i [0/0] {45} - ¦ ¦ ¦ °--')': ) [0/0] {47} - ¦ ¦ ¦--',': , [0/1] {48} - ¦ ¦ ¦--expr: funct [0/0] {49} - ¦ ¦ ¦ ¦--FUNCTION: funct [0/0] {50} - ¦ ¦ ¦ ¦--'(': ( [0/0] {51} - ¦ ¦ ¦ ¦--SYMBOL_FORMALS: i [0/0] {52} - ¦ ¦ ¦ ¦--')': ) [0/1] {53} - ¦ ¦ ¦ °--expr: { - [0/0] {54} - ¦ ¦ ¦ ¦--'{': { [0/4] {55} - ¦ ¦ ¦ ¦--expr: d(op( [1/2] {56} - ¦ ¦ ¦ ¦ ¦--expr: d [0/0] {58} - ¦ ¦ ¦ ¦ ¦ °--SYMBOL_FUNCTION_CALL: d [0/0] {57} - ¦ ¦ ¦ ¦ ¦--'(':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[0/0] {85} - ¦ ¦--expr: f(cal [1/2] {86} - ¦ ¦ ¦--expr: f(cal [0/1] {87} - ¦ ¦ ¦ ¦--expr: f [0/0] {89} - ¦ ¦ ¦ ¦ °--SYMBOL_FUNCTION_CALL: f [0/0] {88} - ¦ ¦ ¦ ¦--'(': ( [0/0] {90} - ¦ ¦ ¦ ¦--expr: calls [0/0] {92} - ¦ ¦ ¦ ¦ °--SYMBOL: calls [0/0] {91} - ¦ ¦ ¦ °--')': ) [0/0] {93} - ¦ ¦ ¦--LEFT_ASSIGN: <- [0/1] {94} - ¦ ¦ °--expr: f(g) [0/0] {95} - ¦ ¦ ¦--expr: f [0/0] {97} - ¦ ¦ ¦ °--SYMBOL_FUNCTION_CALL: f [0/0] {96} - ¦ ¦ ¦--'(': ( [0/0] {98} - ¦ ¦ ¦--expr: g [0/0] {100} - ¦ ¦ ¦ °--SYMBOL: g [0/0] {99} - ¦ ¦ °--')': ) [0/0] {101} - ¦ ¦--expr: mb <- [2/2] {102} - ¦ ¦ ¦--expr: mb [0/1] {104} - ¦ ¦ ¦ °--SYMBOL: mb [0/0] {103} - ¦ ¦ ¦--LEFT_ASSIGN: <- [0/1] {105} - ¦ ¦ °--expr: j(c( - [0/0] {106} - ¦ ¦ ¦--expr: j [0/0] {108} - ¦ ¦ ¦ °--SYMBOL_FUNCTION_CALL: j [0/0] {107} - ¦ ¦ ¦--'(': ( [0/0] {109} - ¦ ¦ ¦--expr: c( - [0/0] {110} - ¦ ¦ ¦ ¦--expr: c [0/0] {112} - ¦ ¦ ¦ ¦ °--SYMBOL_FUNCTION_CALL: c [0/0] {111} - ¦ ¦ ¦ ¦--'(': ( [0/4] {113} - ¦ ¦ ¦ ¦--expr: q(a:: [1/0] {114} - ¦ ¦ ¦ ¦ ¦--expr: q [0/0] {116} - ¦ ¦ ¦ ¦ ¦ °--SYMBOL_FUNCTION_CALL: q [0/0] {115} - ¦ ¦ ¦ ¦ ¦--'(': ( [0/0] {117} - ¦ ¦ ¦ ¦ ¦--expr: a::b [0/0] {118} - ¦ ¦ ¦ ¦ ¦ ¦--SYMBOL_PACKAGE: a [0/0] {119} - ¦ ¦ ¦ ¦ ¦ ¦--NS_GET: :: [0/0] {120} - ¦ ¦ ¦ ¦ ¦ °--SYMBOL: b [0/0] {121} - ¦ ¦ ¦ ¦ °--')': ) [0/0] {122} - ¦ ¦ ¦ ¦--',': , [0/1] {123} - ¦ ¦ ¦ ¦--expr: r [0/0] {125} - ¦ ¦ ¦ ¦ °--SYMBOL: r [0/0] {124} - ¦ ¦ ¦ ¦--',': , [0/4] {126} - ¦ ¦ ¦ ¦--expr: y(u = [1/2] {127} - ¦ ¦ ¦ ¦ ¦--expr: y [0/0] {129} - ¦ ¦ ¦ ¦ ¦ °--SYMBOL_FUNCTION_CALL: y [0/0] {128} - ¦ ¦ ¦ ¦ ¦--'(': ( [0/0] {130} - ¦ ¦ ¦ ¦ ¦--SYMBOL_SUB: u [0/1] {131} - ¦ ¦ ¦ ¦ ¦--EQ_SUB: = [0/1] {132} - ¦ ¦ ¦ ¦ ¦--expr: 1 [0/0] {134} - ¦ ¦ ¦ ¦ ¦ °--NUM_CONST: 1 [0/0] {133} - ¦ ¦ ¦ ¦ °--')': ) [0/0] {135} - ¦ ¦ ¦ °--')': ) [1/0] {136} - ¦ ¦ °--')': ) [0/0] {137} - ¦ ¦--expr: k(b) [1/0] {138} - ¦ ¦ ¦--expr: k [0/0] {140} - ¦ ¦ ¦ °--SYMBOL_FUNCTION_CALL: k [0/0] {139} - ¦ ¦ ¦--'(': ( [0/0] {141} - ¦ ¦ ¦--expr: b [0/0] {143} - ¦ ¦ ¦ °--SYMBOL: b [0/0] {142} - ¦ ¦ °--')': ) [0/0] {144} - ¦ °--'}': } [1/0] {145} - ¦--COMMENT: # [2/0] {146} - °--COMMENT: # [1/0] {147} diff --git a/tests/testthat/parsing/repeated_parsing-out.R b/tests/testthat/parsing/repeated_parsing-out.R deleted file mode 100644 index 28d1e49c0..000000000 --- a/tests/testthat/parsing/repeated_parsing-out.R +++ /dev/null @@ -1,21 +0,0 @@ -# -# -# -r <- function(y, s, g = 10) { - b("", "") - - # - q <- g(d(i), function(i) { - d(op(t[[p]]), n(i = i)) - }) - f(calls) <- f(g) - - mb <- j(c( - q(a::b), r, - y(u = 1) - )) - k(b) -} - -# -# diff --git a/tests/testthat/test-parsing.R b/tests/testthat/test-parsing.R index f64314009..f0a7bfcc4 100644 --- a/tests/testthat/test-parsing.R +++ b/tests/testthat/test-parsing.R @@ -1,30 +1,3 @@ -test_that("repreated parsing solves wrong parent assignment", { - expect_warning( - test_collection( - "parsing", "repeated_parsing", - transformer = style_text, - strict = FALSE - ), - NA - ) - - # move to temp dir - dir <- tempfile("styler") - dir.create(dir) - path_temp <- file.path(dir, "repeated_parsing-in.R") - path_perm <- testthat_file("parsing", "repeated_parsing-in.R") - file.copy(path_perm, dir) - - sys_call <- paste0( - "R -q -e \"styler::cache_deactivate(); styler::style_file(\\\"", path_temp, "\\\")\"" - ) - calls_sys(sys_call, intern = FALSE, ignore.stdout = TRUE, ignore.stderr = TRUE) - ref <- read_utf8_bare(testthat_file("parsing", "repeated_parsing-out.R")) - result <- read_utf8_bare(path_temp) - expect_equal(ref, result) - unlink(dir) -}) - test_that("long strings are parsed correctly", { expect_warning( test_collection("parsing", "long_strings", transformer = style_text),