|
1 | | -testthat::describe("detects multiple assignments in single line", { |
2 | | - testthat::it("<-", { |
3 | | - # testthat::skip("Not implemented") |
4 | | - code <- "var1 <- var2 <- 1" |
5 | | - td <- eval_code(qenv(), code) |
6 | | - |
7 | | - testthat::expect_identical(get_code(td, names = "var1"), code) |
8 | | - testthat::expect_identical(get_code(td, names = "var2"), code) |
9 | | - }) |
10 | | - |
11 | | - testthat::it("->", { |
12 | | - # testthat::skip("Not implemented") |
13 | | - code <- "1 -> var1 -> var2" |
14 | | - td <- eval_code(qenv(), code) |
15 | | - |
16 | | - testthat::expect_identical( |
17 | | - get_code(td, names = "var1"), |
18 | | - as.character(parse(text = code, keep.source = TRUE)) |
19 | | - ) |
20 | | - |
21 | | - testthat::expect_identical(get_code(td, names = "var1"), code) |
22 | | - testthat::expect_identical(get_code(td, names = "var2"), code) |
23 | | - }) |
24 | | - |
25 | | - testthat::it("<- and ->", { |
26 | | - # testthat::skip("Not implemented") |
27 | | - code <- "var1 <- 1 -> var2" |
28 | | - td <- eval_code(qenv(), code) |
29 | | - |
30 | | - testthat::expect_identical(get_code(td, names = "var1"), code) |
31 | | - testthat::expect_identical(get_code(td, names = "var2"), code) |
32 | | - }) |
33 | | -}) |
34 | | - |
35 | 1 | testthat::describe("get_code with single assignments inside an expression", { |
36 | 2 | testthat::it("detects assign() function", { |
37 | 3 | td <- qenv() |> |
@@ -63,7 +29,7 @@ testthat::describe("get_code with single assignments inside an expression", { |
63 | 29 | td <- qenv() |> |
64 | 30 | within({ |
65 | 31 | for (i in 1:10) { |
66 | | - iris -> var1 |
| 32 | + iris -> var1 # nolint: assignment. |
67 | 33 | } |
68 | 34 | }) |
69 | 35 |
|
@@ -109,8 +75,8 @@ testthat::describe("get_code with multiple assignments inside an expression", { |
109 | 75 | td <- qenv() |> |
110 | 76 | within({ |
111 | 77 | for (i in 1:10) { |
112 | | - iris -> var1 |
113 | | - mtcars -> var2 |
| 78 | + iris -> var1 # nolint: assignment. |
| 79 | + mtcars -> var2 # nolint: assignment. |
114 | 80 | } |
115 | 81 | }) |
116 | 82 |
|
|
0 commit comments