diff options
author | Eduardo Julian | 2019-01-24 00:16:16 -0400 |
---|---|---|
committer | Eduardo Julian | 2019-01-24 00:16:16 -0400 |
commit | 94f60efe5745accce36c5d6824c71f00a12dd384 (patch) | |
tree | b98a628314830a765b9d791e86a7da4fb81209d3 /stdlib/test | |
parent | e115f5f07f5b663b9f533049991a9ab834b44f5e (diff) |
Added dynamic typing.
Diffstat (limited to 'stdlib/test')
-rw-r--r-- | stdlib/test/test/lux/type/dynamic.lux | 31 | ||||
-rw-r--r-- | stdlib/test/tests.lux | 144 |
2 files changed, 103 insertions, 72 deletions
diff --git a/stdlib/test/test/lux/type/dynamic.lux b/stdlib/test/test/lux/type/dynamic.lux new file mode 100644 index 000000000..70e26f743 --- /dev/null +++ b/stdlib/test/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))))) diff --git a/stdlib/test/tests.lux b/stdlib/test/tests.lux index fa5eb2f67..a5c6919c5 100644 --- a/stdlib/test/tests.lux +++ b/stdlib/test/tests.lux @@ -81,94 +81,94 @@ ] ## TODO: Must have 100% coverage on tests. [test - ## ["_." lux] + ## [lux (#+)] [lux - ## ["_." cli] - ## ["_." host] + ## [cli (#+)] + ## [host (#+)] [host [jvm (#+)]] - ## ["_." io] + ## [io (#+)] ## [time - ## ["_." instant] - ## ["_." duration] - ## ["_." date]] + ## [instant (#+)] + ## [duration (#+)] + ## [date (#+)]] ## [control - ## ## ["_." exception] - ## ## ["_." interval] - ## ## ["_." pipe] - ## ## ["_." continuation] - ## ## ["_." reader] - ## ## ["_." writer] - ## ## ["_." state] - ## ## ["_." parser] - ## ## ["_." thread] - ## ## ["_." region] + ## ## [exception (#+)] + ## ## [interval (#+)] + ## ## [pipe (#+)] + ## ## [continuation (#+)] + ## ## [reader (#+)] + ## ## [writer (#+)] + ## ## [state (#+)] + ## ## [parser (#+)] + ## ## [thread (#+)] + ## ## [region (#+)] ## ## [security - ## ## ["_." privacy] - ## ## ["._" integrity]] + ## ## [privacy (#+)] + ## ## [integrity (#+)]] ## [concurrency - ## ["_." actor] - ## ["_." atom] - ## ["_." frp] - ## ["_." promise] - ## ["_." stm] - ## ## ["_." semaphore] + ## [actor (#+)] + ## [atom (#+)] + ## [frp (#+)] + ## [promise (#+)] + ## [stm (#+)] + ## ## [semaphore (#+)] ## ]] ## [data - ## ["_." bit] - ## ["_." color] - ## ["_." error] - ## ["_." name] - ## ["_." identity] - ## ["_." lazy] - ## ["_." maybe] - ## ["_." product] - ## ["_." sum] - ## [number - ## ## "_." number ## TODO: FIX Specially troublesome... - ## ["_." i64] - ## ["_." ratio] - ## ["_." complex]] - ## ["_." text - ## ## ["_." format] - ## ["_." lexer] - ## ["_." regex]] + ## [bit (#+)] + ## [color (#+)] + ## [error (#+)] + ## [name (#+)] + ## [identity (#+)] + ## [lazy (#+)] + ## [maybe (#+)] + ## [product (#+)] + ## [sum (#+)] + ## [number (#+) ## TODO: FIX Specially troublesome... + ## [i64 (#+)] + ## [ratio (#+)] + ## [complex (#+)]] + ## [text (#+) + ## ## [format (#+)] + ## [lexer (#+)] + ## [regex (#+)]] ## [format - ## ## ["_." json] - ## ["_." xml]] + ## ## [json (#+)] + ## [xml (#+)]] ## ## [collection - ## ## ["_." array] - ## ## ["_." bits] - ## ## ["_." list] - ## ## ["_." stack] - ## ## ["_." row] - ## ## ["_." sequence] - ## ## ["_." dictionary + ## ## [array (#+)] + ## ## [bits (#+)] + ## ## [list (#+)] + ## ## [stack (#+)] + ## ## [row (#+)] + ## ## [sequence (#+)] + ## ## [dictionary (#+) ## ## ["dictionary_." ordered]] - ## ## ["_." set + ## ## [set (#+) ## ## ["set_." ordered]] - ## ## ["_." queue - ## ## ["_." priority]] + ## ## [queue (#+) + ## ## [priority (#+)]] ## ## [tree - ## ## ["_." rose - ## ## ["_." zipper]]]] + ## ## [rose (#+) + ## ## [zipper (#+)]]]] ## ] - ## ["_." math - ## ["_." random] - ## ["_." modular] + ## [math (#+) + ## [random (#+)] + ## [modular (#+)] ## [logic - ## ["_." continuous] - ## ["_." fuzzy]]] + ## [continuous (#+)] + ## [fuzzy (#+)]]] ## [macro - ## ["_." code] - ## ["_." syntax] + ## [code (#+)] + ## [syntax (#+)] ## [poly ## ["poly_." equivalence] ## ["poly_." functor]]] - ## ["_." type - ## ["_." check] - ## ## ["_." implicit] ## TODO: FIX Specially troublesome... - ## ["_." resource]] + [type ## (#+) + ## [check (#+)] + ## [implicit (#+)] ## TODO: FIX Specially troublesome... + ## [resource (#+)] + [dynamic (#+)]] ## [compiler ## [default ## ["_default/." syntax] @@ -187,11 +187,11 @@ ## ["_.S" case] ## ["_.S" function]]]]] ## [world - ## ["_." binary] - ## ["_." file] + ## [binary (#+)] + ## [file (#+)] ## [net - ## ["_." tcp] - ## ["_." udp]]] + ## [tcp (#+)] + ## [udp (#+)]]] ]] ) |