diff --git a/guinep/src/test/scala/formgentests.scala b/guinep/src/test/scala/formgentests.scala index ee5af12..4e8eb84 100644 --- a/guinep/src/test/scala/formgentests.scala +++ b/guinep/src/test/scala/formgentests.scala @@ -265,6 +265,17 @@ class FormGenTests extends munit.FunSuite { ) ) + checkGeneratedFormEquals( + "showNullableInt", + showNullableInt, + Form( + Seq( + FormElement.Nullable("i", FormElement.NumberInput("i", Types.IntType.Int)) + ), + Map.empty + ) + ) + checkGeneratedFormEquals( "isInTree", isInTree, diff --git a/guinep/src/test/scala/rungentests.scala b/guinep/src/test/scala/rungentests.scala index 8d18ceb..36580d3 100644 --- a/guinep/src/test/scala/rungentests.scala +++ b/guinep/src/test/scala/rungentests.scala @@ -207,6 +207,20 @@ class RunGenTests extends munit.FunSuite { "6.0" ) + checkGeneratedRunResultEquals( + "showNullableInt", + showNullableInt, + List(null), + "null" + ) + + checkGeneratedRunResultEquals( + "showNullableInt", + showNullableInt, + List(1), + "1" + ) + checkGeneratedRunResultEquals( "isInTree", isInTree, diff --git a/guinep/src/test/scala/testsdata.scala b/guinep/src/test/scala/testsdata.scala index 3f7814b..c3838cc 100644 --- a/guinep/src/test/scala/testsdata.scala +++ b/guinep/src/test/scala/testsdata.scala @@ -82,6 +82,9 @@ object TestsData { def productSeq(s: Seq[Float]): Float = s.product + def showNullableInt(i: Int | Null): String = + if i == null then "null" else i.toString + enum IntTree: case Leaf case Node(left: IntTree, value: Int, right: IntTree)