From 094607bdc177b82e89bc0ead37c450382d31bfc9 Mon Sep 17 00:00:00 2001 From: Simon Parker <65285181+awadafuk@users.noreply.github.com> Date: Fri, 16 Feb 2024 16:54:33 +0000 Subject: [PATCH 1/4] fix: Fixed an issue in `autotest_single_yaml()` where if all items in `reports` were not to be tested then the returned value of 'reports' was a data frame with 0 rows, instead of `NULL`. When `res` in `autotest_package()` is a data frame with 0 rows, `order_at_rows` experiences an error. --- R/autotest-functions.R | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/R/autotest-functions.R b/R/autotest-functions.R index fcd68b88..e4d6eef0 100644 --- a/R/autotest-functions.R +++ b/R/autotest-functions.R @@ -159,8 +159,21 @@ autotest_single_yaml <- function (yaml = NULL, reports <- reports [which (!duplicated (reports)), ] # rm "no_test" tests switched off from "test_data" - if (test) - reports <- reports [which (!reports$type == "no_test"), ] + if (test) { + + no_test <- reports$type == "no_test" + + if (all (no_test)) { + + reports <- NULL + + } else { + + reports <- reports [which(!no_test), ] + + } + + } rownames (reports) <- NULL } From e94d5d4b3052e7f7cf5f6a67dd9f0f5b972d245f Mon Sep 17 00:00:00 2001 From: Simon Parker <65285181+awadafuk@users.noreply.github.com> Date: Fri, 16 Feb 2024 16:56:55 +0000 Subject: [PATCH 2/4] fix: Updated previous commit to include a rownames change in the right logic block --- R/autotest-functions.R | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/R/autotest-functions.R b/R/autotest-functions.R index e4d6eef0..d1c45efa 100644 --- a/R/autotest-functions.R +++ b/R/autotest-functions.R @@ -171,11 +171,12 @@ autotest_single_yaml <- function (yaml = NULL, reports <- reports [which(!no_test), ] + rownames (reports) <- NULL + } } - rownames (reports) <- NULL } return (reports) From 01bb5c4f00bdcff9532967e533f76cb3a40561a1 Mon Sep 17 00:00:00 2001 From: mark padgham Date: Wed, 21 Feb 2024 14:14:35 +0100 Subject: [PATCH 3/4] Apply suggestions from code review --- R/autotest-functions.R | 7 ------- 1 file changed, 7 deletions(-) diff --git a/R/autotest-functions.R b/R/autotest-functions.R index d1c45efa..2c87611e 100644 --- a/R/autotest-functions.R +++ b/R/autotest-functions.R @@ -160,21 +160,14 @@ autotest_single_yaml <- function (yaml = NULL, # rm "no_test" tests switched off from "test_data" if (test) { - no_test <- reports$type == "no_test" - if (all (no_test)) { - reports <- NULL } else { - reports <- reports [which(!no_test), ] - rownames (reports) <- NULL - } - } } From f93ef5f6d7613ba27d299cf489067b2a5d8bfe99 Mon Sep 17 00:00:00 2001 From: mark padgham Date: Wed, 21 Feb 2024 14:15:15 +0100 Subject: [PATCH 4/4] Apply suggestions from code review --- R/autotest-functions.R | 1 - 1 file changed, 1 deletion(-) diff --git a/R/autotest-functions.R b/R/autotest-functions.R index 2c87611e..9f88a5a7 100644 --- a/R/autotest-functions.R +++ b/R/autotest-functions.R @@ -163,7 +163,6 @@ autotest_single_yaml <- function (yaml = NULL, no_test <- reports$type == "no_test" if (all (no_test)) { reports <- NULL - } else { reports <- reports [which(!no_test), ] rownames (reports) <- NULL