From 2e1bb7e433c93d34b15cfe5706d5d6c35271bf7d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Fromentin?= Date: Mon, 2 Oct 2023 13:30:29 +0200 Subject: [PATCH] test: Cover `value` extension for `RefinedTypeOps` --- ...inedOpsSuite.scala => RefinedTypeOpsSuite.scala} | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) rename main/test/src/io/github/iltotore/iron/testing/{RefinedOpsSuite.scala => RefinedTypeOpsSuite.scala} (87%) diff --git a/main/test/src/io/github/iltotore/iron/testing/RefinedOpsSuite.scala b/main/test/src/io/github/iltotore/iron/testing/RefinedTypeOpsSuite.scala similarity index 87% rename from main/test/src/io/github/iltotore/iron/testing/RefinedOpsSuite.scala rename to main/test/src/io/github/iltotore/iron/testing/RefinedTypeOpsSuite.scala index 6c9e0ee3..748ea2f6 100644 --- a/main/test/src/io/github/iltotore/iron/testing/RefinedOpsSuite.scala +++ b/main/test/src/io/github/iltotore/iron/testing/RefinedTypeOpsSuite.scala @@ -41,9 +41,9 @@ object RefinedTypeOpsSuite extends TestSuite: test("option") { val fromWithFailingPredicate = Temperature.option(-5.0) - assert(fromWithFailingPredicate == None) + assert(fromWithFailingPredicate.isEmpty) val fromWithSucceedingPredicate = Temperature.option(100) - assert(fromWithSucceedingPredicate == Some(Temperature(100))) + assert(fromWithSucceedingPredicate.contains(Temperature(100))) } test("applyUnsafe") { @@ -63,8 +63,8 @@ object RefinedTypeOpsSuite extends TestSuite: test - assert(Moisture(positive) == moisture) test - assert(Moisture.either(-5.0) == Left("Should be strictly positive")) test - assert(Moisture.either(100) == Right(Moisture(100))) - test - assert(Moisture.option(-5.0) == None) - test - assert(Moisture.option(100) == Some(Moisture(100))) + test - assert(Moisture.option(-5.0).isEmpty) + test - assert(Moisture.option(100).contains(Moisture(100))) } test("mirror") { @@ -74,4 +74,9 @@ object RefinedTypeOpsSuite extends TestSuite: assertGiven[mirror.ConstraintType =:= Positive] assertGiven[mirror.FinalType =:= Temperature] } + + test("value") { + val temperature = Temperature(10) + assert(temperature.value == 10) + } }