Skip to content

Commit 2149092

Browse files
committed
fix example and tests
1 parent 97d2c4d commit 2149092

File tree

8 files changed

+25
-10
lines changed

8 files changed

+25
-10
lines changed

R/info.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ orderly_info <- function(id, name, root = NULL, locate = TRUE) {
8080
##' @export
8181
##'
8282
##' @examples
83-
##' orderly::orderly_packages()
83+
##' path <- orderly::orderly_example("minimal")
8484
##' orderly::orderly_packages(root = path)
8585
orderly_packages <- function(root = NULL, locate = TRUE) {
8686
cfg <- orderly_config(root, locate)

inst/examples/minimal/src/example/orderly.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@ artefacts:
66
staticgraph:
77
description: A graph of things
88
filenames: mygraph.png
9+
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
data:
2+
dat:
3+
query: SELECT name, number FROM thing
4+
script: script.R
5+
artefacts:
6+
staticgraph:
7+
description: A graph of things
8+
filenames: mygraph.png
9+
packages:
10+
- withr
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
png("mygraph.png")
2+
par(mar = c(15, 4, .5, .5))
3+
barplot(setNames(dat$number, dat$name), las = 2)
4+
dev.off()

man/orderly_packages.Rd

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/testthat/test-cleanup.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ test_that("cleanup nothing", {
44
path <- test_prepare_orderly_example("minimal")
55
out <- capture_logs(orderly_cleanup(root = path))
66
expect_null(out$result)
7-
expect_equal(orderly_list(root = path), "example")
7+
expect_equal(orderly_list(root = path), c("example", "example2"))
88
expect_match(out$messages, "Found 0 draft reports", all = FALSE)
99
expect_match(out$messages, "Found 0 csv files", all = FALSE)
1010
expect_match(out$messages, "Found 0 rds files", all = FALSE)

tests/testthat/test-main.R

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ test_that("run", {
1515
expect_identical(res$target, main_do_run)
1616

1717
capture.output(res$target(res))
18-
expect_equal(orderly_list(path), "example")
18+
expect_equal(orderly_list(path), c("example", "example2"))
1919
expect_equal(nrow(orderly_list_archive(path)), 1)
2020
})
2121

@@ -36,7 +36,7 @@ test_that("run: id-file", {
3636
expect_identical(res$target, main_do_run)
3737

3838
capture.output(res$target(res))
39-
expect_equal(orderly_list(path), "example")
39+
expect_equal(orderly_list(path), c("example", "example2"))
4040

4141
expect_true(file.exists(id_file))
4242
id <- readLines(id_file)
@@ -302,7 +302,7 @@ test_that("list", {
302302
args <- c("--root", path, "list")
303303
res <- cli_args_process(args)
304304

305-
expect_output(res$target(res), "^example$")
305+
expect_output(res$target(res), "^example\\nexample2$")
306306

307307
for (i in c("names", "drafts", "archive")) {
308308
expect_equal(
@@ -420,7 +420,7 @@ test_that("list", {
420420
orderly_commit(id2, root = path)
421421

422422
res <- cli_args_process(c("--root", path, "list", "names"))
423-
expect_equal(capture.output(res$target(res)), "example")
423+
expect_equal(capture.output(res$target(res)), c("example", "example2"))
424424

425425
res <- cli_args_process(c("--root", path, "list", "drafts"))
426426
out1 <- capture.output(res$target(res))
@@ -697,7 +697,7 @@ test_that("run can save workflow metadata", {
697697
expect_equal(res$options$workflow_id, "123")
698698

699699
capture.output(res$target(res))
700-
expect_equal(orderly_list(path), "example")
700+
expect_equal(orderly_list(path), c("example", "example2"))
701701
expect_equal(nrow(orderly_list_archive(path)), 1)
702702
id <- orderly_list_archive(path)$id
703703
rds <- path_orderly_run_rds(file.path(path, "archive", "example", id))

tests/testthat/test-query.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,13 @@ test_that("empty", {
1515

1616
test_that("non-empty", {
1717
path <- test_prepare_orderly_example("minimal")
18-
expect_equal(orderly_list(path), "example")
18+
expect_equal(orderly_list(path), c("example", "example2"))
1919
})
2020

2121
test_that("query through lifecycle", {
2222
skip_on_cran_windows()
2323
path <- test_prepare_orderly_example("minimal")
24-
expect_equal(orderly_list(root = path), "example")
24+
expect_equal(orderly_list(root = path), c("example", "example2"))
2525

2626
empty <- data.frame(name = character(0), id = character(0),
2727
stringsAsFactors = FALSE)

0 commit comments

Comments
 (0)