@@ -27,6 +27,16 @@ test_that("tree hierarchy is the same no matter whether = or <- is used", {
27
27
" x <- b <- 5" , structure_only = TRUE
28
28
)
29
29
expect_equal(assign_eq , assign_left )
30
+
31
+
32
+ assign_left_many <- create_tree(
33
+ " x = b = c = d = r= 5" , structure_only = TRUE
34
+ )
35
+ assign_eq_many <- create_tree(
36
+ " x <- b <- c <- d <- r <- 5" , structure_only = TRUE
37
+ )
38
+ expect_equal(assign_eq_many , assign_left_many )
39
+
30
40
})
31
41
32
42
test_that(" braces are added in the right place in ifelse if eq_assign is in expr" , {
@@ -37,6 +47,23 @@ test_that("braces are added in the right place in ifelse if eq_assign is in expr
37
47
), NA )
38
48
})
39
49
50
+ test_that(" complicated reassignment works" , {
51
+ expect_warning(test_collection(
52
+ " relocate_eq_assign" , " eq_assign_multiple_tokens_eq_only" ,
53
+ transformer = style_text ,
54
+ scope = " tokens" ,
55
+ style = tidyverse_style
56
+ ), NA )
57
+
58
+ expect_warning(test_collection(
59
+ " relocate_eq_assign" , " eq_assign_multiple_tokens_mixed" ,
60
+ transformer = style_text ,
61
+ scope = " tokens" ,
62
+ style = tidyverse_style
63
+ ), NA )
64
+ })
65
+
66
+
40
67
test_that(" eq_assign is not replaced" , {
41
68
expect_warning(test_collection(
42
69
" relocate_eq_assign" , " eq_assign_ifelse_scope_line_breaks" ,
0 commit comments