From 8ad4544b1d94455694ac595c76cc55be3fa89e7a Mon Sep 17 00:00:00 2001 From: Chris Pyles Date: Fri, 16 Dec 2022 21:14:50 -0800 Subject: [PATCH] v1.3.0 --- DESCRIPTION | 2 +- R/TestFileResult.R | 5 +---- R/utils.R | 9 --------- man/nullish.Rd | 17 ----------------- .../fails_2_hidden.json | 3 +++ .../integration_expected_results/fails_3.json | 3 +++ .../passes_all.json | 3 +++ tests/testthat/test_TestFileResult.R | 3 ++- 8 files changed, 13 insertions(+), 32 deletions(-) delete mode 100644 man/nullish.Rd diff --git a/DESCRIPTION b/DESCRIPTION index 48ccc1e..85aed29 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: ottr Title: An R Autograding Extension for Otter-Grader -Version: 1.2.0 +Version: 1.3.0 Authors@R: c( person(given = "Christopher", family = "Pyles", diff --git a/R/TestFileResult.R b/R/TestFileResult.R index 640122f..56aa711 100644 --- a/R/TestFileResult.R +++ b/R/TestFileResult.R @@ -84,13 +84,10 @@ TestFileResult <- R6::R6Class( ret <- list( filename = self$filename, + points = self$points, test_case_results = tcr_lists ) - if (!nullish(self$points)) { - ret$points <- self$points - } - return(ret) } ) diff --git a/R/utils.R b/R/utils.R index 49ba254..60c6fc5 100644 --- a/R/utils.R +++ b/R/utils.R @@ -58,12 +58,3 @@ valid_syntax <- function(script) { ) return(!error) } - -#' Check whether a value is nullish (i.e. NULL or NA) -#' -#' @param x The value to cehck -#' -#' @return Whether the value is nullish -nullish <- function(x) { - return(is.null(x) || is.na(x)) -} diff --git a/man/nullish.Rd b/man/nullish.Rd deleted file mode 100644 index 8d8d69d..0000000 --- a/man/nullish.Rd +++ /dev/null @@ -1,17 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/utils.R -\name{nullish} -\alias{nullish} -\title{Check whether a value is nullish (i.e. NULL or NA)} -\usage{ -nullish(x) -} -\arguments{ -\item{x}{The value to cehck} -} -\value{ -Whether the value is nullish -} -\description{ -Check whether a value is nullish (i.e. NULL or NA) -} diff --git a/tests/testthat/files/integration_expected_results/fails_2_hidden.json b/tests/testthat/files/integration_expected_results/fails_2_hidden.json index b81c959..7f7e340 100644 --- a/tests/testthat/files/integration_expected_results/fails_2_hidden.json +++ b/tests/testthat/files/integration_expected_results/fails_2_hidden.json @@ -2,6 +2,7 @@ "test_file_results": [ { "filename": "files/integration_test_cases/q1.R", + "points": null, "test_case_results": [ { "passed": true, @@ -31,6 +32,7 @@ }, { "filename": "files/integration_test_cases/q2.R", + "points": null, "test_case_results": [ { "passed": true, @@ -60,6 +62,7 @@ }, { "filename": "files/integration_test_cases/q3.R", + "points": null, "test_case_results": [ { "passed": true, diff --git a/tests/testthat/files/integration_expected_results/fails_3.json b/tests/testthat/files/integration_expected_results/fails_3.json index be854e5..f631075 100644 --- a/tests/testthat/files/integration_expected_results/fails_3.json +++ b/tests/testthat/files/integration_expected_results/fails_3.json @@ -2,6 +2,7 @@ "test_file_results": [ { "filename": "files/integration_test_cases/q1.R", + "points": null, "test_case_results": [ { "passed": true, @@ -31,6 +32,7 @@ }, { "filename": "files/integration_test_cases/q2.R", + "points": null, "test_case_results": [ { "passed": true, @@ -60,6 +62,7 @@ }, { "filename": "files/integration_test_cases/q3.R", + "points": null, "test_case_results": [ { "passed": false, diff --git a/tests/testthat/files/integration_expected_results/passes_all.json b/tests/testthat/files/integration_expected_results/passes_all.json index e55b8bc..5277cb5 100644 --- a/tests/testthat/files/integration_expected_results/passes_all.json +++ b/tests/testthat/files/integration_expected_results/passes_all.json @@ -2,6 +2,7 @@ "test_file_results": [ { "filename": "files/integration_test_cases/q1.R", + "points": null, "test_case_results": [ { "passed": true, @@ -31,6 +32,7 @@ }, { "filename": "files/integration_test_cases/q2.R", + "points": null, "test_case_results": [ { "passed": true, @@ -60,6 +62,7 @@ }, { "filename": "files/integration_test_cases/q3.R", + "points": null, "test_case_results": [ { "passed": true, diff --git a/tests/testthat/test_TestFileResult.R b/tests/testthat/test_TestFileResult.R index 0d6f02c..78bdca8 100644 --- a/tests/testthat/test_TestFileResult.R +++ b/tests/testthat/test_TestFileResult.R @@ -82,8 +82,9 @@ test_that("$to_list() returns the test file results as a list", { tfr_list <- tfr$to_list() expect_true(is.list(tfr_list)) - expect_equal(length(tfr_list), 2) + expect_equal(length(tfr_list), 3) expect_equal(tfr_list$filename, filename) + expect_equal(tfr_list$points, NULL) expect_equal(tfr_list$test_case_results, lapply(tcrs, function(tcr) tcr$to_list())) tfr <- TestFileResult$new(filename, tcrs, 2)