|
4 | 4 | # success |
5 | 5 | run_test("use-tidy-description", "DESCRIPTION", suffix = "") |
6 | 6 |
|
| 7 | +# in sub directory with correct root |
| 8 | +run_test("use-tidy-description", |
| 9 | + "DESCRIPTION", |
| 10 | + suffix = "", |
| 11 | + cmd_args="--root=rpkg", |
| 12 | + artifacts = c("rpkg/DESCRIPTION" = test_path("in/DESCRIPTION"))) |
| 13 | + |
| 14 | + |
| 15 | + |
| 16 | +# in sub directory with incorrect root |
| 17 | +# Need to generate the directoy `rpkg` but without DESCRIPTION file. |
| 18 | +run_test("use-tidy-description", |
| 19 | + "DESCRIPTION", |
| 20 | + suffix = "", |
| 21 | + cmd_args="--root=rpkg", |
| 22 | + std_err="No `DESCRIPTION` found in repository.", |
| 23 | + artifacts = c("rpkg/README.md" = test_path("in/README.md"))) |
| 24 | + |
7 | 25 | ### . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. |
8 | 26 | ### style-files #### |
9 | 27 |
|
@@ -373,20 +391,58 @@ run_test("roxygenize", |
373 | 391 | } |
374 | 392 | ) |
375 | 393 |
|
| 394 | +# with outdated Rd present in correct root |
| 395 | +run_test("roxygenize", |
| 396 | + file_name = c("rpkg/man/flie.Rd" = "flie.Rd"), |
| 397 | + suffix = "", |
| 398 | + std_err = NA, |
| 399 | + cmd_args="--root=rpkg", |
| 400 | + std_out = "Writing NAMESPACE", |
| 401 | + artifacts = c( |
| 402 | + "rpkg/DESCRIPTION" = test_path("in/DESCRIPTION-no-deps.dcf"), |
| 403 | + "rpkg/R/roxygenize.R" = test_path("in/roxygenize.R") |
| 404 | + ), |
| 405 | + file_transformer = function(files) { |
| 406 | + git_init() |
| 407 | + git2r::add(path = files) |
| 408 | + # hack to add artifact to trigger diff_requires_roxygenize() |
| 409 | + git2r::add(path = fs::path(fs::path_dir(fs::path_dir(files[1])), "rpkg/R")) |
| 410 | + files |
| 411 | + } |
| 412 | +) |
| 413 | + |
376 | 414 |
|
377 | 415 | # without Rd present |
378 | 416 | run_test("roxygenize", |
379 | | - file_name = c("R/roxygenize.R" = "roxygenize.R"), |
| 417 | + file_name = c("rpkg1/R/roxygenize.R" = "roxygenize.R"), |
380 | 418 | suffix = "", |
| 419 | + cmd_args="--root=rpkg1", |
381 | 420 | std_err = "Please commit the new `.Rd` files", |
382 | 421 | artifacts = c( |
383 | | - "DESCRIPTION" = test_path("in/DESCRIPTION-no-deps.dcf") |
| 422 | + "rpkg1/DESCRIPTION" = test_path("in/DESCRIPTION-no-deps.dcf"), |
| 423 | + "rpkg2/R/roxygenize.R" = test_path("in/roxygenize.R") |
384 | 424 | ), |
385 | 425 | file_transformer = function(files) { |
386 | 426 | git_init() |
387 | 427 | git2r::add(path = files) |
388 | 428 | files |
389 | 429 | } |
| 430 | + |
| 431 | +) |
| 432 | + |
| 433 | +# with Rd present in wrong root |
| 434 | +run_test("roxygenize", |
| 435 | + file_name = c("R/roxygenize.R" = "roxygenize.R"), |
| 436 | + suffix = "", |
| 437 | + std_err = "Please commit the new `.Rd` files", |
| 438 | + artifacts = c( |
| 439 | + "DESCRIPTION" = test_path("in/DESCRIPTION-no-deps.dcf") |
| 440 | + ), |
| 441 | + file_transformer = function(files) { |
| 442 | + git_init() |
| 443 | + git2r::add(path = files) |
| 444 | + files |
| 445 | + } |
390 | 446 | ) |
391 | 447 |
|
392 | 448 |
|
@@ -458,6 +514,42 @@ run_test("codemeta-description-update", |
458 | 514 | } |
459 | 515 | ) |
460 | 516 |
|
| 517 | +# succeed in correct root |
| 518 | +run_test("codemeta-description-update", |
| 519 | + file_name = c("rpkg/DESCRIPTION" = "DESCRIPTION", |
| 520 | + "rpkg/codemeta.json" = "codemeta.json"), |
| 521 | + cmd_args="--root=rpkg", |
| 522 | + suffix = "", |
| 523 | + file_transformer = function(files) { |
| 524 | + if (length(files) > 1) { |
| 525 | + # transformer is called once on all files and once per file |
| 526 | + content_2 <- readLines(files[2]) |
| 527 | + Sys.sleep(2) |
| 528 | + writeLines(content_2, files[2]) |
| 529 | + } |
| 530 | + files |
| 531 | + } |
| 532 | +) |
| 533 | + |
| 534 | +# # fail in wrong root |
| 535 | +run_test("codemeta-description-update", |
| 536 | + file_name = c("rpkg/DESCRIPTION" = "DESCRIPTION", |
| 537 | + "rpkg/codemeta.json" = "codemeta.json", |
| 538 | + "rpkg2/codemeta.json" = "README.md"), |
| 539 | + cmd_args="--root=rpkg2", |
| 540 | + std_err="No `DESCRIPTION` found in repository.", |
| 541 | + suffix = "", |
| 542 | + file_transformer = function(files) { |
| 543 | + if (length(files) > 1) { |
| 544 | + # transformer is called once on all files and once per file |
| 545 | + content_2 <- readLines(files[2]) |
| 546 | + Sys.sleep(2) |
| 547 | + writeLines(content_2, files[2]) |
| 548 | + } |
| 549 | + files |
| 550 | + } |
| 551 | +) |
| 552 | + |
461 | 553 | ### . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. |
462 | 554 | ### readme-rmd-rendered #### |
463 | 555 | if (has_git()) { |
|
0 commit comments