aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/test
diff options
context:
space:
mode:
Diffstat (limited to 'stdlib/source/test')
-rw-r--r--stdlib/source/test/lux.lux163
-rw-r--r--stdlib/source/test/lux/control/parser.lux19
-rw-r--r--stdlib/source/test/lux/control/remember.lux79
-rw-r--r--stdlib/source/test/lux/data/format/json.lux29
-rw-r--r--stdlib/source/test/lux/data/text/escape.lux22
-rw-r--r--stdlib/source/test/lux/data/text/regex.lux40
-rw-r--r--stdlib/source/test/lux/debug.lux19
-rw-r--r--stdlib/source/test/lux/documentation.lux28
-rw-r--r--stdlib/source/test/lux/ffi.jvm.lux52
-rw-r--r--stdlib/source/test/lux/ffi/export.js.lux4
-rw-r--r--stdlib/source/test/lux/ffi/export.jvm.lux6
-rw-r--r--stdlib/source/test/lux/ffi/export.lua.lux4
-rw-r--r--stdlib/source/test/lux/ffi/export.py.lux4
-rw-r--r--stdlib/source/test/lux/ffi/export.rb.lux4
-rw-r--r--stdlib/source/test/lux/macro.lux39
-rw-r--r--stdlib/source/test/lux/macro/local.lux62
-rw-r--r--stdlib/source/test/lux/macro/syntax.lux11
-rw-r--r--stdlib/source/test/lux/macro/template.lux19
-rw-r--r--stdlib/source/test/lux/math/modulus.lux15
-rw-r--r--stdlib/source/test/lux/meta/configuration.lux19
-rw-r--r--stdlib/source/test/lux/meta/version.lux19
-rw-r--r--stdlib/source/test/lux/program.lux11
-rw-r--r--stdlib/source/test/lux/type/primitive.lux30
-rw-r--r--stdlib/source/test/lux/type/resource.lux27
-rw-r--r--stdlib/source/test/lux/type/unit.lux11
25 files changed, 385 insertions, 351 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
diff --git a/stdlib/source/test/lux/control/parser.lux b/stdlib/source/test/lux/control/parser.lux
index c0f1d05f6..656c8b988 100644
--- a/stdlib/source/test/lux/control/parser.lux
+++ b/stdlib/source/test/lux/control/parser.lux
@@ -23,7 +23,7 @@
[number
["n" nat]]]
[macro
- [syntax (.only syntax:)]
+ [syntax (.only syntax)]
["[0]" code]]]]
[\\library
["[0]" / (.only Parser)]]
@@ -76,15 +76,16 @@
_
#0))
-(syntax: (match [pattern <code>.any
- then <code>.any
- input <code>.any])
- (in (list (` (case (~ input)
- (pattern {try.#Success [(~' _) (~ pattern)]})
- (~ then)
+(def: match
+ (syntax (_ [pattern <code>.any
+ then <code>.any
+ input <code>.any])
+ (in (list (` (case (~ input)
+ (pattern {try.#Success [(~' _) (~ pattern)]})
+ (~ then)
- (~' _)
- #0)))))
+ (~' _)
+ #0))))))
(def: combinators_0
Test
diff --git a/stdlib/source/test/lux/control/remember.lux b/stdlib/source/test/lux/control/remember.lux
index 38bd18517..090810aab 100644
--- a/stdlib/source/test/lux/control/remember.lux
+++ b/stdlib/source/test/lux/control/remember.lux
@@ -24,7 +24,7 @@
["[0]" duration]]
["[0]" macro (.only)
["[0]" code]
- ["[0]" syntax (.only syntax:)]]]]
+ ["[0]" syntax (.only syntax)]]]]
[\\library
["[0]" /]])
@@ -62,48 +62,49 @@
{.#Some focus}
(text.contains? (%.code focus) failure))))
-(syntax: (test_macro [macro <code>.symbol
- extra <code>.text])
- (let [now (io.run! instant.now)
- today (instant.date now)
- yesterday (instant.date (instant.after (duration.inverse duration.week) now))
- tomorrow (instant.date (instant.after duration.week now))
- prng (random.pcg_32 [(hex "0123456789ABCDEF")
- (instant.millis now)])
- message (product.right (random.result prng ..message))
- expected (product.right (random.result prng ..focus))]
- (do meta.monad
- [should_fail0 (..attempt (macro.expansion (..memory macro yesterday message {.#None})))
- should_fail1 (..attempt (macro.expansion (..memory macro yesterday message {.#Some expected})))
- should_succeed0 (..attempt (macro.expansion (..memory macro tomorrow message {.#None})))
- should_succeed1 (..attempt (macro.expansion (..memory macro tomorrow message {.#Some expected})))]
- (in (list (code.bit (and (case should_fail0
- {try.#Failure error}
- (and (test_failure yesterday message {.#None} error)
- (text.contains? extra error))
+(def: test_macro
+ (syntax (_ [macro <code>.symbol
+ extra <code>.text])
+ (let [now (io.run! instant.now)
+ today (instant.date now)
+ yesterday (instant.date (instant.after (duration.inverse duration.week) now))
+ tomorrow (instant.date (instant.after duration.week now))
+ prng (random.pcg_32 [(hex "0123456789ABCDEF")
+ (instant.millis now)])
+ message (product.right (random.result prng ..message))
+ expected (product.right (random.result prng ..focus))]
+ (do meta.monad
+ [should_fail0 (..attempt (macro.expansion (..memory macro yesterday message {.#None})))
+ should_fail1 (..attempt (macro.expansion (..memory macro yesterday message {.#Some expected})))
+ should_succeed0 (..attempt (macro.expansion (..memory macro tomorrow message {.#None})))
+ should_succeed1 (..attempt (macro.expansion (..memory macro tomorrow message {.#Some expected})))]
+ (in (list (code.bit (and (case should_fail0
+ {try.#Failure error}
+ (and (test_failure yesterday message {.#None} error)
+ (text.contains? extra error))
- _
- false)
- (case should_fail1
- {try.#Failure error}
- (and (test_failure yesterday message {.#Some expected} error)
- (text.contains? extra error))
+ _
+ false)
+ (case should_fail1
+ {try.#Failure error}
+ (and (test_failure yesterday message {.#Some expected} error)
+ (text.contains? extra error))
- _
- false)
- (case should_succeed0
- (pattern {try.#Success (list)})
- true
+ _
+ false)
+ (case should_succeed0
+ (pattern {try.#Success (list)})
+ true
- _
- false)
- (case should_succeed1
- (pattern {try.#Success (list actual)})
- (same? expected actual)
+ _
+ false)
+ (case should_succeed1
+ (pattern {try.#Success (list actual)})
+ (same? expected actual)
- _
- false)
- )))))))
+ _
+ false)
+ ))))))))
(def: .public test
Test
diff --git a/stdlib/source/test/lux/data/format/json.lux b/stdlib/source/test/lux/data/format/json.lux
index c0d9f7537..a4874021b 100644
--- a/stdlib/source/test/lux/data/format/json.lux
+++ b/stdlib/source/test/lux/data/format/json.lux
@@ -26,7 +26,7 @@
["n" nat]
["[0]" frac]]]
["[0]" macro (.only)
- ["[0]" syntax (.only syntax:)]
+ ["[0]" syntax (.only syntax)]
["[0]" code]]]]
[\\library
["[0]" / (.only JSON) (.open: "[1]#[0]" equivalence)]])
@@ -46,20 +46,23 @@
(random.dictionary text.hash size (random.unicode size) again)
)))))
-(syntax: (boolean [])
- (do meta.monad
- [value meta.seed]
- (in (list (code.bit (n.even? value))))))
+(def: boolean
+ (syntax (_ [])
+ (do meta.monad
+ [value meta.seed]
+ (in (list (code.bit (n.even? value)))))))
-(syntax: (number [])
- (do meta.monad
- [value meta.seed]
- (in (list (code.frac (n.frac value))))))
+(def: number
+ (syntax (_ [])
+ (do meta.monad
+ [value meta.seed]
+ (in (list (code.frac (n.frac value)))))))
-(syntax: (string [])
- (do meta.monad
- [value (macro.symbol "string")]
- (in (list (code.text (%.code value))))))
+(def: string
+ (syntax (_ [])
+ (do meta.monad
+ [value (macro.symbol "string")]
+ (in (list (code.text (%.code value)))))))
(def: .public test
Test
diff --git a/stdlib/source/test/lux/data/text/escape.lux b/stdlib/source/test/lux/data/text/escape.lux
index d1258bf25..8a897d348 100644
--- a/stdlib/source/test/lux/data/text/escape.lux
+++ b/stdlib/source/test/lux/data/text/escape.lux
@@ -18,7 +18,7 @@
[collection
["[0]" set (.only Set)]]]
[macro
- [syntax (.only syntax:)]
+ [syntax (.only syntax)]
["[0]" code]
["[0]" template]]
[math
@@ -69,16 +69,18 @@
(debug.private /.\\_sigil)
(debug.private /.\u_sigil))))
-(syntax: (static_sample [])
- (do meta.monad
- [seed meta.seed
- .let [[_ expected] (|> (random.ascii 10)
- (random.only (|>> (text.contains? text.\0) not))
- (random.result (random.pcg_32 [seed seed])))]]
- (in (list (code.text expected)))))
+(def: static_sample
+ (syntax (_ [])
+ (do meta.monad
+ [seed meta.seed
+ .let [[_ expected] (|> (random.ascii 10)
+ (random.only (|>> (text.contains? text.\0) not))
+ (random.result (random.pcg_32 [seed seed])))]]
+ (in (list (code.text expected))))))
-(syntax: (static_escaped [un_escaped <code>.text])
- (in (list (code.text (/.escaped un_escaped)))))
+(def: static_escaped
+ (syntax (_ [un_escaped <code>.text])
+ (in (list (code.text (/.escaped un_escaped))))))
(def: .public test
Test
diff --git a/stdlib/source/test/lux/data/text/regex.lux b/stdlib/source/test/lux/data/text/regex.lux
index c16388e4e..43a34d694 100644
--- a/stdlib/source/test/lux/data/text/regex.lux
+++ b/stdlib/source/test/lux/data/text/regex.lux
@@ -14,7 +14,7 @@
["[0]" text (.open: "[1]#[0]" equivalence)
["%" format (.only format)]]]
["[0]" macro (.only)
- [syntax (.only syntax:)]
+ [syntax (.only syntax)]
["[0]" code]]
[math
[number (.only hex)]
@@ -55,18 +55,19 @@
_
false)))
-(syntax: (should_check [pattern <code>.any
- regex <code>.any
- input <code>.any])
- (macro.with_symbols [g!message g!_]
- (in (list (` (|> (~ input)
- (<text>.result (~ regex))
- (pipe.case
- (pattern {try.#Success (~ pattern)})
- true
+(def: should_check
+ (syntax (_ [pattern <code>.any
+ regex <code>.any
+ input <code>.any])
+ (macro.with_symbols [g!message g!_]
+ (in (list (` (|> (~ input)
+ (<text>.result (~ regex))
+ (pipe.case
+ (pattern {try.#Success (~ pattern)})
+ true
- (~ g!_)
- false)))))))
+ (~ g!_)
+ false))))))))
(def: basics
Test
@@ -276,14 +277,15 @@
"123-456-7890")))
))
-(syntax: (expands? [form <code>.any])
- (function (_ lux)
- {try.#Success [lux (list (code.bit (case (macro.single_expansion form lux)
- {try.#Success _}
- true
+(def: expands?
+ (syntax (_ [form <code>.any])
+ (function (_ lux)
+ {try.#Success [lux (list (code.bit (case (macro.single_expansion form lux)
+ {try.#Success _}
+ true
- {try.#Failure error}
- false)))]}))
+ {try.#Failure error}
+ false)))]})))
(def: .public test
Test
diff --git a/stdlib/source/test/lux/debug.lux b/stdlib/source/test/lux/debug.lux
index 9b61ab55d..bfa275ce7 100644
--- a/stdlib/source/test/lux/debug.lux
+++ b/stdlib/source/test/lux/debug.lux
@@ -19,7 +19,7 @@
[json (.only JSON)]
[xml (.only XML)]]]
["[0]" macro (.only)
- [syntax (.only syntax:)]
+ [syntax (.only syntax)]
["[0]" code]]
[math
["[0]" random (.only Random)]
@@ -216,14 +216,15 @@
(/.inspection [sample_bit sample_int sample_frac sample_text]))
)))))
-(syntax: (macro_error [macro <code>.any])
- (function (_ compiler)
- (case ((macro.expansion macro) compiler)
- {try.#Failure error}
- {try.#Success [compiler (list (code.text error))]}
-
- {try.#Success _}
- {try.#Failure "OOPS!"})))
+(def: macro_error
+ (syntax (_ [macro <code>.any])
+ (function (_ compiler)
+ (case ((macro.expansion macro) compiler)
+ {try.#Failure error}
+ {try.#Success [compiler (list (code.text error))]}
+
+ {try.#Success _}
+ {try.#Failure "OOPS!"}))))
(type: My_Text
Text)
diff --git a/stdlib/source/test/lux/documentation.lux b/stdlib/source/test/lux/documentation.lux
index 92248d84c..3052034b4 100644
--- a/stdlib/source/test/lux/documentation.lux
+++ b/stdlib/source/test/lux/documentation.lux
@@ -14,25 +14,27 @@
[format
["md" markdown]]]
["[0]" macro (.only)
- [syntax (.only syntax:)]
+ [syntax (.only syntax)]
["[0]" template]
["[0]" code]]]]
[\\library
["[0]" /]])
-(syntax: (macro_error [macro <code>.any])
- (function (_ compiler)
- {try.#Success [compiler (list (code.bit (case ((macro.expansion macro) compiler)
- {try.#Failure error}
- true
-
- {try.#Success _}
- false)))]}))
+(def: macro_error
+ (syntax (_ [macro <code>.any])
+ (function (_ compiler)
+ {try.#Success [compiler (list (code.bit (case ((macro.expansion macro) compiler)
+ {try.#Failure error}
+ true
+
+ {try.#Success _}
+ false)))]})))
-(syntax: (description [])
- (at meta.monad each
- (|>> %.nat code.text list)
- meta.seed))
+(def: description
+ (syntax (_ [])
+ (at meta.monad each
+ (|>> %.nat code.text list)
+ meta.seed)))
(template.with_locals [g!default]
(with_expansions ['definition_description' (..description)
diff --git a/stdlib/source/test/lux/ffi.jvm.lux b/stdlib/source/test/lux/ffi.jvm.lux
index 4a25f246e..3a6df69db 100644
--- a/stdlib/source/test/lux/ffi.jvm.lux
+++ b/stdlib/source/test/lux/ffi.jvm.lux
@@ -21,7 +21,7 @@
[collection
["[0]" array (.only Array)]]]
["[0]" macro (.only)
- [syntax (.only syntax:)]
+ [syntax (.only syntax)]
["[0]" code]
["[0]" template]]
[math
@@ -71,16 +71,17 @@
[character#= /.Character /.char_to_long Int i#=]
)
-(syntax: (macro_error [expression <code>.any])
- (function (_ lux)
- (|> (macro.single_expansion expression)
- (meta.result lux)
- (pipe.case
- {try.#Success expansion}
- {try.#Failure "OOPS!"}
-
- {try.#Failure error}
- {try.#Success [lux (list (code.text error))]}))))
+(def: macro_error
+ (syntax (_ [expression <code>.any])
+ (function (_ lux)
+ (|> (macro.single_expansion expression)
+ (meta.result lux)
+ (pipe.case
+ {try.#Success expansion}
+ {try.#Failure "OOPS!"}
+
+ {try.#Failure error}
+ {try.#Success [lux (list (code.text error))]})))))
(def: for_conversions
Test
@@ -614,20 +615,21 @@
example/9!)
)))
-(syntax: (expands? [expression <code>.any])
- (function (_ lux)
- (|> (macro.single_expansion expression)
- (meta.result lux)
- (pipe.case
- {try.#Success expansion}
- true
-
- {try.#Failure error}
- false)
- code.bit
- list
- [lux]
- {try.#Success})))
+(def: expands?
+ (syntax (_ [expression <code>.any])
+ (function (_ lux)
+ (|> (macro.single_expansion expression)
+ (meta.result lux)
+ (pipe.case
+ {try.#Success expansion}
+ true
+
+ {try.#Failure error}
+ false)
+ code.bit
+ list
+ [lux]
+ {try.#Success}))))
(def: for_exception
Test
diff --git a/stdlib/source/test/lux/ffi/export.js.lux b/stdlib/source/test/lux/ffi/export.js.lux
index 913fe5d5e..37402fc3b 100644
--- a/stdlib/source/test/lux/ffi/export.js.lux
+++ b/stdlib/source/test/lux/ffi/export.js.lux
@@ -11,7 +11,7 @@
["/[1]" //]]])
(with_expansions [<nat> (static.random_nat)]
- (/.export:
+ (/.export
(def: constant
Nat
<nat>)
@@ -26,7 +26,7 @@
Test
(<| (_.covering /._)
(all _.and
- (_.coverage [/.export:]
+ (_.coverage [/.export]
(and (n.= <nat> ..constant)
(n.= (n.+ <nat> <nat>) (..shift <nat>))))
)))
diff --git a/stdlib/source/test/lux/ffi/export.jvm.lux b/stdlib/source/test/lux/ffi/export.jvm.lux
index 805e01c28..3ad692d50 100644
--- a/stdlib/source/test/lux/ffi/export.jvm.lux
+++ b/stdlib/source/test/lux/ffi/export.jvm.lux
@@ -34,7 +34,7 @@
(def: expected_double (//.as_double (static.random_frac)))
(def: expected_string (//.as_string (static.random code.text (random.lower_case 2))))
-(`` (`` (/.export: Primitives
+(`` (`` (/.export Primitives
... Constants
(actual_boolean boolean ..expected_boolean)
(actual_byte byte ..expected_byte)
@@ -91,7 +91,7 @@
))
)))
-(/.export: Objects
+(/.export Objects
(actual_string java/lang/String ..expected_string)
((string_method [left java/lang/String right java/lang/String])
@@ -141,7 +141,7 @@
[string //.as_string (random.lower_case 1)]
))]
(all _.and
- (_.coverage [/.export:]
+ (_.coverage [/.export]
(and (bit#= (//.of_boolean ..expected_boolean) (//.of_boolean (Primitives::actual_boolean)))
(int#= (//.of_byte ..expected_byte) (//.of_byte (Primitives::actual_byte)))
(int#= (//.of_short ..expected_short) (//.of_short (Primitives::actual_short)))
diff --git a/stdlib/source/test/lux/ffi/export.lua.lux b/stdlib/source/test/lux/ffi/export.lua.lux
index d253d7329..f3c9b90ea 100644
--- a/stdlib/source/test/lux/ffi/export.lua.lux
+++ b/stdlib/source/test/lux/ffi/export.lua.lux
@@ -11,7 +11,7 @@
["/[1]" //]]])
(with_expansions [<nat> (static.random_nat)]
- (/.export:
+ (/.export
(def: constant
Nat
<nat>)
@@ -26,7 +26,7 @@
Test
(<| (_.covering /._)
(all _.and
- (_.coverage [/.export:]
+ (_.coverage [/.export]
(and (n.= <nat> (..constant))
(n.= (n.+ <nat> <nat>) ((..shift) <nat>))))
)))
diff --git a/stdlib/source/test/lux/ffi/export.py.lux b/stdlib/source/test/lux/ffi/export.py.lux
index 913fe5d5e..37402fc3b 100644
--- a/stdlib/source/test/lux/ffi/export.py.lux
+++ b/stdlib/source/test/lux/ffi/export.py.lux
@@ -11,7 +11,7 @@
["/[1]" //]]])
(with_expansions [<nat> (static.random_nat)]
- (/.export:
+ (/.export
(def: constant
Nat
<nat>)
@@ -26,7 +26,7 @@
Test
(<| (_.covering /._)
(all _.and
- (_.coverage [/.export:]
+ (_.coverage [/.export]
(and (n.= <nat> ..constant)
(n.= (n.+ <nat> <nat>) (..shift <nat>))))
)))
diff --git a/stdlib/source/test/lux/ffi/export.rb.lux b/stdlib/source/test/lux/ffi/export.rb.lux
index c785c9abd..f107536f2 100644
--- a/stdlib/source/test/lux/ffi/export.rb.lux
+++ b/stdlib/source/test/lux/ffi/export.rb.lux
@@ -11,7 +11,7 @@
["/[1]" //]]])
(with_expansions [<nat> (static.random_nat)]
- (/.export:
+ (/.export
(def: nullary
Nat
<nat>)
@@ -34,7 +34,7 @@
Test
(<| (_.covering /._)
(all _.and
- (_.coverage [/.export:]
+ (_.coverage [/.export]
(and (n.= <nat> (..nullary []))
(n.= (n.+ <nat> <nat>) (..unary <nat>))
(n.= <nat> (..CONSTANT))
diff --git a/stdlib/source/test/lux/macro.lux b/stdlib/source/test/lux/macro.lux
index 531b43139..349ec7bbd 100644
--- a/stdlib/source/test/lux/macro.lux
+++ b/stdlib/source/test/lux/macro.lux
@@ -26,7 +26,7 @@
["[0]" symbol]]]]
[\\library
["[0]" / (.only)
- [syntax (.only syntax:)]
+ [syntax (.only syntax)]
["[0]" code (.open: "[1]#[0]" equivalence)]
["[0]" template]]]
["[0]" /
@@ -45,20 +45,24 @@
[(is [Text .Global]
[(template.text [<definition>]) {.#Definition [true .Macro <definition>]}])])
-(syntax: (pow/2 [number <code>.any])
- (in (list (` (n.* (~ number) (~ number))))))
+(def: pow/2
+ (syntax (_ [number <code>.any])
+ (in (list (` (n.* (~ number) (~ number)))))))
-(syntax: (pow/4 [number <code>.any])
- (in (list (` (..pow/2 (..pow/2 (~ number)))))))
+(def: pow/4
+ (syntax (_ [number <code>.any])
+ (in (list (` (..pow/2 (..pow/2 (~ number))))))))
-(syntax: (repeated [times <code>.nat
- token <code>.any])
- (in (list.repeated times token)))
+(def: repeated
+ (syntax (_ [times <code>.nat
+ token <code>.any])
+ (in (list.repeated times token))))
-(syntax: (fresh_symbol [])
- (do meta.monad
- [g!fresh (/.symbol "fresh")]
- (in (list g!fresh))))
+(def: fresh_symbol
+ (syntax (_ [])
+ (do meta.monad
+ [g!fresh (/.symbol "fresh")]
+ (in (list g!fresh)))))
(def: random_lux
(Random [Nat Text .Lux])
@@ -105,11 +109,12 @@
.#eval (as (-> Type Code (Meta Any)) [])
.#host []]])))
-(syntax: (iterated [cycle <code>.nat
- it <code>.any])
- (in (list (case cycle
- 0 it
- _ (` (..iterated (~ (code.nat (-- cycle))) (~ it)))))))
+(def: iterated
+ (syntax (_ [cycle <code>.nat
+ it <code>.any])
+ (in (list (case cycle
+ 0 it
+ _ (` (..iterated (~ (code.nat (-- cycle))) (~ it))))))))
(def: test|expansion
Test
diff --git a/stdlib/source/test/lux/macro/local.lux b/stdlib/source/test/lux/macro/local.lux
index a38dc8be7..de1073f55 100644
--- a/stdlib/source/test/lux/macro/local.lux
+++ b/stdlib/source/test/lux/macro/local.lux
@@ -18,7 +18,7 @@
[dictionary
["[0]" plist]]]]
["[0]" macro (.only)
- [syntax (.only syntax:)]
+ [syntax (.only syntax)]
["[0]" code]]
[math
["[0]" random (.only Random)]
@@ -27,14 +27,15 @@
[\\library
["[0]" /]])
-(syntax: (macro_error [macro <code>.any])
- (function (_ compiler)
- (case ((macro.expansion macro) compiler)
- {try.#Failure error}
- {try.#Success [compiler (list (code.text error))]}
-
- {try.#Success _}
- {try.#Failure "OOPS!"})))
+(def: macro_error
+ (syntax (_ [macro <code>.any])
+ (function (_ compiler)
+ (case ((macro.expansion macro) compiler)
+ {try.#Failure error}
+ {try.#Success [compiler (list (code.text error))]}
+
+ {try.#Success _}
+ {try.#Failure "OOPS!"}))))
(def: (constant output)
(-> Code Macro)
@@ -42,27 +43,28 @@
(function (_ inputs lux)
{try.#Success [lux (list output)]})))
-(syntax: (with [name (<code>.tuple (<>.and <code>.text <code>.text))
- constant <code>.any
- pre_remove <code>.bit
- body <code>.any])
- (macro.with_symbols [g!output]
- (do meta.monad
- [pop! (/.push (list [name (..constant constant)]))
- [module short] (meta.normal name)
- _ (if pre_remove
- (let [remove_macro! (is (-> .Module .Module)
- (revised .#definitions (plist.lacks short)))]
- (function (_ lux)
- {try.#Success [(revised .#modules (plist.revised module remove_macro!) lux)
- []]}))
- (in []))]
- (let [pre_expansion (` (let [(~ g!output) (~ body)]
- (exec (~ pop!)
- (~ g!output))))]
- (if pre_remove
- (macro.full_expansion pre_expansion)
- (in (list pre_expansion)))))))
+(def: with
+ (syntax (_ [name (<code>.tuple (<>.and <code>.text <code>.text))
+ constant <code>.any
+ pre_remove <code>.bit
+ body <code>.any])
+ (macro.with_symbols [g!output]
+ (do meta.monad
+ [pop! (/.push (list [name (..constant constant)]))
+ [module short] (meta.normal name)
+ _ (if pre_remove
+ (let [remove_macro! (is (-> .Module .Module)
+ (revised .#definitions (plist.lacks short)))]
+ (function (_ lux)
+ {try.#Success [(revised .#modules (plist.revised module remove_macro!) lux)
+ []]}))
+ (in []))]
+ (let [pre_expansion (` (let [(~ g!output) (~ body)]
+ (exec (~ pop!)
+ (~ g!output))))]
+ (if pre_remove
+ (macro.full_expansion pre_expansion)
+ (in (list pre_expansion))))))))
(def: .public test
Test
diff --git a/stdlib/source/test/lux/macro/syntax.lux b/stdlib/source/test/lux/macro/syntax.lux
index c5ddd0510..8c851a778 100644
--- a/stdlib/source/test/lux/macro/syntax.lux
+++ b/stdlib/source/test/lux/macro/syntax.lux
@@ -22,10 +22,11 @@
["[1][0]" type
["[1]/[0]" variable]]])
-(/.syntax: (+/3 [a <code>.any
- b <code>.any
- c <code>.any])
- (in (list (` (all n.+ (~ a) (~ b) (~ c))))))
+(def: +/3
+ (/.syntax (_ [a <code>.any
+ b <code>.any
+ c <code>.any])
+ (in (list (` (all n.+ (~ a) (~ b) (~ c)))))))
(def: .public test
Test
@@ -35,7 +36,7 @@
[x random.nat
y random.nat
z random.nat]
- (_.coverage [/.syntax:]
+ (_.coverage [/.syntax]
(n.= (all n.+ x y z)
(+/3 x y z))))
diff --git a/stdlib/source/test/lux/macro/template.lux b/stdlib/source/test/lux/macro/template.lux
index 771c9c082..715a0dbe2 100644
--- a/stdlib/source/test/lux/macro/template.lux
+++ b/stdlib/source/test/lux/macro/template.lux
@@ -13,7 +13,7 @@
[collection
["[0]" list]]]
["[0]" macro (.only)
- [syntax (.only syntax:)]
+ [syntax (.only syntax)]
["[0]" code]]
[math
["[0]" random (.only Random)]
@@ -28,14 +28,15 @@
(-> Nat Nat)
(|>> !pow/2)))
-(syntax: (macro_error [macro <code>.any])
- (function (_ compiler)
- (case ((macro.expansion macro) compiler)
- {try.#Failure error}
- {try.#Success [compiler (list (code.text error))]}
-
- {try.#Success _}
- {try.#Failure "OOPS!"})))
+(def: macro_error
+ (syntax (_ [macro <code>.any])
+ (function (_ compiler)
+ (case ((macro.expansion macro) compiler)
+ {try.#Failure error}
+ {try.#Success [compiler (list (code.text error))]}
+
+ {try.#Success _}
+ {try.#Failure "OOPS!"}))))
(def: .public test
Test
diff --git a/stdlib/source/test/lux/math/modulus.lux b/stdlib/source/test/lux/math/modulus.lux
index 484a7470a..a3f26cdf5 100644
--- a/stdlib/source/test/lux/math/modulus.lux
+++ b/stdlib/source/test/lux/math/modulus.lux
@@ -13,17 +13,18 @@
[number
["i" int]]]
[macro
- [syntax (.only syntax:)]
+ [syntax (.only syntax)]
["[0]" code]]]]
[\\library
["[0]" /]])
-(syntax: (|divisor| [])
- (do meta.monad
- [divisor meta.seed]
- (in (list (code.int (case divisor
- 0 +1
- _ (.int divisor)))))))
+(def: |divisor|
+ (syntax (_ [])
+ (do meta.monad
+ [divisor meta.seed]
+ (in (list (code.int (case divisor
+ 0 +1
+ _ (.int divisor))))))))
(def: .public (random range)
(Ex (_ %) (-> Int (Random (/.Modulus %))))
diff --git a/stdlib/source/test/lux/meta/configuration.lux b/stdlib/source/test/lux/meta/configuration.lux
index 734fbef82..45dcc5e5d 100644
--- a/stdlib/source/test/lux/meta/configuration.lux
+++ b/stdlib/source/test/lux/meta/configuration.lux
@@ -19,7 +19,7 @@
[collection
["[0]" list]]]
["[0]" macro (.only)
- [syntax (.only syntax:)]
+ [syntax (.only syntax)]
["[0]" code]]
[math
["[0]" random (.only Random) (.open: "[1]#[0]" monad)]]]]
@@ -36,14 +36,15 @@
(at ! each (|>> (partial_list [feature value]))
(random (-- amount))))))
-(syntax: (failure [it <code>.any])
- (function (_ lux)
- (case (macro.expansion it lux)
- {try.#Failure error}
- {try.#Success [lux (list (code.text error))]}
-
- {try.#Success _}
- {try.#Failure ""})))
+(def: failure
+ (syntax (_ [it <code>.any])
+ (function (_ lux)
+ (case (macro.expansion it lux)
+ {try.#Failure error}
+ {try.#Success [lux (list (code.text error))]}
+
+ {try.#Success _}
+ {try.#Failure ""}))))
(def: .public test
Test
diff --git a/stdlib/source/test/lux/meta/version.lux b/stdlib/source/test/lux/meta/version.lux
index e85fc8aa5..3a59251de 100644
--- a/stdlib/source/test/lux/meta/version.lux
+++ b/stdlib/source/test/lux/meta/version.lux
@@ -14,7 +14,7 @@
[data
["[0]" text]]
["[0]" macro (.only)
- [syntax (.only syntax:)]
+ [syntax (.only syntax)]
["[0]" code]]
[math
["[0]" random]
@@ -23,14 +23,15 @@
[\\library
["[0]" /]])
-(syntax: (failure [it <code>.any])
- (function (_ lux)
- (case (macro.expansion it lux)
- {try.#Failure error}
- {try.#Success [lux (list (code.text error))]}
-
- {try.#Success _}
- {try.#Failure ""})))
+(def: failure
+ (syntax (_ [it <code>.any])
+ (function (_ lux)
+ (case (macro.expansion it lux)
+ {try.#Failure error}
+ {try.#Success [lux (list (code.text error))]}
+
+ {try.#Success _}
+ {try.#Failure ""}))))
(def: .public test
Test
diff --git a/stdlib/source/test/lux/program.lux b/stdlib/source/test/lux/program.lux
index a6380c838..7e3430387 100644
--- a/stdlib/source/test/lux/program.lux
+++ b/stdlib/source/test/lux/program.lux
@@ -15,16 +15,17 @@
[collection
["[0]" list]]]
[macro
- [syntax (.only syntax:)]]
+ [syntax (.only syntax)]]
[math
["[0]" random]]]]
[\\library
["[0]" /]])
-(syntax: (actual_program [actual_program (<| <code>.form
- (<>.after (<code>.this_text "lux def program"))
- <code>.any)])
- (in (list actual_program)))
+(def: actual_program
+ (syntax (_ [actual_program (<| <code>.form
+ (<>.after (<code>.this_text "lux def program"))
+ <code>.any)])
+ (in (list actual_program))))
(def: .public test
Test
diff --git a/stdlib/source/test/lux/type/primitive.lux b/stdlib/source/test/lux/type/primitive.lux
index 15b084af1..8ef01f41f 100644
--- a/stdlib/source/test/lux/type/primitive.lux
+++ b/stdlib/source/test/lux/type/primitive.lux
@@ -13,7 +13,7 @@
[data
["[0]" text (.open: "[1]#[0]" equivalence)]]
["[0]" macro (.only)
- [syntax (.only syntax:)]
+ [syntax (.only syntax)]
["[0]" code]
["[0]" template]]
["[0]" math (.only)
@@ -25,24 +25,26 @@
(template.with_locals [g!Foo g!Bar]
(these (template [<syntax> <meta>]
- [(syntax: (<syntax> [])
- (do meta.monad
- [frame <meta>]
- (in (list (code.text (the /.#name frame))))))]
+ [(def: <syntax>
+ (syntax (_ [])
+ (do meta.monad
+ [frame <meta>]
+ (in (list (code.text (the /.#name frame)))))))]
[current /.current]
[specific (/.specific (template.text [g!Foo]))]
)
- (syntax: (with_no_active_frames [macro <code>.any])
- (function (_ compiler)
- (let [verdict (case ((macro.expansion macro) compiler)
- {try.#Failure error}
- (exception.match? /.no_active_frames error)
-
- {try.#Success _}
- false)]
- {try.#Success [compiler (list (code.bit verdict))]})))
+ (def: with_no_active_frames
+ (syntax (_ [macro <code>.any])
+ (function (_ compiler)
+ (let [verdict (case ((macro.expansion macro) compiler)
+ {try.#Failure error}
+ (exception.match? /.no_active_frames error)
+
+ {try.#Success _}
+ false)]
+ {try.#Success [compiler (list (code.bit verdict))]}))))
(with_expansions [no_current! (..with_no_active_frames (..current))
no_specific! (..with_no_active_frames (..specific))]
diff --git a/stdlib/source/test/lux/type/resource.lux b/stdlib/source/test/lux/type/resource.lux
index 8a42a444e..3de50b8a7 100644
--- a/stdlib/source/test/lux/type/resource.lux
+++ b/stdlib/source/test/lux/type/resource.lux
@@ -19,7 +19,7 @@
["[0]" text (.open: "[1]#[0]" equivalence)
["%" format (.only format)]]]
["[0]" macro (.only)
- [syntax (.only syntax:)]
+ [syntax (.only syntax)]
["[0]" code]]
[math
["[0]" random]]]]
@@ -155,18 +155,19 @@
))
)))))
-(syntax: (with_error [exception <code>.symbol
- to_expand <code>.any])
- (monad.do meta.monad
- [[_ _ exception] (meta.export exception)]
- (function (_ compiler)
- {.#Right [compiler
- (list (code.bit (case ((macro.single_expansion to_expand) compiler)
- {try.#Success _}
- false
-
- {try.#Failure error}
- true)))]})))
+(def: with_error
+ (syntax (_ [exception <code>.symbol
+ to_expand <code>.any])
+ (monad.do meta.monad
+ [[_ _ exception] (meta.export exception)]
+ (function (_ compiler)
+ {.#Right [compiler
+ (list (code.bit (case ((macro.single_expansion to_expand) compiler)
+ {try.#Success _}
+ false
+
+ {try.#Failure error}
+ true)))]}))))
(def: .public test
Test
diff --git a/stdlib/source/test/lux/type/unit.lux b/stdlib/source/test/lux/type/unit.lux
index f976aae54..edf3fe6bd 100644
--- a/stdlib/source/test/lux/type/unit.lux
+++ b/stdlib/source/test/lux/type/unit.lux
@@ -12,7 +12,7 @@
["$[0]" order]
["$[0]" enum]]]
[macro
- [syntax (.only syntax:)]
+ [syntax (.only syntax)]
["[0]" code]]
[math
["[0]" random (.only Random)]
@@ -77,10 +77,11 @@
(i.= expected)))
)))))
-(syntax: (natural [])
- (at meta.monad each
- (|>> code.nat list)
- meta.seed))
+(def: natural
+ (syntax (_ [])
+ (at meta.monad each
+ (|>> code.nat list)
+ meta.seed)))
(with_expansions [<from> (..natural)
<to> (..natural)]