From cef1540f71f8f69857d4551c85fc3a96c379e899 Mon Sep 17 00:00:00 2001 From: "Adam H. Sparks" Date: Tue, 16 Jul 2024 16:14:08 +0800 Subject: [PATCH] Add test infrastructure --- DESCRIPTION | 3 +++ tests/testthat.R | 12 ++++++++++++ tests/testthat/test-test-colours_as_hex.R | 3 +++ 3 files changed, 18 insertions(+) create mode 100644 tests/testthat.R create mode 100644 tests/testthat/test-test-colours_as_hex.R diff --git a/DESCRIPTION b/DESCRIPTION index 4a2f5b8..4a02fd3 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -20,3 +20,6 @@ Imports: Depends: R (>= 2.10) LazyData: true +Suggests: + testthat (>= 3.0.0) +Config/testthat/edition: 3 diff --git a/tests/testthat.R b/tests/testthat.R new file mode 100644 index 0000000..fe07c70 --- /dev/null +++ b/tests/testthat.R @@ -0,0 +1,12 @@ +# This file is part of the standard setup for testthat. +# It is recommended that you do not modify it. +# +# Where should you do additional test configuration? +# Learn more about the roles of various files in: +# * https://r-pkgs.org/testing-design.html#sec-tests-files-overview +# * https://testthat.r-lib.org/articles/special-files.html + +library(testthat) +library(AAGIPalettes) + +test_check("AAGIPalettes") diff --git a/tests/testthat/test-test-colours_as_hex.R b/tests/testthat/test-test-colours_as_hex.R new file mode 100644 index 0000000..3c7c36b --- /dev/null +++ b/tests/testthat/test-test-colours_as_hex.R @@ -0,0 +1,3 @@ +test_that("colours_as_hex returns proper hex values", { + expect_equal(colour_as_hex(name = "AAGI Black"), "#414042") +})