Skip to content

Commit 4f77fdf

Browse files
authored
Don't test warnings in integration tests (#1822)
Since they're now tested individually in each file.
1 parent 6138a93 commit 4f77fdf

3 files changed

Lines changed: 25 additions & 88 deletions

File tree

tests/testthat/_snaps/rd-r6.md

Lines changed: 14 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,5 @@
11
# integration test
22

3-
Code
4-
roxygenise(path)
5-
Message
6-
i Loading testR6
7-
x classes.R:12: Must use one @param for each argument.
8-
x $meth3(duplicate) is documented multiple times
9-
x classes.R:12: Must use one @param for each argument.
10-
x $meth3(missing) is not documented
11-
x classes.R:12: Must use one @return per R6 method.
12-
x classes.R:91: Undocumented R6 fields: field2 and undocumented_field.
13-
x classes.R:91: R6 field documented multiple times: duplicatefield.
14-
x classes.R:91: Unknown R6 field: nosuchfield.
15-
x classes.R:91: Undocumented R6 active binding: undocumented_binding.
16-
x classes.R:91: R6 active binding documented multiple times: duplicate_binding.
17-
x classes.R:91: Undocumented R6 method: undocumented_method.
18-
Writing 'NAMESPACE'
19-
Writing 'A.Rd'
20-
Writing 'B.Rd'
21-
Writing 'C.Rd'
22-
23-
---
24-
253
Code
264
cat(read_lines(rd_file), sep = "\n")
275
Output
@@ -31,19 +9,17 @@
319
\alias{A}
3210
\title{Class A}
3311
\value{
34-
twice.
35-
36-
really?
12+
A value.
3713
}
3814
\description{
3915
A method 1.
4016
4117
Method 2 description.
18+
19+
Method 3.
4220
}
4321
\details{
4422
Method 2 details.
45-
46-
Method 3 details.
4723
}
4824
\examples{
4925
## Example for meth1
@@ -79,7 +55,7 @@
7955
8056
\item{\code{active2}}{A binding 2.}
8157
82-
\item{\code{active3}}{A binding 2.}
58+
\item{\code{active3}}{A binding 3.}
8359
}
8460
\if{html}{\out{</div>}}
8561
}
@@ -143,6 +119,10 @@
143119
Method 2 details.
144120
}
145121
122+
\subsection{Returns}{
123+
A value.
124+
}
125+
146126
\subsection{Examples}{
147127
\if{html}{\out{<div class="r example copy">}}
148128
\preformatted{## Example for meth2
@@ -155,29 +135,21 @@
155135
\if{html}{\out{<a id="method-A-meth3"></a>}}
156136
\if{latex}{\out{\hypertarget{method-A-meth3}{}}}
157137
\subsection{Method \code{meth3()}}{
138+
Method 3.
158139
\subsection{Usage}{
159140
\if{html}{\out{<div class="r">}}
160-
\preformatted{A$meth3(duplicate, missing)}
141+
\preformatted{A$meth3(x)}
161142
\if{html}{\out{</div>}}
162143
}
163144
164145
\subsection{Arguments}{
165146
\if{html}{\out{<div class="arguments">}}
166147
\describe{
167-
\item{\code{duplicate}}{This one is}
168-
\item{\code{duplicate}}{Twice}
148+
\item{\code{x}}{An argument.}
169149
}
170150
\if{html}{\out{</div>}}
171151
}
172152
173-
\subsection{Details}{
174-
Method 3 details.
175-
}
176-
177-
\subsection{Returns}{
178-
twice.
179-
}
180-
181153
}
182154
\if{html}{\out{<hr>}}
183155
\if{html}{\out{<a id="method-A-clone"></a>}}
@@ -214,7 +186,7 @@
214186
\description{
215187
B method 1.
216188
217-
A method 4.
189+
B method 4.
218190
}
219191
\section{Super class}{
220192
\code{A} -> \code{B}
@@ -277,7 +249,7 @@
277249
\if{html}{\out{<a id="method-B-meth4"></a>}}
278250
\if{latex}{\out{\hypertarget{method-B-meth4}{}}}
279251
\subsection{Method \code{meth4()}}{
280-
A method 4.
252+
B method 4.
281253
\subsection{Usage}{
282254
\if{html}{\out{<div class="r">}}
283255
\preformatted{B$meth4()}
@@ -328,30 +300,20 @@
328300
\section{Public fields}{
329301
\if{html}{\out{<div class="r6-fields">}}
330302
\describe{
331-
\item{\code{nosuchfield}}{This will warn.}
303+
\item{\code{field2}}{C field 2.}
332304
333305
\item{\code{field5}}{C field 5.}
334-
335-
\item{\code{duplicatefield}}{Multiple.}
336-
337-
\item{\code{duplicatefield}}{times.}
338306
}
339307
\if{html}{\out{</div>}}
340308
}
341309
\section{Active bindings}{
342310
\if{html}{\out{<div class="r6-active-bindings">}}
343311
\describe{
344-
\item{\code{nosuchfield}}{This will warn.}
345-
346312
\item{\code{active2}}{C binding 2.}
347313
348314
\item{\code{active4}}{C binding 4.}
349315
350316
\item{\code{active6}}{C binding 6.}
351-
352-
\item{\code{duplicate_binding}}{Double.}
353-
354-
\item{\code{duplicate_binding}}{Double double.}
355317
}
356318
\if{html}{\out{</div>}}
357319
}
@@ -360,7 +322,6 @@
360322
\itemize{
361323
\item \href{#method-C-meth2}{\code{C$meth2()}}
362324
\item \href{#method-C-meth5}{\code{C$meth5()}}
363-
\item \href{#method-C-undocumented_method}{\code{C$undocumented_method()}}
364325
}
365326
}
366327
\if{html}{\out{<details open><summary>Inherited methods</summary>
@@ -402,17 +363,6 @@
402363
\if{html}{\out{</div>}}
403364
}
404365
405-
}
406-
\if{html}{\out{<hr>}}
407-
\if{html}{\out{<a id="method-C-undocumented_method"></a>}}
408-
\if{latex}{\out{\hypertarget{method-C-undocumented_method}{}}}
409-
\subsection{Method \code{undocumented_method()}}{
410-
\subsection{Usage}{
411-
\if{html}{\out{<div class="r">}}
412-
\preformatted{C$undocumented_method()}
413-
\if{html}{\out{</div>}}
414-
}
415-
416366
}
417367
}
418368

tests/testthat/test-rd-r6.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
test_that("integration test", {
22
path <- local_package_copy(test_path("testR6"))
3-
expect_snapshot(roxygenise(path))
3+
suppressMessages(roxygenise(path))
44
withr::defer(pkgload::unload("testR6"))
55

66
rd_files <- sort(dir(file.path(path, "man"), full.names = TRUE))

tests/testthat/testR6/R/classes.R

Lines changed: 10 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
#' @details
77
#' Class A details
88
#'
9-
#' @param fogbehindme This is not show up in the output at all.
109
#' @param Z zzzzzzz
1110

1211
A <- R6::R6Class(
@@ -22,17 +21,15 @@ A <- R6::R6Class(
2221
#' @details Method 2 details.
2322
#' @param Z Overriding Z argument for meth2.
2423
#' @param ... Rest.
24+
#' @return A value.
2525
#' @examples
2626
#' ## Example for meth2
2727
meth2 = function(Z = 10, ...) {},
2828
#' @field field2 A field 2.
2929
field2 = "foobar",
30-
#' @details Method 3 details.
31-
#' @param duplicate This one is
32-
#' @param duplicate Twice
33-
#' @return twice.
34-
#' @return really?
35-
meth3 = function(duplicate, missing) {},
30+
#' @description Method 3.
31+
#' @param x An argument.
32+
meth3 = function(x) {},
3633
#' @field field3 A field 3.
3734
field3 = "baz"
3835
),
@@ -41,7 +38,7 @@ A <- R6::R6Class(
4138
active1 = function(x) {},
4239
#' @field active2 A binding 2.
4340
active2 = function(x) {},
44-
#' @field active3 A binding 2.
41+
#' @field active3 A binding 3.
4542
active3 = function(x) {}
4643
)
4744
)
@@ -65,7 +62,7 @@ B <- R6::R6Class(
6562
#' @description B method 1.
6663
#' @param Z Still zzzzzzzz.
6764
meth1 = function(Z) {},
68-
#' @description A method 4.
65+
#' @description B method 4.
6966
meth4 = function() {}
7067
),
7168
active = list(
@@ -84,15 +81,14 @@ B <- R6::R6Class(
8481
#' Class C Description.
8582
#'
8683
#' @details
87-
#' Classs C details.
88-
#'
89-
#' @field nosuchfield This will warn.
84+
#' Class C details.
9085

9186
C <- R6::R6Class(
9287
"C",
9388
inherit = B,
9489
cloneable = FALSE,
9590
public = list(
91+
#' @field field2 C field 2.
9692
field2 = NULL,
9793
#' @description C method 2.
9894
#' @param Z zzzzz
@@ -101,23 +97,14 @@ C <- R6::R6Class(
10197
#' @field field5 C field 5.
10298
field5 = "foobar",
10399
#' @description C method 5.
104-
meth5 = function() {},
105-
undocumented_field = NULL,
106-
undocumented_method = function() {},
107-
#' @field duplicatefield Multiple.
108-
#' @field duplicatefield times.
109-
duplicatefield = NULL
100+
meth5 = function() {}
110101
),
111102
active = list(
112103
#' @field active2 C binding 2.
113104
active2 = function(x) {},
114105
#' @field active4 C binding 4.
115106
active4 = function(x) {},
116107
#' @field active6 C binding 6.
117-
active6 = function(x) {},
118-
undocumented_binding = function(x) {},
119-
#' @field duplicate_binding Double.
120-
#' @field duplicate_binding Double double.
121-
duplicate_binding = function(x) {}
108+
active6 = function(x) {}
122109
)
123110
)

0 commit comments

Comments
 (0)