From 7dc8189266d8f235b4b7f645e427e15b14a35fd8 Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Mon, 1 Jul 2024 12:30:22 -0400 Subject: [PATCH] Add test for optionals --- test/optionals.tm | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 test/optionals.tm diff --git a/test/optionals.tm b/test/optionals.tm new file mode 100644 index 0000000..5f6fb78 --- /dev/null +++ b/test/optionals.tm @@ -0,0 +1,15 @@ + +func main(): + >> opt := @5? + when opt is @nonnull: + >> nonnull[] + = 5 + else: + fail("Oops") + + >> opt = !@Int + when opt is @nonnull: + fail("Oops") + else: + >> opt + = !Int