aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/test/lux.lux
diff options
context:
space:
mode:
Diffstat (limited to 'stdlib/source/test/lux.lux')
-rw-r--r--stdlib/source/test/lux.lux163
1 files changed, 83 insertions, 80 deletions
diff --git a/stdlib/source/test/lux.lux b/stdlib/source/test/lux.lux
index d83a447f5..056d93079 100644
--- a/stdlib/source/test/lux.lux
+++ b/stdlib/source/test/lux.lux
@@ -25,7 +25,7 @@
[dictionary
["[0]" plist]]]]
["[0]" macro (.only)
- [syntax (.only syntax:)]
+ [syntax (.only syntax)]
["^" pattern]
["[0]" code (.open: "[1]#[0]" equivalence)]
["[0]" template]]
@@ -1055,26 +1055,28 @@
@.python
@.ruby)))
-(syntax: (for_meta|Info [])
- (function (_ lux)
- (let [info (the .#info lux)
-
- conforming_target!
- (set.member? ..possible_targets (the .#target info))
-
- compiling!
- (case (the .#mode info)
- {.#Build} true
- _ false)]
- {.#Right [lux (list (code.bit (and conforming_target!
- compiling!)))]})))
-
-(syntax: (for_meta|Module_State [])
- (do meta.monad
- [prelude_module (meta.module .prelude_module)]
- (in (list (code.bit (case (the .#module_state prelude_module)
- {.#Active} false
- _ true))))))
+(def: for_meta|Info
+ (syntax (_ [])
+ (function (_ lux)
+ (let [info (the .#info lux)
+
+ conforming_target!
+ (set.member? ..possible_targets (the .#target info))
+
+ compiling!
+ (case (the .#mode info)
+ {.#Build} true
+ _ false)]
+ {.#Right [lux (list (code.bit (and conforming_target!
+ compiling!)))]}))))
+
+(def: for_meta|Module_State
+ (syntax (_ [])
+ (do meta.monad
+ [prelude_module (meta.module .prelude_module)]
+ (in (list (code.bit (case (the .#module_state prelude_module)
+ {.#Active} false
+ _ true)))))))
(def: for_meta
Test
@@ -1096,65 +1098,66 @@
))
(for @.old (these)
- (these (syntax: (for_bindings|test lux_state
- [fn/0 <code>.local
- var/0 <code>.local
- let/0 <code>.local
-
- fn/1 <code>.local
- var/1 <code>.local
- let/1 <code>.local
-
- fn/2 <code>.local
- var/2 <code>.local
- let/2 <code>.local
-
- let/3 <code>.local])
- (in (list (code.bit (case (the .#scopes lux_state)
- (pattern (partial_list scope/2 _))
- (let [locals/2 (the .#locals scope/2)
- expected_locals/2 (set.of_list text.hash (list fn/2 var/2 let/2
- let/3))
- actual_locals/2 (|> locals/2
- (the .#mappings)
- (list#each product.left)
- (set.of_list text.hash))
-
- correct_locals!
- (and (n.= 4 (the .#counter locals/2))
- (set#= expected_locals/2
- actual_locals/2))
-
- captured/2 (the .#captured scope/2)
-
- local? (is (-> Ref Bit)
- (function (_ ref)
- (case ref
- {.#Local _} true
- {.#Captured _} false)))
- captured? (is (-> Ref Bit)
- (|>> local? not))
- binding? (is (-> (-> Ref Bit) Text Bit)
- (function (_ is? name)
- (|> captured/2
- (the .#mappings)
- (plist.value name)
- (maybe#each (|>> product.right is?))
- (maybe.else false))))
-
- correct_closure!
- (and (n.= 6 (the .#counter captured/2))
- (binding? local? fn/1)
- (binding? local? var/1)
- (binding? local? let/1)
- (binding? captured? fn/0)
- (binding? captured? var/0)
- (binding? captured? let/0))]
- (and correct_locals!
- correct_closure!))
-
- _
- false)))))
+ (these (def: for_bindings|test
+ (syntax (_ lux_state
+ [fn/0 <code>.local
+ var/0 <code>.local
+ let/0 <code>.local
+
+ fn/1 <code>.local
+ var/1 <code>.local
+ let/1 <code>.local
+
+ fn/2 <code>.local
+ var/2 <code>.local
+ let/2 <code>.local
+
+ let/3 <code>.local])
+ (in (list (code.bit (case (the .#scopes lux_state)
+ (pattern (partial_list scope/2 _))
+ (let [locals/2 (the .#locals scope/2)
+ expected_locals/2 (set.of_list text.hash (list fn/2 var/2 let/2
+ let/3))
+ actual_locals/2 (|> locals/2
+ (the .#mappings)
+ (list#each product.left)
+ (set.of_list text.hash))
+
+ correct_locals!
+ (and (n.= 4 (the .#counter locals/2))
+ (set#= expected_locals/2
+ actual_locals/2))
+
+ captured/2 (the .#captured scope/2)
+
+ local? (is (-> Ref Bit)
+ (function (_ ref)
+ (case ref
+ {.#Local _} true
+ {.#Captured _} false)))
+ captured? (is (-> Ref Bit)
+ (|>> local? not))
+ binding? (is (-> (-> Ref Bit) Text Bit)
+ (function (_ is? name)
+ (|> captured/2
+ (the .#mappings)
+ (plist.value name)
+ (maybe#each (|>> product.right is?))
+ (maybe.else false))))
+
+ correct_closure!
+ (and (n.= 6 (the .#counter captured/2))
+ (binding? local? fn/1)
+ (binding? local? var/1)
+ (binding? local? let/1)
+ (binding? captured? fn/0)
+ (binding? captured? var/0)
+ (binding? captured? let/0))]
+ (and correct_locals!
+ correct_closure!))
+
+ _
+ false))))))
(def: for_bindings
Test