Debian Codegraph @

tests/testthat/resources/import.R

raw
1
2 # Capture packages (a, b, ...), not functions or other objects (f1, f2, ...)
3 # Do not capture packages in invalid calls (x1, x2, ...)
4
5 import::from(a, f1, f2, f3)
6 import::from(f1, .from = b)
7
8 # valid uses of import::here
9 import::here(f1, f2, f3, .from = c)
10 # invalid uses of import::here – should not infer a dependency
11 import::here(f1, x2) # no .from argument
12 import::here(f1, f2, f3, x3) # as above
13 import::here(f1) # no package is specified
14
15 # valid uses of import::into
16 import::into(f1, f2, f3, .into = "imports::pkg", .from = d)
17 import::into("imports::pkg", f1, f2, .from = e)
18
19 # invalid uses of import::into
20 import::into(f1, f2, x4, .into = "imports::pkg") # no .from argument
21 import::into(f1, x5) # no .from or .into
22 import::into(f1) # no package specified at all
23
24 # ignore usages that aren't namespace-prefixed
25 from(A)
26
27 # ignore .character_only with symbol
28 import::from(B, .character_only = TRUE)
29
30 # ignore things that look like scripts
31 import::from("./module.R")