diff options
Diffstat (limited to 'stdlib/source/test/lux/type/dynamic.lux')
-rw-r--r-- | stdlib/source/test/lux/type/dynamic.lux | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/stdlib/source/test/lux/type/dynamic.lux b/stdlib/source/test/lux/type/dynamic.lux new file mode 100644 index 000000000..70e26f743 --- /dev/null +++ b/stdlib/source/test/lux/type/dynamic.lux @@ -0,0 +1,31 @@ +(.module: + [lux #* + [control + [monad (#+ do)]] + [data + ["." error]] + [math + ["r" random]] + [type + ["/" dynamic (#+ Dynamic :dynamic :check)]]] + lux/test) + +(context: "Dynamic typing." + (do @ + [expected r.nat + #let [value (:dynamic expected)]] + ($_ seq + (test "Can check dynamic values." + (case (:check Nat value) + (#error.Success actual) + (n/= expected actual) + + (#error.Failure error) + false)) + (test "Cannot confuse types." + (case (:check Text value) + (#error.Success actual) + false + + (#error.Failure error) + true))))) |