Skip to content

Commit 50cf419

Browse files
committed
Oops it was used
1 parent 6006881 commit 50cf419

File tree

3 files changed

+12
-8
lines changed

3 files changed

+12
-8
lines changed

R/snapshot-file.R

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ expect_snapshot_file <- function(
160160
if (in_check_reporter()) {
161161
hint <- ""
162162
} else {
163-
hint <- snapshot_review_hint(file, is_text = is_text)
163+
hint <- snapshot_review_hint(file, name, is_text = is_text)
164164
}
165165

166166
if (!equal) {
@@ -209,6 +209,7 @@ announce_snapshot_file <- function(path, name = basename(path)) {
209209

210210
snapshot_review_hint <- function(
211211
test,
212+
name,
212213
is_text = FALSE,
213214
reset_output = TRUE
214215
) {
@@ -219,11 +220,11 @@ snapshot_review_hint <- function(
219220
c(
220221
if (is_text) {
221222
cli::format_inline(
222-
"* Run {.run testthat::snapshot_accept('{test}/')} to accept the change."
223+
"* Run {.run testthat::snapshot_accept('{test}/{name}')} to accept the change."
223224
)
224225
},
225226
cli::format_inline(
226-
"* Run {.run testthat::snapshot_review('{test}/')} to review the change."
227+
"* Run {.run testthat::snapshot_review('{test}/{name}')} to review the change."
227228
)
228229
)
229230
}

tests/testthat/_snaps/snapshot-file.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,17 +25,18 @@
2525
# generates informative hint
2626

2727
Code
28-
base::writeLines(snapshot_review_hint("lala", reset_output = FALSE))
28+
base::writeLines(snapshot_review_hint("lala", "foo.R", reset_output = FALSE))
2929
Output
30-
* Run `testthat::snapshot_review('lala/')` to review the change.
30+
* Run `testthat::snapshot_review('lala/foo.R')` to review the change.
3131

3232
---
3333

3434
Code
35-
base::writeLines(snapshot_review_hint("lala", is_text = TRUE, reset_output = FALSE))
35+
base::writeLines(snapshot_review_hint("lala", "foo.R", is_text = TRUE,
36+
reset_output = FALSE))
3637
Output
37-
* Run `testthat::snapshot_accept('lala/')` to accept the change.
38-
* Run `testthat::snapshot_review('lala/')` to review the change.
38+
* Run `testthat::snapshot_accept('lala/foo.R')` to accept the change.
39+
* Run `testthat::snapshot_review('lala/foo.R')` to review the change.
3940

4041
# expect_snapshot_file validates its inputs
4142

tests/testthat/test-snapshot-file.R

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,11 +165,13 @@ test_that("split_path handles edge cases", {
165165
test_that("generates informative hint", {
166166
expect_snapshot(base::writeLines(snapshot_review_hint(
167167
"lala",
168+
"foo.R",
168169
reset_output = FALSE
169170
)))
170171

171172
expect_snapshot(base::writeLines(snapshot_review_hint(
172173
"lala",
174+
"foo.R",
173175
is_text = TRUE,
174176
reset_output = FALSE
175177
)))

0 commit comments

Comments
 (0)