File tree Expand file tree Collapse file tree 1 file changed +50
-0
lines changed Expand file tree Collapse file tree 1 file changed +50
-0
lines changed Original file line number Diff line number Diff line change
1
+ test_that(" Check module_template output" , {
2
+ tmp <- tempdir()
3
+
4
+ unlink(file.path(tmp , " test.R" ))
5
+
6
+ module_template(
7
+ name = " test" ,
8
+ path = file.path(tmp , " test.R" ),
9
+ export = TRUE
10
+ )
11
+
12
+ file_content <- readLines(file.path(tmp , " test.R" ))
13
+
14
+ tags <- c(
15
+ " @export" ,
16
+ " @shinyModule" ,
17
+ " @rdname mod_test"
18
+ )
19
+
20
+ expect_true(
21
+ sapply(
22
+ tags ,
23
+ \(x ) any(grepl(x , file_content ))
24
+ ) | >
25
+ all()
26
+ )
27
+
28
+ unlink(file.path(tmp , " test.R" ))
29
+
30
+ module_template(
31
+ name = " test" ,
32
+ path = file.path(tmp , " test.R" ),
33
+ export = FALSE
34
+ )
35
+
36
+ file_content <- readLines(file.path(tmp , " test.R" ))
37
+
38
+ tags <- c(
39
+ " @noRd" ,
40
+ " @shinyModule"
41
+ )
42
+
43
+ expect_true(
44
+ sapply(
45
+ tags ,
46
+ \(x ) any(grepl(x , file_content ))
47
+ ) | >
48
+ all()
49
+ )
50
+ })
You can’t perform that action at this time.
0 commit comments