diff options
Diffstat (limited to 'stdlib/test')
-rw-r--r-- | stdlib/test/test/lux/concurrency/atom.lux | 10 | ||||
-rw-r--r-- | stdlib/test/test/lux/data/coll/dict.lux | 6 | ||||
-rw-r--r-- | stdlib/test/test/lux/host.jvm.lux | 10 | ||||
-rw-r--r-- | stdlib/test/test/lux/lang/syntax.lux | 48 |
4 files changed, 41 insertions, 33 deletions
diff --git a/stdlib/test/test/lux/concurrency/atom.lux b/stdlib/test/test/lux/concurrency/atom.lux index 90c1c07d2..039546436 100644 --- a/stdlib/test/test/lux/concurrency/atom.lux +++ b/stdlib/test/test/lux/concurrency/atom.lux @@ -18,17 +18,17 @@ #let [box (&;atom value)]] ($_ seq (test "Can obtain the value of an atom." - (n.= value (io;run (&;get box)))) + (n.= value (io;run (&;read box)))) (test "Can swap the value of an atom." (and (io;run (&;compare-and-swap value swap-value box)) - (n.= swap-value (io;run (&;get box))))) + (n.= swap-value (io;run (&;read box))))) (test "Can update the value of an atom." (exec (io;run (&;update n.inc box)) - (n.= (n.inc swap-value) (io;run (&;get box))))) + (n.= (n.inc swap-value) (io;run (&;read box))))) (test "Can immediately set the value of an atom." - (exec (io;run (&;set set-value box)) - (n.= set-value (io;run (&;get box))))) + (exec (io;run (&;write set-value box)) + (n.= set-value (io;run (&;read box))))) )))) diff --git a/stdlib/test/test/lux/data/coll/dict.lux b/stdlib/test/test/lux/data/coll/dict.lux index f2e47615a..536ad8450 100644 --- a/stdlib/test/test/lux/data/coll/dict.lux +++ b/stdlib/test/test/lux/data/coll/dict.lux @@ -8,7 +8,7 @@ [number] [maybe] (coll ["&" dict] - [list "L/" Fold<List> Functor<List>])) + [list "list/" Fold<List> Functor<List>])) ["r" math/random]) lux/test) @@ -30,7 +30,7 @@ (not (&;empty? dict)))) (test "The functions 'entries', 'keys' and 'values' should be synchronized." - (:: (list;Eq<List> (eq;seq number;Eq<Nat> number;Eq<Nat>)) = + (:: (list;Eq<List> (eq;pair number;Eq<Nat> number;Eq<Nat>)) = (&;entries dict) (list;zip2 (&;keys dict) (&;values dict)))) @@ -99,7 +99,7 @@ (test "If you merge, and the second dict has overlapping keys, it should overwrite yours." (let [dict' (|> dict &;entries - (L/map (function [[k v]] [k (n.inc v)])) + (list/map (function [[k v]] [k (n.inc v)])) (&;from-list number;Hash<Nat>)) (^open) (&;Eq<Dict> number;Eq<Nat>)] (= dict' (&;merge dict' dict)))) diff --git a/stdlib/test/test/lux/host.jvm.lux b/stdlib/test/test/lux/host.jvm.lux index d41c587c8..070457799 100644 --- a/stdlib/test/test/lux/host.jvm.lux +++ b/stdlib/test/test/lux/host.jvm.lux @@ -11,6 +11,8 @@ ["r" math/random]) lux/test) +(&;import (java.util.concurrent.Callable a)) + (&;import java.lang.Exception (new [String])) @@ -44,11 +46,17 @@ ) (def: test-runnable - (object [Runnable] + (object [] [Runnable] [] (Runnable [] (run) void []))) +(def: test-callable + (object [a] [(Callable a)] + [] + (Callable [] (call) a + (undefined)))) + (interface: TestInterface ([] foo [boolean String] void #throws [Exception])) diff --git a/stdlib/test/test/lux/lang/syntax.lux b/stdlib/test/test/lux/lang/syntax.lux index 154e18a91..3eb9bfc02 100644 --- a/stdlib/test/test/lux/lang/syntax.lux +++ b/stdlib/test/test/lux/lang/syntax.lux @@ -80,20 +80,20 @@ other code^] ($_ seq (test "Can parse Lux code." - (case (&;parse "" [default-cursor +0 (code;to-text sample)]) + (case (&;read "" [default-cursor +0 (code;to-text sample)]) (#e;Error error) false (#e;Success [_ parsed]) (:: code;Eq<Code> = parsed sample))) (test "Can parse Lux multiple code nodes." - (case (&;parse "" [default-cursor +0 (format (code;to-text sample) " " - (code;to-text other))]) + (case (&;read "" [default-cursor +0 (format (code;to-text sample) " " + (code;to-text other))]) (#e;Error error) false (#e;Success [remaining =sample]) - (case (&;parse "" remaining) + (case (&;read "" remaining) (#e;Error error) false @@ -114,11 +114,11 @@ signed? r;bool #let [expected (|> numerator (f./ denominator) (f.* (if signed? -1.0 1.0)))]] (test "Can parse frac ratio syntax." - (case (&;parse "" [default-cursor +0 - (format (if signed? "-" "") - (%i (frac-to-int numerator)) - "/" - (%i (frac-to-int denominator)))]) + (case (&;read "" [default-cursor +0 + (format (if signed? "-" "") + (%i (frac-to-int numerator)) + "/" + (%i (frac-to-int denominator)))]) (#e;Success [_ [_ (#;Frac actual)]]) (f.= expected actual) @@ -131,8 +131,8 @@ (do @ [expected (|> r;nat (:: @ map (n.% +1_000)))] (test "Can parse nat char syntax." - (case (&;parse "" [default-cursor +0 - (format "#" (%t (text;from-code expected)) "")]) + (case (&;read "" [default-cursor +0 + (format "#" (%t (text;from-code expected)) "")]) (#e;Success [_ [_ (#;Nat actual)]]) (n.= expected actual) @@ -181,8 +181,8 @@ (let [bad-match (format (text;from-code x) "\n" (text;from-code y) "\n" (text;from-code z))] - (case (&;parse "" [default-cursor +0 - (format "\"" bad-match "\"")]) + (case (&;read "" [default-cursor +0 + (format "\"" bad-match "\"")]) (#e;Error error) true @@ -195,9 +195,9 @@ good-output (format (text;from-code x) "\n" (text;from-code y) "\n" (text;from-code z))] - (case (&;parse "" [(|> default-cursor (update@ #;column (n.+ (n.dec offset-size)))) - +0 - (format "\"" good-input "\"")]) + (case (&;read "" [(|> default-cursor (update@ #;column (n.+ (n.dec offset-size)))) + +0 + (format "\"" good-input "\"")]) (#e;Error error) false @@ -206,25 +206,25 @@ parsed (code;text good-output))))) (test "Can handle comments." - (case (&;parse "" [default-cursor +0 - (format comment (code;to-text sample))]) + (case (&;read "" [default-cursor +0 + (format comment (code;to-text sample))]) (#e;Error error) false (#e;Success [_ parsed]) (:: code;Eq<Code> = parsed sample))) (test "Will reject unbalanced multi-line comments." - (and (case (&;parse "" [default-cursor +0 - (format "#(" "#(" unbalanced-comment ")#" - (code;to-text sample))]) + (and (case (&;read "" [default-cursor +0 + (format "#(" "#(" unbalanced-comment ")#" + (code;to-text sample))]) (#e;Error error) true (#e;Success [_ parsed]) false) - (case (&;parse "" [default-cursor +0 - (format "#(" unbalanced-comment ")#" ")#" - (code;to-text sample))]) + (case (&;read "" [default-cursor +0 + (format "#(" unbalanced-comment ")#" ")#" + (code;to-text sample))]) (#e;Error error) true |