Skip to content

Commit

Permalink
adapt tests for new testing infra
Browse files Browse the repository at this point in the history
  • Loading branch information
lorenzwalthert committed Jul 23, 2024
1 parent 1da1477 commit 0e3d904
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions tests/testthat/test-hook-codemeta-description-updated.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ run_test("codemeta-description-update",
file_name = c("codemeta.json"),
suffix = "",
std_out = "No `DESCRIPTION` found in repository.",
std_err = "",
expect_success = FALSE,
read_only = TRUE,
)
Expand All @@ -11,20 +10,16 @@ run_test("codemeta-description-update",
file_name = c("DESCRIPTION"),
suffix = "",
std_out = "No `codemeta.json` found in repository.",
std_err = "",
# voluntary
expect_success = FALSE,
read_only = TRUE
)


# outdated
run_test("codemeta-description-update",
file_name = c("DESCRIPTION", "codemeta.json"),
suffix = "",
std_err = "",
expect_success = FALSE,
std_out = "out of date",
expect_success = FALSE,
file_transformer = function(files) {
if (length(files) > 1) {
# transformer is called once on all files and once per file
Expand All @@ -33,7 +28,7 @@ run_test("codemeta-description-update",
writeLines(content_2, files[1])
}
files
}
},
)

# succeed
Expand All @@ -48,7 +43,9 @@ run_test("codemeta-description-update",
writeLines(content_2, files[2])
}
files
}
},
expect_success = TRUE,
read_only = TRUE
)

if (!on_cran()) {
Expand All @@ -68,7 +65,9 @@ if (!on_cran()) {
writeLines(content_2, files[2])
}
files
}
},
expect_success = TRUE,
read_only = TRUE
)

# # fail in wrong root
Expand All @@ -79,7 +78,7 @@ if (!on_cran()) {
"rpkg2/codemeta.json" = "README.md"
),
cmd_args = "--root=rpkg2",
std_err = "No `DESCRIPTION` found in repository.",
std_out = "No `DESCRIPTION` found in repository.",
suffix = "",
file_transformer = function(files) {
if (length(files) > 1) {
Expand All @@ -89,6 +88,8 @@ if (!on_cran()) {
writeLines(content_2, files[2])
}
files
}
},
expect_success = FALSE,
read_only = TRUE
)
}

0 comments on commit 0e3d904

Please sign in to comment.