Debian Codegraph @

tests/testthat/_snaps/eval-relocate.md

raw symbols SCIP
1 # can't supply both `before` and `after`
2
3 Code
4 relocate_loc(c(x = 1), before = 1, after = 1)
5 Condition
6 Error in `relocate_loc()`:
7 ! Can't supply both `before` and `after`.
8
9 ---
10
11 Code
12 relocate_loc(c(x = 1), before = 1, after = 1, before_arg = ".before",
13 after_arg = ".after")
14 Condition
15 Error in `relocate_loc()`:
16 ! Can't supply both `.before` and `.after`.
17
18 # can't relocate with out-of-bounds variables by default
19
20 Code
21 (expect_error(relocate_loc(x, c)))
22 Output
23 <error/vctrs_error_subscript_oob>
24 Error in `relocate_loc()`:
25 ! Can't relocate columns that don't exist.
26 x Column `c` doesn't exist.
27 Code
28 (expect_error(relocate_loc(x, c(1, 3))))
29 Output
30 <error/vctrs_error_subscript_oob>
31 Error in `relocate_loc()`:
32 ! Can't relocate columns that don't exist.
33 i Location 3 doesn't exist.
34 i There are only 2 columns.
35 Code
36 (expect_error(relocate_loc(x, a, before = c)))
37 Output
38 <error/vctrs_error_subscript_oob>
39 Error in `relocate_loc()`:
40 ! Can't select columns that don't exist.
41 x Column `c` doesn't exist.
42 Code
43 (expect_error(relocate_loc(x, a, after = c)))
44 Output
45 <error/vctrs_error_subscript_oob>
46 Error in `relocate_loc()`:
47 ! Can't select columns that don't exist.
48 x Column `c` doesn't exist.
49
50 # can relocate with out-of-bounds variables in `expr` if `strict = FALSE`
51
52 Code
53 (expect_error(relocate_loc(x, a, before = c, strict = FALSE)))
54 Output
55 <error/vctrs_error_subscript_oob>
56 Error in `relocate_loc()`:
57 ! Can't select columns that don't exist.
58 x Column `c` doesn't exist.
59 Code
60 (expect_error(relocate_loc(x, a, after = c, strict = FALSE)))
61 Output
62 <error/vctrs_error_subscript_oob>
63 Error in `relocate_loc()`:
64 ! Can't select columns that don't exist.
65 x Column `c` doesn't exist.
66
67 # can forbid rename syntax
68
69 Code
70 (expect_error(relocate_loc(x, c(foo = b), allow_rename = FALSE)))
71 Output
72 <error/tidyselect:::error_disallowed_rename>
73 Error in `relocate_loc()`:
74 ! Can't rename variables in this context.
75 Code
76 (expect_error(relocate_loc(x, c(b, foo = b), allow_rename = FALSE)))
77 Output
78 <error/tidyselect:::error_disallowed_rename>
79 Error in `relocate_loc()`:
80 ! Can't rename variables in this context.
81
82 # can forbid empty selections
83
84 Code
85 (expect_error(relocate_loc(x, allow_empty = FALSE)))
86 Output
87 <error/rlang_error>
88 Error in `relocate_loc()`:
89 ! Must select at least one item.
90 Code
91 (expect_error(relocate_loc(mtcars, integer(), allow_empty = FALSE)))
92 Output
93 <error/rlang_error>
94 Error in `relocate_loc()`:
95 ! Must select at least one item.
96 Code
97 (expect_error(relocate_loc(mtcars, starts_with("z"), allow_empty = FALSE)))
98 Output
99 <error/rlang_error>
100 Error in `relocate_loc()`:
101 ! Must select at least one item.
102
103 # `before` and `after` forbid renaming
104
105 Code
106 (expect_error(relocate_loc(x, b, before = c(new = c))))
107 Output
108 <error/rlang_error>
109 Error in `relocate_loc()`:
110 ! Can't rename variables when `before` is supplied.
111 Code
112 (expect_error(relocate_loc(x, b, before = c(new = c), before_arg = ".before")))
113 Output
114 <error/rlang_error>
115 Error in `relocate_loc()`:
116 ! Can't rename variables when `.before` is supplied.
117 Code
118 (expect_error(relocate_loc(x, b, after = c(new = c))))
119 Output
120 <error/rlang_error>
121 Error in `relocate_loc()`:
122 ! Can't rename variables when `after` is supplied.
123 Code
124 (expect_error(relocate_loc(x, b, after = c(new = c), after_arg = ".after")))
125 Output
126 <error/rlang_error>
127 Error in `relocate_loc()`:
128 ! Can't rename variables when `.after` is supplied.
129