From db697bb636e2341d26bb188cc1b9981a1ab505d7 Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Sun, 7 May 2017 14:30:48 -0400 Subject: - Changed the name of "let%" to "with-expansions". --- stdlib/test/test/lux/control/effect.lux | 25 +++++------ stdlib/test/test/lux/host.jvm.lux | 27 ++++++------ stdlib/test/test/lux/macro/ast.lux | 37 ++++++++-------- stdlib/test/test/lux/macro/syntax.lux | 76 +++++++++++++++++---------------- stdlib/test/test/lux/type.lux | 40 ++++++++--------- 5 files changed, 106 insertions(+), 99 deletions(-) (limited to 'stdlib/test') diff --git a/stdlib/test/test/lux/control/effect.lux b/stdlib/test/test/lux/control/effect.lux index 39e5afa5d..abbdca56a 100644 --- a/stdlib/test/test/lux/control/effect.lux +++ b/stdlib/test/test/lux/control/effect.lux @@ -46,19 +46,20 @@ ## [Tests] (test: "Algebraic effects" - (let% [ (do-template [ ] - [(io;run (with-handler Handler - (doE Functor - [] - (lift ( "YOLO"))))) - (n.= (io;run (with-handler Handler - (doE Functor - [] - (lift )))))] + (with-expansions + [ (do-template [ ] + [(io;run (with-handler Handler + (doE Functor + [] + (lift ( "YOLO"))))) + (n.= (io;run (with-handler Handler + (doE Functor + [] + (lift )))))] - [opA +10 fieldA +10] - [opB +4 fieldB +20] - [opC +2 fieldC +30])] + [opA +10 fieldA +10] + [opB +4 fieldB +20] + [opC +2 fieldC +30])] (assert "Can handle effects using handlers." (and diff --git a/stdlib/test/test/lux/host.jvm.lux b/stdlib/test/test/lux/host.jvm.lux index 93fe5b5e6..ae12784af 100644 --- a/stdlib/test/test/lux/host.jvm.lux +++ b/stdlib/test/test/lux/host.jvm.lux @@ -54,19 +54,20 @@ (test: "Conversions" [sample R;int] - (let% [ (do-template [ ] - [(assert - (or (|> sample (i.= sample)) - (let [capped-sample (|> sample )] - (|> capped-sample (i.= capped-sample)))))] - - [&;l2b &;b2l "Can succesfully convert to/from byte."] - [&;l2s &;s2l "Can succesfully convert to/from short."] - [&;l2i &;i2l "Can succesfully convert to/from int."] - [&;l2f &;f2l "Can succesfully convert to/from float."] - [&;l2d &;d2l "Can succesfully convert to/from double."] - [(<| &;i2c &;l2i) (<| &;i2l &;c2i) "Can succesfully convert to/from char."] - )] + (with-expansions + [ (do-template [ ] + [(assert + (or (|> sample (i.= sample)) + (let [capped-sample (|> sample )] + (|> capped-sample (i.= capped-sample)))))] + + [&;l2b &;b2l "Can succesfully convert to/from byte."] + [&;l2s &;s2l "Can succesfully convert to/from short."] + [&;l2i &;i2l "Can succesfully convert to/from int."] + [&;l2f &;f2l "Can succesfully convert to/from float."] + [&;l2d &;d2l "Can succesfully convert to/from double."] + [(<| &;i2c &;l2i) (<| &;i2l &;c2i) "Can succesfully convert to/from char."] + )] ($_ seq ))) diff --git a/stdlib/test/test/lux/macro/ast.lux b/stdlib/test/test/lux/macro/ast.lux index 95ac999a0..8670ead71 100644 --- a/stdlib/test/test/lux/macro/ast.lux +++ b/stdlib/test/test/lux/macro/ast.lux @@ -10,23 +10,24 @@ lux/test) (test: "AST" - (let% [ (do-template [ ] - [(assert (format "Can produce AST node: " ) - (and (T/= (&;to-text )) - (:: &;Eq = )))] + (with-expansions + [ (do-template [ ] + [(assert (format "Can produce AST node: " ) + (and (T/= (&;to-text )) + (:: &;Eq = )))] - [(&;bool true) "true"] - [(&;bool false) "false"] - [(&;int 123) "123"] - [(&;real 123.0) "123.0"] - [(&;char #"\n") "#\"\\n\""] - [(&;text "\n") "\"\\n\""] - [(&;tag ["yolo" "lol"]) "#yolo;lol"] - [(&;symbol ["yolo" "lol"]) "yolo;lol"] - [(&;form (list (&;bool true) (&;int 123))) "(true 123)"] - [(&;tuple (list (&;bool true) (&;int 123))) "[true 123]"] - [(&;record (list [(&;bool true) (&;int 123)])) "{true 123}"] - [(&;local-tag "lol") "#lol"] - [(&;local-symbol "lol") "lol"] - )] + [(&;bool true) "true"] + [(&;bool false) "false"] + [(&;int 123) "123"] + [(&;real 123.0) "123.0"] + [(&;char #"\n") "#\"\\n\""] + [(&;text "\n") "\"\\n\""] + [(&;tag ["yolo" "lol"]) "#yolo;lol"] + [(&;symbol ["yolo" "lol"]) "yolo;lol"] + [(&;form (list (&;bool true) (&;int 123))) "(true 123)"] + [(&;tuple (list (&;bool true) (&;int 123))) "[true 123]"] + [(&;record (list [(&;bool true) (&;int 123)])) "{true 123}"] + [(&;local-tag "lol") "#lol"] + [(&;local-symbol "lol") "lol"] + )] ($_ seq ))) diff --git a/stdlib/test/test/lux/macro/syntax.lux b/stdlib/test/test/lux/macro/syntax.lux index f523f227c..41c372e15 100644 --- a/stdlib/test/test/lux/macro/syntax.lux +++ b/stdlib/test/test/lux/macro/syntax.lux @@ -63,22 +63,23 @@ ## [Tests] (test: "Simple value syntax." - (let% [ (do-template [ ] - [(assert - (and (is? (list ( ))) - (found? (s;this? ( )) (list ( ))) - (enforced? (s;this! ( )) (list ( )))))] - - ["Can parse Bool syntax." true ast;bool bool;Eq s;bool] - ["Can parse Nat syntax." +123 ast;nat number;Eq s;nat] - ["Can parse Int syntax." 123 ast;int number;Eq s;int] - ["Can parse Deg syntax." .123 ast;deg number;Eq s;deg] - ["Can parse Real syntax." 123.0 ast;real number;Eq s;real] - ["Can parse Char syntax." #"\n" ast;char char;Eq s;char] - ["Can parse Text syntax." "\n" ast;text text;Eq s;text] - ["Can parse Symbol syntax." ["yolo" "lol"] ast;symbol ident;Eq s;symbol] - ["Can parse Tag syntax." ["yolo" "lol"] ast;tag ident;Eq s;tag] - )] + (with-expansions + [ (do-template [ ] + [(assert + (and (is? (list ( ))) + (found? (s;this? ( )) (list ( ))) + (enforced? (s;this! ( )) (list ( )))))] + + ["Can parse Bool syntax." true ast;bool bool;Eq s;bool] + ["Can parse Nat syntax." +123 ast;nat number;Eq s;nat] + ["Can parse Int syntax." 123 ast;int number;Eq s;int] + ["Can parse Deg syntax." .123 ast;deg number;Eq s;deg] + ["Can parse Real syntax." 123.0 ast;real number;Eq s;real] + ["Can parse Char syntax." #"\n" ast;char char;Eq s;char] + ["Can parse Text syntax." "\n" ast;text text;Eq s;text] + ["Can parse Symbol syntax." ["yolo" "lol"] ast;symbol ident;Eq s;symbol] + ["Can parse Tag syntax." ["yolo" "lol"] ast;tag ident;Eq s;tag] + )] ($_ seq @@ -98,27 +99,28 @@ ))) (test: "Complex value syntax." - (let% [ (do-template [ ] - [(assert (format "Can parse " " syntax.") - (and (match [true 123] - (s;run (list ( (list (ast;bool true) (ast;int 123)))) - ( (s;seq s;bool s;int)))) - (match true - (s;run (list ( (list (ast;bool true)))) - ( s;bool))) - (fails? (s;run (list ( (list (ast;bool true) (ast;int 123)))) - ( s;bool))) - (match (#;Left true) - (s;run (list ( (list (ast;bool true)))) - ( (s;alt s;bool s;int)))) - (match (#;Right 123) - (s;run (list ( (list (ast;int 123)))) - ( (s;alt s;bool s;int)))) - (fails? (s;run (list ( (list (ast;real 123.0)))) - ( (s;alt s;bool s;int))))))] - - ["form" s;form ast;form] - ["tuple" s;tuple ast;tuple])] + (with-expansions + [ (do-template [ ] + [(assert (format "Can parse " " syntax.") + (and (match [true 123] + (s;run (list ( (list (ast;bool true) (ast;int 123)))) + ( (s;seq s;bool s;int)))) + (match true + (s;run (list ( (list (ast;bool true)))) + ( s;bool))) + (fails? (s;run (list ( (list (ast;bool true) (ast;int 123)))) + ( s;bool))) + (match (#;Left true) + (s;run (list ( (list (ast;bool true)))) + ( (s;alt s;bool s;int)))) + (match (#;Right 123) + (s;run (list ( (list (ast;int 123)))) + ( (s;alt s;bool s;int)))) + (fails? (s;run (list ( (list (ast;real 123.0)))) + ( (s;alt s;bool s;int))))))] + + ["form" s;form ast;form] + ["tuple" s;tuple ast;tuple])] ($_ seq diff --git a/stdlib/test/test/lux/type.lux b/stdlib/test/test/lux/type.lux index 77858e7fa..e0087960f 100644 --- a/stdlib/test/test/lux/type.lux +++ b/stdlib/test/test/lux/type.lux @@ -92,16 +92,17 @@ (seqM @)) #let [(^open "&/") &;Eq (^open "L/") (list;Eq &;Eq)]] - (let% [ (do-template [ ] - [(assert (format "Can build and tear-down " " types.") - (let [flat (|> members )] - (or (L/= members flat) - (and (L/= (list) members) - (L/= (list ) flat)))))] - - ["variant" &;variant &;flatten-variant Void] - ["tuple" &;tuple &;flatten-tuple Unit] - )] + (with-expansions + [ (do-template [ ] + [(assert (format "Can build and tear-down " " types.") + (let [flat (|> members )] + (or (L/= members flat) + (and (L/= (list) members) + (L/= (list ) flat)))))] + + ["variant" &;variant &;flatten-variant Void] + ["tuple" &;tuple &;flatten-tuple Unit] + )] ($_ seq ))) @@ -141,15 +142,16 @@ _ true)))) #let [(^open "&/") &;Eq]] - (let% [ (do-template [ ] - [(assert (format "Can build and tear-down " " types.") - (let [[flat-size flat-body] (|> extra ( size) )] - (and (n.= size flat-size) - (&/= extra flat-body))))] - - ["universally-quantified" &;univq &;flatten-univq] - ["existentially-quantified" &;exq &;flatten-exq] - )] + (with-expansions + [ (do-template [ ] + [(assert (format "Can build and tear-down " " types.") + (let [[flat-size flat-body] (|> extra ( size) )] + (and (n.= size flat-size) + (&/= extra flat-body))))] + + ["universally-quantified" &;univq &;flatten-univq] + ["existentially-quantified" &;exq &;flatten-exq] + )] ($_ seq ))) -- cgit v1.2.3