diff options
author | Eduardo Julian | 2021-01-26 19:11:14 -0400 |
---|---|---|
committer | Eduardo Julian | 2021-01-26 19:11:14 -0400 |
commit | 43d28326ad59c74439b96343cc8f619ed7d90231 (patch) | |
tree | 3f410d48bfca7d8141e2e7fda0f8d978934dd5c2 /stdlib/source/test/lux/type | |
parent | ae56acf791c2ed9bd5865f85fffa00b025d310fe (diff) |
Made the Python being generated more compatible with both P2.7 and P3.
Diffstat (limited to 'stdlib/source/test/lux/type')
-rw-r--r-- | stdlib/source/test/lux/type/dynamic.lux | 54 |
1 files changed, 33 insertions, 21 deletions
diff --git a/stdlib/source/test/lux/type/dynamic.lux b/stdlib/source/test/lux/type/dynamic.lux index fadc98ca7..533b7fad0 100644 --- a/stdlib/source/test/lux/type/dynamic.lux +++ b/stdlib/source/test/lux/type/dynamic.lux @@ -1,35 +1,47 @@ (.module: [lux #* - ["%" data/text/format (#+ format)] - [abstract/monad (#+ do)] ["_" test (#+ Test)] + [abstract + [monad (#+ do)]] [control - ["." try]] + ["." try] + ["." exception]] + [data + ["." text ("#\." equivalence) + ["%" format (#+ format)]]] [math ["." random (#+ Random)] [number ["n" nat]]]] {1 - ["." / (#+ Dynamic :dynamic :check)]}) + ["." /]}) (def: #export test Test - (<| (_.context (%.name (name_of /._))) + (<| (_.covering /._) + (_.for [/.Dynamic]) (do random.monad - [expected random.nat - #let [value (:dynamic expected)]] + [expected random.nat] ($_ _.and - (_.test "Can check dynamic values." - (case (:check Nat value) - (#try.Success actual) - (n.= expected actual) - - (#try.Failure _) - false)) - (_.test "Cannot confuse types." - (case (:check Text value) - (#try.Success actual) - false - - (#try.Failure _) - true)))))) + (_.cover [/.:dynamic /.:check] + (case (/.:check Nat (/.:dynamic expected)) + (#try.Success actual) + (n.= expected actual) + + (#try.Failure _) + false)) + (_.cover [/.wrong_type] + (case (/.:check Text (/.:dynamic expected)) + (#try.Success actual) + false + + (#try.Failure error) + (exception.match? /.wrong_type error))) + (_.cover [/.print] + (case (/.print (/.:dynamic expected)) + (#try.Success actual) + (text\= (%.nat expected) actual) + + (#try.Failure _) + false)) + )))) |