From 7e4c9ba2e02f06fa621ffe24bc0ca046536429ef Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Sat, 2 Jul 2022 16:32:00 -0400 Subject: Moved "lux/macro" to "lux/meta/macro". --- stdlib/source/test/lux.lux | 12 +- stdlib/source/test/lux/control/concatenative.lux | 7 +- stdlib/source/test/lux/control/function/memo.lux | 5 +- stdlib/source/test/lux/control/function/mixin.lux | 7 +- stdlib/source/test/lux/control/parser.lux | 6 +- stdlib/source/test/lux/control/remember.lux | 6 +- stdlib/source/test/lux/control/security/policy.lux | 7 +- stdlib/source/test/lux/data/binary.lux | 8 +- stdlib/source/test/lux/data/collection/tree.lux | 7 +- stdlib/source/test/lux/data/color/named.lux | 7 +- stdlib/source/test/lux/data/format/json.lux | 6 +- stdlib/source/test/lux/data/format/tar.lux | 8 +- stdlib/source/test/lux/data/format/xml.lux | 8 +- stdlib/source/test/lux/data/text.lux | 6 +- stdlib/source/test/lux/data/text/encoding.lux | 7 +- stdlib/source/test/lux/data/text/escape.lux | 8 +- stdlib/source/test/lux/data/text/regex.lux | 6 +- stdlib/source/test/lux/data/text/unicode/block.lux | 7 +- stdlib/source/test/lux/debug.lux | 6 +- stdlib/source/test/lux/documentation.lux | 8 +- stdlib/source/test/lux/extension.lux | 6 +- stdlib/source/test/lux/ffi.jvm.lux | 8 +- stdlib/source/test/lux/ffi.old.lux | 7 +- stdlib/source/test/lux/ffi/export.jvm.lux | 6 +- stdlib/source/test/lux/locale/language.lux | 7 +- stdlib/source/test/lux/locale/territory.lux | 7 +- stdlib/source/test/lux/macro.lux | 250 --------------------- stdlib/source/test/lux/macro/context.lux | 12 - stdlib/source/test/lux/macro/local.lux | 130 ----------- stdlib/source/test/lux/macro/pattern.lux | 99 -------- stdlib/source/test/lux/macro/syntax.lux | 49 ---- stdlib/source/test/lux/macro/syntax/check.lux | 49 ---- .../source/test/lux/macro/syntax/declaration.lux | 49 ---- stdlib/source/test/lux/macro/syntax/definition.lux | 97 -------- stdlib/source/test/lux/macro/syntax/export.lux | 46 ---- stdlib/source/test/lux/macro/syntax/input.lux | 50 ----- .../source/test/lux/macro/syntax/type/variable.lux | 39 ---- stdlib/source/test/lux/macro/template.lux | 117 ---------- stdlib/source/test/lux/math.lux | 7 +- stdlib/source/test/lux/math/modulus.lux | 6 +- stdlib/source/test/lux/math/number/frac.lux | 7 +- stdlib/source/test/lux/meta.lux | 10 +- stdlib/source/test/lux/meta/code.lux | 6 +- stdlib/source/test/lux/meta/configuration.lux | 6 +- stdlib/source/test/lux/meta/macro.lux | 250 +++++++++++++++++++++ stdlib/source/test/lux/meta/macro/context.lux | 12 + stdlib/source/test/lux/meta/macro/local.lux | 130 +++++++++++ stdlib/source/test/lux/meta/macro/pattern.lux | 99 ++++++++ stdlib/source/test/lux/meta/macro/syntax.lux | 49 ++++ stdlib/source/test/lux/meta/macro/syntax/check.lux | 48 ++++ .../test/lux/meta/macro/syntax/declaration.lux | 48 ++++ .../test/lux/meta/macro/syntax/definition.lux | 96 ++++++++ .../source/test/lux/meta/macro/syntax/export.lux | 46 ++++ stdlib/source/test/lux/meta/macro/syntax/input.lux | 49 ++++ .../test/lux/meta/macro/syntax/type/variable.lux | 38 ++++ stdlib/source/test/lux/meta/macro/template.lux | 117 ++++++++++ stdlib/source/test/lux/meta/symbol.lux | 7 +- stdlib/source/test/lux/meta/type.lux | 6 +- stdlib/source/test/lux/meta/type/check.lux | 7 +- stdlib/source/test/lux/meta/type/primitive.lux | 8 +- stdlib/source/test/lux/meta/type/resource.lux | 6 +- stdlib/source/test/lux/meta/type/unit/scale.lux | 6 +- stdlib/source/test/lux/meta/version.lux | 6 +- stdlib/source/test/lux/program.lux | 8 +- stdlib/source/test/lux/target/js.lux | 7 +- stdlib/source/test/lux/target/lua.lux | 7 +- .../lux/tool/compiler/language/lux/analysis.lux | 4 +- .../compiler/language/lux/analysis/coverage.lux | 7 +- .../compiler/language/lux/analysis/inference.lux | 2 +- .../tool/compiler/language/lux/analysis/macro.lux | 2 +- .../tool/compiler/language/lux/phase/analysis.lux | 2 +- .../compiler/language/lux/phase/analysis/case.lux | 2 +- .../language/lux/phase/analysis/complex.lux | 4 +- .../language/lux/phase/analysis/function.lux | 2 +- .../language/lux/phase/synthesis/function.lux | 7 +- .../language/lux/phase/synthesis/variable.lux | 9 +- .../lux/tool/compiler/language/lux/synthesis.lux | 6 +- stdlib/source/test/lux/world/file.lux | 5 +- stdlib/source/test/lux/world/input/keyboard.lux | 7 +- stdlib/source/test/lux/world/net/http/status.lux | 7 +- 80 files changed, 1173 insertions(+), 1155 deletions(-) delete mode 100644 stdlib/source/test/lux/macro.lux delete mode 100644 stdlib/source/test/lux/macro/context.lux delete mode 100644 stdlib/source/test/lux/macro/local.lux delete mode 100644 stdlib/source/test/lux/macro/pattern.lux delete mode 100644 stdlib/source/test/lux/macro/syntax.lux delete mode 100644 stdlib/source/test/lux/macro/syntax/check.lux delete mode 100644 stdlib/source/test/lux/macro/syntax/declaration.lux delete mode 100644 stdlib/source/test/lux/macro/syntax/definition.lux delete mode 100644 stdlib/source/test/lux/macro/syntax/export.lux delete mode 100644 stdlib/source/test/lux/macro/syntax/input.lux delete mode 100644 stdlib/source/test/lux/macro/syntax/type/variable.lux delete mode 100644 stdlib/source/test/lux/macro/template.lux create mode 100644 stdlib/source/test/lux/meta/macro.lux create mode 100644 stdlib/source/test/lux/meta/macro/context.lux create mode 100644 stdlib/source/test/lux/meta/macro/local.lux create mode 100644 stdlib/source/test/lux/meta/macro/pattern.lux create mode 100644 stdlib/source/test/lux/meta/macro/syntax.lux create mode 100644 stdlib/source/test/lux/meta/macro/syntax/check.lux create mode 100644 stdlib/source/test/lux/meta/macro/syntax/declaration.lux create mode 100644 stdlib/source/test/lux/meta/macro/syntax/definition.lux create mode 100644 stdlib/source/test/lux/meta/macro/syntax/export.lux create mode 100644 stdlib/source/test/lux/meta/macro/syntax/input.lux create mode 100644 stdlib/source/test/lux/meta/macro/syntax/type/variable.lux create mode 100644 stdlib/source/test/lux/meta/macro/template.lux (limited to 'stdlib/source/test') diff --git a/stdlib/source/test/lux.lux b/stdlib/source/test/lux.lux index 1e997b2cf..1452a1aed 100644 --- a/stdlib/source/test/lux.lux +++ b/stdlib/source/test/lux.lux @@ -21,10 +21,6 @@ ["[0]" set (.only Set) (.use "[1]#[0]" equivalence)] ["[0]" list (.use "[1]#[0]" functor) ["[0]" property]]]] - ["[0]" macro (.only) - [syntax (.only syntax)] - ["^" pattern] - ["[0]" template]] ["[0]" math ["[0]" random (.use "[1]#[0]" functor)] [number @@ -38,7 +34,11 @@ ["[0]" meta (.use "[1]#[0]" monad) ["[0]" location (.use "[1]#[0]" equivalence)] ["[0]" code (.use "[1]#[0]" equivalence) - ["<[1]>" \\parser]]]]] + ["<[1]>" \\parser]] + ["[0]" macro (.only) + [syntax (.only syntax)] + ["^" pattern] + ["[0]" template]]]]] ... TODO: Must have 100% coverage on tests. ["[0]" / ["[1][0]" abstract] @@ -48,7 +48,6 @@ ["[1][0]" documentation] ["[1][0]" locale] - ["[1][0]" macro] ["[1][0]" math] ["[1][0]" meta] @@ -1213,7 +1212,6 @@ /documentation.test /locale.test - /macro.test /math.test /meta.test diff --git a/stdlib/source/test/lux/control/concatenative.lux b/stdlib/source/test/lux/control/concatenative.lux index 7634e19fe..542175167 100644 --- a/stdlib/source/test/lux/control/concatenative.lux +++ b/stdlib/source/test/lux/control/concatenative.lux @@ -7,15 +7,16 @@ [data ["[0]" sum] ["[0]" bit (.use "[1]#[0]" equivalence)]] - [macro - ["[0]" template]] [math ["[0]" random] [number ["n" nat] ["i" int] ["r" rev] - ["f" frac]]]]] + ["f" frac]]] + [meta + [macro + ["[0]" template]]]]] [\\library ["[0]" / (.only =>)]]) diff --git a/stdlib/source/test/lux/control/function/memo.lux b/stdlib/source/test/lux/control/function/memo.lux index ed8410fa1..1a310744f 100644 --- a/stdlib/source/test/lux/control/function/memo.lux +++ b/stdlib/source/test/lux/control/function/memo.lux @@ -12,13 +12,14 @@ [collection ["[0]" dictionary (.only Dictionary)] ["[0]" list (.use "[1]#[0]" functor mix)]]] - [macro - ["^" pattern]] [math ["[0]" random] [number ["n" nat] ["[0]" i64]]] + [meta + [macro + ["^" pattern]]] [time ["[0]" instant] ["[0]" duration (.only Duration)]]]] diff --git a/stdlib/source/test/lux/control/function/mixin.lux b/stdlib/source/test/lux/control/function/mixin.lux index 3ed034a69..edc355e23 100644 --- a/stdlib/source/test/lux/control/function/mixin.lux +++ b/stdlib/source/test/lux/control/function/mixin.lux @@ -15,12 +15,13 @@ ["[0]" product] [collection ["[0]" list (.use "[1]#[0]" functor mix)]]] - [macro - ["^" pattern]] [math ["[0]" random (.only Random)] [number - ["n" nat]]]]] + ["n" nat]]] + [meta + [macro + ["^" pattern]]]]] [\\library ["[0]" /]]) diff --git a/stdlib/source/test/lux/control/parser.lux b/stdlib/source/test/lux/control/parser.lux index 6cecb66d4..2a7139b86 100644 --- a/stdlib/source/test/lux/control/parser.lux +++ b/stdlib/source/test/lux/control/parser.lux @@ -20,11 +20,11 @@ ["[0]" random] [number ["n" nat]]] - [macro - [syntax (.only syntax)]] [meta ["[0]" code (.only) - ["<[1]>" \\parser]]]]] + ["<[1]>" \\parser]] + [macro + [syntax (.only syntax)]]]]] [\\library ["[0]" / (.only Parser)]]) diff --git a/stdlib/source/test/lux/control/remember.lux b/stdlib/source/test/lux/control/remember.lux index 17440088a..9f79123c1 100644 --- a/stdlib/source/test/lux/control/remember.lux +++ b/stdlib/source/test/lux/control/remember.lux @@ -15,11 +15,11 @@ [math [number (.only hex)] ["[0]" random (.only Random) (.use "[1]#[0]" monad)]] - ["[0]" macro (.only) - ["[0]" syntax (.only syntax)]] ["[0]" meta (.only) ["[0]" code (.only) - ["<[1]>" \\parser]]] + ["<[1]>" \\parser]] + ["[0]" macro (.only) + ["[0]" syntax (.only syntax)]]] [time ["[0]" date (.only Date)] ["[0]" instant] diff --git a/stdlib/source/test/lux/control/security/policy.lux b/stdlib/source/test/lux/control/security/policy.lux index 1cfbf5c9e..7e0de2086 100644 --- a/stdlib/source/test/lux/control/security/policy.lux +++ b/stdlib/source/test/lux/control/security/policy.lux @@ -11,12 +11,13 @@ ["$[0]" monad]]] [data ["[0]" text (.use "[1]#[0]" equivalence)]] - [macro - ["^" pattern]] [math ["[0]" random] [number - ["n" nat]]]]] + ["n" nat]]] + [meta + [macro + ["^" pattern]]]]] [\\library ["[0]" / (.only Context Privacy Can_Conceal Can_Reveal Privilege Private)]]) diff --git a/stdlib/source/test/lux/data/binary.lux b/stdlib/source/test/lux/data/binary.lux index d3fcc968a..c43caf3a4 100644 --- a/stdlib/source/test/lux/data/binary.lux +++ b/stdlib/source/test/lux/data/binary.lux @@ -31,8 +31,6 @@ ["[0]" set] [array [\\unsafe (.only)]]]] - [macro - ["^" pattern]] [math ["[0]" random (.only Random)] [number @@ -42,9 +40,11 @@ ["[0]" rev] ["[0]" frac]]] [meta - ["[0]" code] ["[0]" symbol] - ["[0]" type]]]] + ["[0]" type] + ["[0]" code] + [macro + ["^" pattern]]]]] [\\library ["[0]" / (.only) (.use "[1]#[0]" equivalence) ["!" \\unsafe] diff --git a/stdlib/source/test/lux/data/collection/tree.lux b/stdlib/source/test/lux/data/collection/tree.lux index aec7a93e5..3f560f85d 100644 --- a/stdlib/source/test/lux/data/collection/tree.lux +++ b/stdlib/source/test/lux/data/collection/tree.lux @@ -16,12 +16,13 @@ ["[0]" product] [collection ["[0]" list (.use "[1]#[0]" functor mix)]]] - [macro - ["^" pattern]] [math ["[0]" random (.only Random)] [number - ["n" nat]]]]] + ["n" nat]]] + [meta + [macro + ["^" pattern]]]]] ["[0]" \\parser] [\\library ["[0]" / (.only Tree) diff --git a/stdlib/source/test/lux/data/color/named.lux b/stdlib/source/test/lux/data/color/named.lux index d98340a31..5bb0ca32b 100644 --- a/stdlib/source/test/lux/data/color/named.lux +++ b/stdlib/source/test/lux/data/color/named.lux @@ -8,12 +8,13 @@ [collection ["[0]" list] ["[0]" set]]] - [macro - ["[0]" template]] [math ["[0]" random (.only Random)] [number - ["n" nat]]]]] + ["n" nat]]] + [meta + [macro + ["[0]" template]]]]] [\\library ["[0]" / (.only) ["/[1]" //]]]) diff --git a/stdlib/source/test/lux/data/format/json.lux b/stdlib/source/test/lux/data/format/json.lux index bfc2b7d89..0e7ec6b44 100644 --- a/stdlib/source/test/lux/data/format/json.lux +++ b/stdlib/source/test/lux/data/format/json.lux @@ -27,9 +27,6 @@ ["[0]" dictionary (.only Dictionary)] ["[0]" set] ["[0]" list (.use "[1]#[0]" functor)]]] - ["[0]" macro (.only) - ["^" pattern] - ["[0]" syntax (.only syntax)]] [math ["[0]" random (.only Random)] [number @@ -43,6 +40,9 @@ ["[0]/[1]" \\test]]] ["[0]" meta (.only) ["[0]" code] + ["[0]" macro (.only) + ["^" pattern] + ["[0]" syntax (.only syntax)]] [type ["[0]" unit]]]]] ["[0]" \\polytypic] diff --git a/stdlib/source/test/lux/data/format/tar.lux b/stdlib/source/test/lux/data/format/tar.lux index 4a4426fd9..817c38c5a 100644 --- a/stdlib/source/test/lux/data/format/tar.lux +++ b/stdlib/source/test/lux/data/format/tar.lux @@ -24,14 +24,14 @@ [collection ["[0]" sequence] ["[0]" list (.use "[1]#[0]" mix)]]] - [time - ["[0]" instant (.only Instant)] - ["[0]" duration]] [math ["[0]" random (.only Random)] [number ["n" nat] - ["i" int]]]]] + ["i" int]]] + [time + ["[0]" instant (.only Instant)] + ["[0]" duration]]]] [\\library ["[0]" /]]) diff --git a/stdlib/source/test/lux/data/format/xml.lux b/stdlib/source/test/lux/data/format/xml.lux index dfdc7ac0e..72a4a5665 100644 --- a/stdlib/source/test/lux/data/format/xml.lux +++ b/stdlib/source/test/lux/data/format/xml.lux @@ -18,16 +18,16 @@ [collection ["[0]" dictionary] ["[0]" list (.use "[1]#[0]" functor)]]] - [macro - ["^" pattern] - ["[0]" template]] [math ["[0]" random (.only Random) (.use "[1]#[0]" monad)] [number ["n" nat]]] [meta ["[0]" symbol (.use "[1]#[0]" equivalence)] - ["[0]" type (.use "[1]#[0]" equivalence)]]]] + ["[0]" type (.use "[1]#[0]" equivalence)] + [macro + ["^" pattern] + ["[0]" template]]]]] ["[0]" \\parser] [\\library ["[0]" / (.use "[1]#[0]" equivalence)]]) diff --git a/stdlib/source/test/lux/data/text.lux b/stdlib/source/test/lux/data/text.lux index ef8bf11ec..82d998311 100644 --- a/stdlib/source/test/lux/data/text.lux +++ b/stdlib/source/test/lux/data/text.lux @@ -33,8 +33,6 @@ ["[0]" unicode ["[1]" set] ["[1]/[0]" block]]]] - [macro - ["^" pattern]] [math ["[0]" random (.only Random) (.use "[1]#[0]" monad)] ["[0]" modulus] @@ -50,7 +48,9 @@ ["[0]" symbol] ["[0]" type] ["[0]" code (.only) - ["<[1]>" \\parser]]] + ["<[1]>" \\parser]] + [macro + ["^" pattern]]] ["[0]" time (.only) ["[0]" day] ["[0]" month] diff --git a/stdlib/source/test/lux/data/text/encoding.lux b/stdlib/source/test/lux/data/text/encoding.lux index 47a1ddbb7..7464a5934 100644 --- a/stdlib/source/test/lux/data/text/encoding.lux +++ b/stdlib/source/test/lux/data/text/encoding.lux @@ -14,12 +14,13 @@ [collection ["[0]" list (.use "[1]#[0]" mix)] ["[0]" set]]] - [macro - ["[0]" template]] [math ["[0]" random (.only Random)] [number - ["n" nat]]]]] + ["n" nat]]] + [meta + [macro + ["[0]" template]]]]] [\\library ["[0]" /]] ["[0]" / diff --git a/stdlib/source/test/lux/data/text/escape.lux b/stdlib/source/test/lux/data/text/escape.lux index da90e8f24..7509dcf58 100644 --- a/stdlib/source/test/lux/data/text/escape.lux +++ b/stdlib/source/test/lux/data/text/escape.lux @@ -14,16 +14,16 @@ ["%" \\format (.only format)]] [collection ["[0]" set (.only Set)]]] - [macro - [syntax (.only syntax)] - ["[0]" template]] [math ["[0]" random (.only Random)] [number (.only hex) ["n" nat]]] ["[0]" meta (.only) ["[0]" code (.only) - ["<[1]>" \\parser]]]]] + ["<[1]>" \\parser]] + [macro + [syntax (.only syntax)] + ["[0]" template]]]]] [\\library ["[0]" / (.only) [// diff --git a/stdlib/source/test/lux/data/text/regex.lux b/stdlib/source/test/lux/data/text/regex.lux index 5dabc0a9b..faadefa50 100644 --- a/stdlib/source/test/lux/data/text/regex.lux +++ b/stdlib/source/test/lux/data/text/regex.lux @@ -11,14 +11,14 @@ ["[0]" text (.use "[1]#[0]" equivalence) ["%" \\format (.only format)] ["<[1]>" \\parser (.only Parser)]]] - ["[0]" macro (.only) - [syntax (.only syntax)]] [math [number (.only hex)] ["[0]" random]] [meta ["[0]" code (.only) - ["<[1]>" \\parser]]]]] + ["<[1]>" \\parser]] + ["[0]" macro (.only) + [syntax (.only syntax)]]]]] [\\library ["[0]" /]]) diff --git a/stdlib/source/test/lux/data/text/unicode/block.lux b/stdlib/source/test/lux/data/text/unicode/block.lux index 7149a441c..34f1ab7cd 100644 --- a/stdlib/source/test/lux/data/text/unicode/block.lux +++ b/stdlib/source/test/lux/data/text/unicode/block.lux @@ -13,12 +13,13 @@ [collection ["[0]" set] ["[0]" list]]] - [macro - ["[0]" template]] [math ["[0]" random (.only Random)] [number (.only hex) - ["n" nat]]]]] + ["n" nat]]] + [meta + [macro + ["[0]" template]]]]] [\\library ["[0]" /]]) diff --git a/stdlib/source/test/lux/debug.lux b/stdlib/source/test/lux/debug.lux index cda9456f2..5214ede51 100644 --- a/stdlib/source/test/lux/debug.lux +++ b/stdlib/source/test/lux/debug.lux @@ -16,15 +16,15 @@ [format [json (.only JSON)] [xml (.only XML)]]] - ["[0]" macro (.only) - [syntax (.only syntax)]] [math ["[0]" random (.only Random)] [number [ratio (.only Ratio)]]] [meta ["[0]" code (.only) - ["<[1]>" \\parser]]] + ["<[1]>" \\parser]] + ["[0]" macro (.only) + [syntax (.only syntax)]]] [time (.only Time) [instant (.only Instant)] [date (.only Date)] diff --git a/stdlib/source/test/lux/documentation.lux b/stdlib/source/test/lux/documentation.lux index 9a22ca625..37aff4544 100644 --- a/stdlib/source/test/lux/documentation.lux +++ b/stdlib/source/test/lux/documentation.lux @@ -10,12 +10,12 @@ ["%" \\format]] [format ["md" markdown]]] - ["[0]" macro (.only) - [syntax (.only syntax)] - ["[0]" template]] ["[0]" meta (.only) ["[0]" code (.only) - ["<[1]>" \\parser]]]]] + ["<[1]>" \\parser]] + ["[0]" macro (.only) + [syntax (.only syntax)] + ["[0]" template]]]]] [\\library ["[0]" /]]) diff --git a/stdlib/source/test/lux/extension.lux b/stdlib/source/test/lux/extension.lux index a50ff37ac..1ee8a623a 100644 --- a/stdlib/source/test/lux/extension.lux +++ b/stdlib/source/test/lux/extension.lux @@ -30,15 +30,15 @@ [collection ["[0]" sequence] ["[0]" list (.use "[1]#[0]" functor)]]] - [macro - ["[0]" template]] [math ["[0]" random] [number ["n" nat]]] [meta ["[0]" code - ["<[1]>" \\parser]]] + ["<[1]>" \\parser]] + [macro + ["[0]" template]]] [tool [compiler ["[0]" phase] diff --git a/stdlib/source/test/lux/ffi.jvm.lux b/stdlib/source/test/lux/ffi.jvm.lux index 642075157..55ca861be 100644 --- a/stdlib/source/test/lux/ffi.jvm.lux +++ b/stdlib/source/test/lux/ffi.jvm.lux @@ -17,9 +17,6 @@ ["%" \\format (.only format)]] [collection ["[0]" array (.only Array)]]] - ["[0]" macro (.only) - [syntax (.only syntax)] - ["[0]" template]] [math ["[0]" random (.only Random) (.use "[1]#[0]" monad)] [number (.only hex) @@ -30,7 +27,10 @@ ["[0]" meta (.only) ["[0]" type (.use "[1]#[0]" equivalence)] ["[0]" code (.only) - ["<[1]>" \\parser]]] + ["<[1]>" \\parser]] + ["[0]" macro (.only) + [syntax (.only syntax)] + ["[0]" template]]] [target ["[0]" jvm ["[1]" type (.use "[1]#[0]" equivalence)]]]]] diff --git a/stdlib/source/test/lux/ffi.old.lux b/stdlib/source/test/lux/ffi.old.lux index b8d9ea20a..a5beca2bb 100644 --- a/stdlib/source/test/lux/ffi.old.lux +++ b/stdlib/source/test/lux/ffi.old.lux @@ -10,15 +10,16 @@ [data ["[0]" text (.use "[1]#[0]" equivalence) ["%" \\format (.only format)]]] - [macro - ["[0]" template]] [math ["[0]" random] [number ["n" nat] ["i" int] ["f" frac]]] - ["[0]" type (.use "[1]#[0]" equivalence)]]] + [meta + ["[0]" type (.use "[1]#[0]" equivalence)] + [macro + ["[0]" template]]]]] [\\library ["[0]" /]]) diff --git a/stdlib/source/test/lux/ffi/export.jvm.lux b/stdlib/source/test/lux/ffi/export.jvm.lux index a567e8df4..81615af21 100644 --- a/stdlib/source/test/lux/ffi/export.jvm.lux +++ b/stdlib/source/test/lux/ffi/export.jvm.lux @@ -10,8 +10,6 @@ ["[0]" bit (.use "[1]#[0]" equivalence)] ["[0]" text (.use "[1]#[0]" equivalence) ["%" \\format]]] - [macro - ["[0]" template]] [math ["[0]" random (.only Random) (.use "[1]#[0]" monad)] [number (.only hex) @@ -19,7 +17,9 @@ ["[0]" int (.use "[1]#[0]" equivalence)] ["[0]" frac (.use "[1]#[0]" equivalence)]]] ["[0]" meta (.only) - ["[0]" code]]]] + ["[0]" code] + [macro + ["[0]" template]]]]] [\\library ["[0]" / (.only) ["/[1]" //]]]) diff --git a/stdlib/source/test/lux/locale/language.lux b/stdlib/source/test/lux/locale/language.lux index 4c4f2d62e..edabb90d2 100644 --- a/stdlib/source/test/lux/locale/language.lux +++ b/stdlib/source/test/lux/locale/language.lux @@ -14,12 +14,13 @@ [collection ["[0]" set (.only Set)] ["[0]" list (.use "[1]#[0]" functor mix)]]] - [macro - ["[0]" template]] [math ["[0]" random (.only Random)] [number - ["n" nat]]]]] + ["n" nat]]] + [meta + [macro + ["[0]" template]]]]] [\\library ["[0]" /]]) diff --git a/stdlib/source/test/lux/locale/territory.lux b/stdlib/source/test/lux/locale/territory.lux index 514009dc0..969fe32a1 100644 --- a/stdlib/source/test/lux/locale/territory.lux +++ b/stdlib/source/test/lux/locale/territory.lux @@ -14,12 +14,13 @@ [collection ["[0]" set (.only Set)] ["[0]" list (.use "[1]#[0]" functor mix)]]] - [macro - ["[0]" template]] [math ["[0]" random (.only Random)] [number - ["n" nat]]]]] + ["n" nat]]] + [meta + [macro + ["[0]" template]]]]] [\\library ["[0]" /]]) diff --git a/stdlib/source/test/lux/macro.lux b/stdlib/source/test/lux/macro.lux deleted file mode 100644 index 948acd4cd..000000000 --- a/stdlib/source/test/lux/macro.lux +++ /dev/null @@ -1,250 +0,0 @@ -(.require - [library - [lux (.except) - ["_" test (.only Test)] - ["[0]" static] - [abstract - [monad (.only do)]] - [control - ["[0]" try (.use "[1]#[0]" functor)]] - [data - ["[0]" bit (.use "[1]#[0]" equivalence)] - ["[0]" text (.only) - ["%" \\format (.only format)]] - [collection - ["[0]" list]]] - [macro - ["^" pattern]] - [math - ["[0]" random (.only Random) (.use "[1]#[0]" functor)] - [number - ["n" nat]]] - ["[0]" meta (.only) - ["[0]" location] - ["[0]" symbol] - ["[0]" code (.use "[1]#[0]" equivalence) - ["<[1]>" \\parser]]]]] - [\\library - ["[0]" / (.only) - [syntax (.only syntax)] - ["[0]" template]]] - ["[0]" / - ["[1][0]" local] - ["[1][0]" syntax] - ["[1][0]" template] - ["[1][0]" pattern] - ["[1][0]" context]]) - -(def !expect - (template (_ ) - [(case - true - _ false)])) - -(def !global - (template (_ ) - [(is [Text .Global] - [(template.text []) {.#Definition [true .Macro ]}])])) - -(def pow/2 - (syntax (_ [number .any]) - (in (list (` (n.* (, number) (, number))))))) - -(def pow/4 - (syntax (_ [number .any]) - (in (list (` (..pow/2 (..pow/2 (, number)))))))) - -(def repeated - (syntax (_ [times .nat - token .any]) - (in (list.repeated times token)))) - -(def fresh_symbol - (syntax (_ []) - (do meta.monad - [g!fresh (/.symbol "fresh")] - (in (list g!fresh))))) - -(def random_lux - (Random [Nat Text .Lux]) - (do [! random.monad] - [seed random.nat - symbol_prefix (random.upper_case 1) - .let [macro_module (symbol.module (symbol /._)) - current_module (symbol.module (symbol .._))]] - (in [seed - symbol_prefix - [.#info [.#target "" - .#version "" - .#mode {.#Build} - .#configuration (list)] - .#source [location.dummy 0 ""] - .#location location.dummy - .#current_module {.#Some current_module} - .#modules (list [macro_module - [.#module_hash 0 - .#module_aliases (list) - .#definitions (is (List [Text .Global]) - (list (!global /.log_single_expansion!) - (!global /.log_expansion!) - (!global /.log_full_expansion!))) - .#imports (list) - .#module_state {.#Active}]] - [current_module - [.#module_hash 0 - .#module_aliases (list) - .#definitions (is (List [Text .Global]) - (list (!global ..pow/2) - (!global ..pow/4) - (!global ..repeated))) - .#imports (list) - .#module_state {.#Active}]]) - .#scopes (list) - .#type_context [.#ex_counter 0 - .#var_counter 0 - .#var_bindings (list)] - .#expected {.#None} - .#seed seed - .#scope_type_vars (list) - .#extensions [] - .#eval (as (-> Type Code (Meta Any)) []) - .#host []]]))) - -(def iterated - (syntax (_ [cycle .nat - it .any]) - (in (list (case cycle - 0 it - _ (` (..iterated (, (code.nat (-- cycle))) (, it)))))))) - -(def test|expansion - Test - (do [! random.monad] - [[seed symbol_prefix lux] ..random_lux - - pow/1 (at ! each code.nat random.nat) - - repetitions (at ! each (n.% 10) random.nat) - .let [single_expansion (` (..pow/2 (..pow/2 (, pow/1)))) - expansion (` (n.* (..pow/2 (, pow/1)) - (..pow/2 (, pow/1)))) - full_expansion (` (n.* (n.* (, pow/1) (, pow/1)) - (n.* (, pow/1) (, pow/1))))]] - (`` (all _.and - (,, (with_template [ ] - [(_.coverage [] - (|> ( (` (..pow/4 (, pow/1)))) - (meta.result lux) - (try#each (at (list.equivalence code.equivalence) = - (list ))) - (try.else false))) - - (_.coverage [] - (and (|> (/.single_expansion (` ( "omit" (..pow/4 (, pow/1))))) - (meta.result lux) - (try#each (at (list.equivalence code.equivalence) = (list))) - (try.else false)) - (|> (/.single_expansion (` ( (..pow/4 (, pow/1))))) - (meta.result lux) - (try#each (at (list.equivalence code.equivalence) = (list ))) - (try.else false))))] - - [/.single_expansion /.log_single_expansion! single_expansion] - [/.expansion /.log_expansion! expansion] - [/.full_expansion /.log_full_expansion! full_expansion] - )) - (_.coverage [/.one_expansion] - (bit#= (not (n.= 1 repetitions)) - (|> (/.one_expansion (` (..repeated (, (code.nat repetitions)) (, pow/1)))) - (meta.result lux) - (!expect {try.#Failure _})))) - (_.coverage [/.final] - (with_expansions [ (static.random_nat) - (static.random code.nat - (random#each (|>> (n.% 5) ++) random.nat)) - (/.final (..iterated ))] - (case (' ) - [_ {.#Nat actual}] - (n.= actual) - - _ - false))) - (_.coverage [/.times] - (with_expansions [ (static.random_nat) - (static.random code.nat - (random#each (|>> (n.% 10) (n.+ 2)) random.nat)) - (static.random code.nat - (random#each (|>> (n.% ) ++) random.nat)) - (/.times (..iterated ))] - (let [expected_remaining (n.- )] - (case (` ) - (^.` (..iterated (, [_ {.#Nat actual_remaining}]) (, [_ {.#Nat actual}]))) - (and (n.= expected_remaining actual_remaining) - (n.= actual)) - - _ - false)))) - )))) - -(def sum - (macro (_ tokens) - (loop (again [tokens tokens - output 0]) - (case tokens - {.#End} - (at meta.monad in (list (code.nat output))) - - {.#Item [_ {.#Nat head}] tail} - (again tail (n.+ head output)) - - _ - (meta.failure ""))))) - -(def sum' - (macro (_ tokens lux) - ((/.function ..sum) tokens lux))) - -(def .public test - Test - (<| (_.covering /._) - (all _.and - (do [! random.monad] - [[seed symbol_prefix lux] ..random_lux] - (all _.and - (_.coverage [/.symbol] - (|> (/.symbol symbol_prefix) - (at meta.monad each %.code) - (meta.result lux) - (!expect (^.multi {try.#Success actual_symbol} - (and (text.contains? symbol_prefix actual_symbol) - (text.contains? (%.nat seed) actual_symbol)))))) - (_.coverage [/.wrong_syntax_error] - (|> (/.single_expansion (` (/.log_single_expansion!))) - (meta.result lux) - (!expect (^.multi {try.#Failure error} - (text.contains? (/.wrong_syntax_error (symbol /.log_single_expansion!)) - error))))) - (_.coverage [/.with_symbols] - (with_expansions [ (fresh_symbol)] - (|> (/.with_symbols [] - (at meta.monad in )) - (meta.result lux) - (!expect (^.multi {try.#Success [_ {.#Symbol ["" actual]}]} - (text.contains? (template.text []) - actual)))))) - (_.coverage [/.function] - (with_expansions [n/0 (static.random_nat) - n/1 (static.random_nat) - n/1 (static.random_nat)] - (n.= (..sum n/0 n/1 n/1) - (..sum' n/0 n/1 n/1)))) - )) - - ..test|expansion - - /local.test - /syntax.test - /template.test - /pattern.test - /context.test - ))) diff --git a/stdlib/source/test/lux/macro/context.lux b/stdlib/source/test/lux/macro/context.lux deleted file mode 100644 index 52df97710..000000000 --- a/stdlib/source/test/lux/macro/context.lux +++ /dev/null @@ -1,12 +0,0 @@ -(.require - [library - [lux (.except) - ["_" test (.only Test)]]] - [\\library - ["[0]" /]]) - -(def .public test - Test - (<| (_.covering /._) - (_.property "TBD" false) - )) diff --git a/stdlib/source/test/lux/macro/local.lux b/stdlib/source/test/lux/macro/local.lux deleted file mode 100644 index 75b8b68ca..000000000 --- a/stdlib/source/test/lux/macro/local.lux +++ /dev/null @@ -1,130 +0,0 @@ -(.require - [library - [lux (.except with) - ["_" test (.only Test)] - [abstract - [monad (.only do)]] - [control - ["<>" parser] - ["[0]" try] - ["[0]" exception]] - [data - [text - ["%" \\format]] - [collection - ["[0]" list - ["[0]" property]]]] - ["[0]" macro (.only) - [syntax (.only syntax)]] - [math - ["[0]" random (.only Random)] - [number - ["n" nat]]] - ["[0]" meta (.only) - ["[0]" code (.only) - ["<[1]>" \\parser]]]]] - [\\library - ["[0]" /]]) - -(/.let [!pow/2 (template (_ ) - [(n.* )])] - (def pow/2 - (-> Nat Nat) - (|>> !pow/2))) - -(def macro_error - (syntax (_ [macro .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) - ("lux macro" - (function (_ inputs lux) - {try.#Success [lux (list output)]}))) - -(def with - (syntax (_ [name (.tuple (<>.and .text .text)) - constant .any - pre_remove .bit - body .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 (property.lacks short)))] - (function (_ lux) - {try.#Success [(revised .#modules (property.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 - (<| (_.covering /._) - (do [! random.monad] - [expected random.nat] - (all _.and - (_.coverage [/.push] - (..with ["" "actual"] expected #0 - (n.= expected (..actual)))) - (_.coverage [/.unknown_module] - (exception.match? /.unknown_module - (..macro_error - (..with ["123yolo456" "actual"] expected #0 - (n.= expected (..actual)))))) - (_.coverage [/.cannot_shadow_definition] - (exception.match? /.cannot_shadow_definition - (..macro_error - (..with ["" "with"] expected #0 - (n.= expected (..actual)))))) - (_.coverage [/.unknown_definition] - (exception.match? /.unknown_definition - (<| ..macro_error - (..with ["" "actual"] expected #1) - (n.= expected (..actual))))) - (do ! - [scalar random.nat] - (_.coverage [/.let] - (let [can_use_with_statements! - (n.= (all n.* scalar scalar) - (..pow/2 scalar))] - (and can_use_with_statements! - (/.let [pow/3 (template (_ ) - [(all n.* )]) - pow/9 (template (_ ) - [(pow/3 (pow/3 ))])] - (let [can_use_with_expressions! - (n.= (all n.* scalar scalar scalar) - (pow/3 scalar)) - - can_refer! - (n.= (all n.* - scalar scalar scalar - scalar scalar scalar - scalar scalar scalar) - (pow/9 scalar)) - - can_shadow! - (let [pow/3 (function (_ scalar) - (all n.+ scalar scalar scalar))] - (n.= (all n.+ scalar scalar scalar) - (pow/3 scalar)))] - (and can_use_with_expressions! - can_refer! - can_shadow!))) - )))) - )))) diff --git a/stdlib/source/test/lux/macro/pattern.lux b/stdlib/source/test/lux/macro/pattern.lux deleted file mode 100644 index 7b9e161c1..000000000 --- a/stdlib/source/test/lux/macro/pattern.lux +++ /dev/null @@ -1,99 +0,0 @@ -(.require - [library - [lux (.except) - ["_" test (.only Test)] - [abstract - [monad (.only do)]] - [data - ["[0]" bit (.use "[1]#[0]" equivalence)]] - [math - ["[0]" random (.only Random)] - [number - ["n" nat] - ["i" int] - ["f" frac]]] - [meta - ["[0]" code]]]] - [\\library - ["[0]" /]]) - -(type (Pair l r) - (Record - [#left l - #right r])) - -(def !pair - (template (_ ) - [[..#left - ..#right ]])) - -(def .public test - Test - (<| (_.covering /._) - (do [! random.monad] - [expected_nat (at ! each (n.% 1) random.nat) - expected_int (at ! each (i.% +1) random.int) - expected_rev (random.either (in .5) - (in .25)) - expected_frac (random.either (in +0.5) - (in +1.25)) - expected_text (random.either (in "+0.5") - (in "+1.25"))] - (all _.and - (do [! random.monad] - [sample (at ! each (n.% 5) random.nat)] - (_.coverage [/.with_template] - (case sample - (/.with_template [] - [ true]) - ([0] [1] [2] [3] [4]) - - _ - false))) - (_.coverage [/.or] - (and (/.case expected_rev - (/.or .5 .25) true - _ false) - (/.case expected_frac - (/.or +0.5 +1.25) true - _ false) - (/.case expected_text - (/.or "+0.5" "+1.25") true - _ false))) - (_.coverage [/.let] - (let [expected_pair (is (Pair Nat Int) - [..#left expected_nat ..#right expected_int])] - (/.case expected_pair - (/.let actual_pair (/.pattern (!pair actual_left actual_right))) - (and (/.same? expected_pair actual_pair) - (/.same? expected_nat actual_left) - (/.same? expected_int actual_right))))) - (_.coverage [/.multi] - (let [expected_pair (is (Pair Nat Int) - [..#left expected_nat ..#right expected_int])] - (and (/.case expected_pair - (/.multi (/.pattern (!pair 0 actual_right)) - [actual_right - +0]) - true - - _ - false) - (/.case expected_pair - (/.multi (/.pattern (!pair 0 actual_right)) - (i.= +0 actual_right)) - true - - _ - false)))) - (_.coverage [/.|>] - (case expected_frac - (/.|> actual_frac [(f.* +2.0) (f.* +2.0)]) - (f.= (f.* +4.0 expected_frac) - actual_frac))) - (_.coverage [/.`] - (case (code.text expected_text) - (/.` "+0.5") true - (/.` "+1.25") true - _ false)) - )))) diff --git a/stdlib/source/test/lux/macro/syntax.lux b/stdlib/source/test/lux/macro/syntax.lux deleted file mode 100644 index 5c6b392f1..000000000 --- a/stdlib/source/test/lux/macro/syntax.lux +++ /dev/null @@ -1,49 +0,0 @@ -(.require - [library - [lux (.except) - ["_" test (.only Test)] - [abstract - [monad (.only do)]] - [math - ["[0]" random] - [number - ["n" nat]]] - [meta - ["[0]" code - ["<[1]>" \\parser]]]]] - [\\library - ["[0]" /]] - ["[0]" / - ["[1][0]" check] - ["[1][0]" declaration] - ["[1][0]" definition] - ["[1][0]" export] - ["[1][0]" input] - ["[1][0]" type - ["[1]/[0]" variable]]]) - -(def +/3 - (/.syntax (_ [a .any - b .any - c .any]) - (in (list (` (all n.+ (, a) (, b) (, c))))))) - -(def .public test - Test - (<| (_.covering /._) - (all _.and - (do random.monad - [x random.nat - y random.nat - z random.nat] - (_.coverage [/.syntax] - (n.= (all n.+ x y z) - (+/3 x y z)))) - - /check.test - /declaration.test - /definition.test - /export.test - /input.test - /type/variable.test - ))) diff --git a/stdlib/source/test/lux/macro/syntax/check.lux b/stdlib/source/test/lux/macro/syntax/check.lux deleted file mode 100644 index 11fa981e6..000000000 --- a/stdlib/source/test/lux/macro/syntax/check.lux +++ /dev/null @@ -1,49 +0,0 @@ -(.require - [library - [lux (.except) - ["_" test (.only Test)] - [abstract - [monad (.only do)] - [\\specification - ["$[0]" equivalence]]] - [control - ["<>" parser] - ["[0]" try]] - [math - ["[0]" random (.only Random)]] - [meta - ["[0]" code (.use "[1]#[0]" equivalence) - ["<[1]>" \\parser]]]]] - [\\library - ["[0]" /]] - ["$[0]" //// - [meta - ["[1][0]" code]]]) - -(def .public random - (Random /.Check) - (all random.and - $////code.random - $////code.random - )) - -(def .public test - Test - (<| (_.covering /._) - (_.for [/.Check]) - (all _.and - (_.for [/.equivalence] - ($equivalence.spec /.equivalence ..random)) - - (do random.monad - [[type value] ..random] - (_.coverage [/.format /.parser] - (case (.result /.parser - (list (/.format [/.#type type - /.#value value]))) - {try.#Failure _} - false - - {try.#Success check} - (and (code#= type (the /.#type check)) - (code#= value (the /.#value check))))))))) diff --git a/stdlib/source/test/lux/macro/syntax/declaration.lux b/stdlib/source/test/lux/macro/syntax/declaration.lux deleted file mode 100644 index d111576fc..000000000 --- a/stdlib/source/test/lux/macro/syntax/declaration.lux +++ /dev/null @@ -1,49 +0,0 @@ -(.require - [library - [lux (.except) - ["_" test (.only Test)] - [abstract - [monad (.only do)] - [\\specification - ["$[0]" equivalence]]] - [control - ["[0]" try]] - [math - ["[0]" random (.only Random)] - [number - ["n" nat]]]]] - [\\library - ["[0]" / (.only) - [//// - [meta - ["[0]" code - ["<[1]>" \\parser]]]]]]) - -(def .public random - (Random /.Declaration) - (let [word (random.alphabetic 10)] - (all random.and - word - (do [! random.monad] - [size (at ! each (n.% 10) random.nat)] - (random.list size word)) - ))) - -(def .public test - Test - (<| (_.covering /._) - (_.for [/.Declaration]) - (all _.and - (_.for [/.equivalence] - ($equivalence.spec /.equivalence ..random)) - - (do random.monad - [expected ..random] - (_.coverage [/.format /.parser] - (case (.result /.parser - (list (/.format expected))) - {try.#Failure _} - false - - {try.#Success actual} - (at /.equivalence = expected actual))))))) diff --git a/stdlib/source/test/lux/macro/syntax/definition.lux b/stdlib/source/test/lux/macro/syntax/definition.lux deleted file mode 100644 index 0ebf14286..000000000 --- a/stdlib/source/test/lux/macro/syntax/definition.lux +++ /dev/null @@ -1,97 +0,0 @@ -(.require - [library - [lux (.except) - ["_" test (.only Test)] - [abstract - [monad (.only do)] - [\\specification - ["$[0]" equivalence]]] - [control - ["<>" parser] - ["[0]" try] - ["[0]" exception]] - [math - ["[0]" random (.only Random)]] - [meta - ["[0]" location] - ["[0]" code (.use "[1]#[0]" equivalence) - ["<[1]>" \\parser]]]]] - [\\library - ["[0]" /]] - ["$[0]"// - ["[1][0]" check] - ["[1]//" /// - [meta - ["[1][0]" code]]]]) - -(def .public random - (Random /.Definition) - (all random.and - (random.alphabetic 5) - (random.or $//check.random - $////code.random) - random.bit - )) - -(def compiler - [.#info [.#target "FAKE" - .#version "0.0.0" - .#mode {.#Build} - .#configuration (list)] - .#source [location.dummy 0 ""] - .#location location.dummy - .#current_module {.#None} - .#modules (list) - .#scopes (list) - .#type_context [.#ex_counter 0 - .#var_counter 0 - .#var_bindings (list)] - .#expected {.#None} - .#seed 0 - .#scope_type_vars (list) - .#extensions [] - .#eval (as (-> Type Code (Meta Any)) []) - .#host []]) - -(def .public test - Test - (<| (_.covering /._) - (_.for [/.Definition]) - (all _.and - (_.for [/.equivalence] - ($equivalence.spec /.equivalence ..random)) - - (do random.monad - [expected ..random - - type $////code.random - untyped_value $////code.random] - (all _.and - (_.coverage [/.format /.parser] - (case (.result (/.parser compiler) - (list (/.format expected))) - {try.#Failure error} - false - - {try.#Success actual} - (at /.equivalence = expected actual))) - (_.coverage [/.typed] - (let [expected (has /.#value {.#Left [type untyped_value]} expected)] - (case (.result (/.typed compiler) - (list (/.format expected))) - {try.#Failure error} - false - - {try.#Success actual} - (at /.equivalence = expected actual)))) - (_.coverage [/.lacks_type] - (let [expected (has /.#value {.#Right untyped_value} expected)] - (case (.result (/.typed compiler) - (list (/.format expected))) - {try.#Failure error} - (exception.match? /.lacks_type error) - - {try.#Success actual} - false))) - ))) - )) diff --git a/stdlib/source/test/lux/macro/syntax/export.lux b/stdlib/source/test/lux/macro/syntax/export.lux deleted file mode 100644 index bace31485..000000000 --- a/stdlib/source/test/lux/macro/syntax/export.lux +++ /dev/null @@ -1,46 +0,0 @@ -(.require - [library - [lux (.except) - ["_" test (.only Test)] - [abstract - [monad (.only do)]] - [control - ["[0]" maybe] - ["[0]" try (.use "[1]#[0]" functor)]] - [math - ["[0]" random (.only Random)] - [number - ["n" nat]]] - [meta - ["[0]" code (.use "[1]#[0]" equivalence) - ["<[1]>" \\parser]]]]] - [\\library - ["[0]" /]]) - -(def export - (Random [(Maybe Code) Nat]) - (all random.and - (|> random.bit - (at random.monad each code.bit) - random.maybe) - random.nat)) - -(def .public test - Test - (<| (_.covering /._) - (do random.monad - [[expected_export_policy expected_un_exported] ..export] - (_.coverage [/.parser /.default_policy] - (|> (case expected_export_policy - {.#Some expected_export_policy} - (list expected_export_policy (code.nat expected_un_exported)) - - {.#None} - (list (code.nat expected_un_exported))) - (.result (/.parser .nat)) - (try#each (function (_ [actual_export_policy actual_un_exported]) - (|> expected_export_policy - (maybe.else /.default_policy) - (code#= actual_export_policy) - (and (n.= expected_un_exported actual_un_exported))))) - (try.else false)))))) diff --git a/stdlib/source/test/lux/macro/syntax/input.lux b/stdlib/source/test/lux/macro/syntax/input.lux deleted file mode 100644 index 2294518a9..000000000 --- a/stdlib/source/test/lux/macro/syntax/input.lux +++ /dev/null @@ -1,50 +0,0 @@ -(.require - [library - [lux (.except) - ["_" test (.only Test)] - [abstract - [monad (.only do)] - [\\specification - ["$[0]" equivalence]]] - [control - ["[0]" try]] - [data - [collection - ["[0]" list]]] - [math - ["[0]" random (.only Random)] - [number - ["n" nat]]] - [meta - ["[0]" code - ["<[1]>" \\parser]]]]] - [\\library - ["[0]" /]] - ["$[0]" //// - [meta - ["[1][0]" code]]]) - -(def .public random - (Random /.Input) - (all random.and - $////code.random - $////code.random - )) - -(def .public test - Test - (<| (_.covering /._) - (_.for [/.Input]) - (all _.and - (_.for [/.equivalence] - ($equivalence.spec /.equivalence ..random)) - - (do random.monad - [expected ..random] - (_.coverage [/.format /.parser] - (case (.result /.parser (list (/.format (list expected)))) - {try.#Failure _} - false - - {try.#Success actual} - (at (list.equivalence /.equivalence) = (list expected) actual))))))) diff --git a/stdlib/source/test/lux/macro/syntax/type/variable.lux b/stdlib/source/test/lux/macro/syntax/type/variable.lux deleted file mode 100644 index d0c249716..000000000 --- a/stdlib/source/test/lux/macro/syntax/type/variable.lux +++ /dev/null @@ -1,39 +0,0 @@ -(.require - [library - [lux (.except) - ["_" test (.only Test)] - [abstract - [monad (.only do)] - [\\specification - ["$[0]" equivalence]]] - [control - ["[0]" try (.use "[1]#[0]" functor)]] - [math - ["[0]" random (.only Random)]]]] - [\\library - ["[0]" / (.only) - [///// - [meta - ["[0]" code - ["<[1]>" \\parser]]]]]]) - -(def .public random - (Random /.Variable) - (random.alphabetic 10)) - -(def .public test - Test - (<| (_.covering /._) - (_.for [/.Variable]) - (all _.and - (_.for [/.equivalence] - ($equivalence.spec /.equivalence ..random)) - - (do random.monad - [expected ..random] - (_.coverage [/.format /.parser] - (|> (list (/.format expected)) - (.result /.parser) - (try#each (at /.equivalence = expected)) - (try.else false)))) - ))) diff --git a/stdlib/source/test/lux/macro/template.lux b/stdlib/source/test/lux/macro/template.lux deleted file mode 100644 index 1269484f8..000000000 --- a/stdlib/source/test/lux/macro/template.lux +++ /dev/null @@ -1,117 +0,0 @@ -(.require - [library - [lux (.except) - ["_" test (.only Test)] - [abstract - [monad (.only do)]] - [control - ["[0]" try] - ["[0]" exception]] - [data - [collection - ["[0]" list]]] - ["[0]" macro (.only) - [syntax (.only syntax)]] - [math - ["[0]" random (.only Random)] - [number - ["[0]" nat]]] - [meta - ["[0]" code (.only) - ["<[1]>" \\parser]]]]] - [\\library - ["[0]" /]]) - -(/.let [(!pow/2 ) - [(nat.* )]] - (def pow/2 - (-> Nat Nat) - (|>> !pow/2))) - -(def macro_error - (syntax (_ [macro .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 - (<| (_.covering /._) - (do [! random.monad] - [left random.nat - mid random.nat - right random.nat] - (with_expansions [ (these [.5 -4 +3 2 #1 #0 c b "a"]) - ' ".5-4+32#1#0cba" - (these ["a" b c #0 #1 2 +3 -4 .5]) - ' "abc#0#12+3-4.5"] - (all _.and - (_.coverage [/.spliced] - (at (list.equivalence nat.equivalence) = - (list left mid right) - (`` (list (,, (/.spliced [left mid right])))))) - (_.coverage [/.amount] - (case (/.amount [left mid right]) - 3 true - _ false)) - (_.coverage [/.text] - (case (/.text ) - ' true - _ false)) - (_.coverage [/.symbol] - (and (case (`` (symbol (,, (/.symbol )))) - ["" '] true - _ false) - (case (`` (symbol (,, (/.symbol )))) - [' '] true - _ false) - )) - (_.coverage [/.with_locals] - (/.with_locals [var0 var1] - (let [var0 left - var1 right] - (and (nat.= left var0) - (nat.= right var1))))) - (do ! - [scalar random.nat] - (_.coverage [/.let] - (let [can_use_with_statements! - (nat.= (all nat.* scalar scalar) - (..pow/2 scalar))] - (and can_use_with_statements! - (/.let [(pow/3 ) - [(all nat.* )] - - (pow/9 ) - [(pow/3 (pow/3 ))]] - (let [can_use_with_expressions! - (nat.= (all nat.* scalar scalar scalar) - (pow/3 scalar)) - - can_refer! - (nat.= (all nat.* - scalar scalar scalar - scalar scalar scalar - scalar scalar scalar) - (pow/9 scalar)) - - can_shadow! - (let [pow/3 (function (_ scalar) - (all nat.+ scalar scalar scalar))] - (nat.= (all nat.+ scalar scalar scalar) - (pow/3 scalar)))] - (and can_use_with_expressions! - can_refer! - can_shadow!))) - )))) - (_.coverage [/.irregular_arguments] - (/.let [(arity/3 <0> <1> <2>) - [""]] - (exception.match? /.irregular_arguments - (macro_error (arity/3 "a" "b"))))) - ))) - )) diff --git a/stdlib/source/test/lux/math.lux b/stdlib/source/test/lux/math.lux index 382b84009..251e3e9ad 100644 --- a/stdlib/source/test/lux/math.lux +++ b/stdlib/source/test/lux/math.lux @@ -6,8 +6,6 @@ [monad (.only do)]] [data ["[0]" bit (.use "[1]#[0]" equivalence)]] - [macro - ["[0]" template]] [math ["[0]" random (.only Random)] [number @@ -16,7 +14,10 @@ ["r" rev] ["f" frac] ["[0]" ratio (.only Ratio)] - ["[0]" complex (.only Complex)]]]]] + ["[0]" complex (.only Complex)]]] + [meta + [macro + ["[0]" template]]]]] [\\library ["[0]" /]] ["[0]" / diff --git a/stdlib/source/test/lux/math/modulus.lux b/stdlib/source/test/lux/math/modulus.lux index 98c4480d2..021bd0758 100644 --- a/stdlib/source/test/lux/math/modulus.lux +++ b/stdlib/source/test/lux/math/modulus.lux @@ -11,10 +11,10 @@ ["[0]" random (.only Random)] [number ["i" int]]] - [macro - [syntax (.only syntax)]] ["[0]" meta (.only) - ["[0]" code]]]] + ["[0]" code] + [macro + [syntax (.only syntax)]]]]] [\\library ["[0]" /]]) diff --git a/stdlib/source/test/lux/math/number/frac.lux b/stdlib/source/test/lux/math/number/frac.lux index adefb43e7..bf89cddbd 100644 --- a/stdlib/source/test/lux/math/number/frac.lux +++ b/stdlib/source/test/lux/math/number/frac.lux @@ -14,10 +14,11 @@ ["$[0]" codec]]] [data ["[0]" bit (.use "[1]#[0]" equivalence)]] - [macro - ["[0]" template]] [math - ["[0]" random (.only Random)]]]] + ["[0]" random (.only Random)]] + [meta + [macro + ["[0]" template]]]]] [\\library ["[0]" / (.only) [// (.except) diff --git a/stdlib/source/test/lux/meta.lux b/stdlib/source/test/lux/meta.lux index 2c2943c19..5cd2da267 100644 --- a/stdlib/source/test/lux/meta.lux +++ b/stdlib/source/test/lux/meta.lux @@ -20,15 +20,15 @@ [collection ["[0]" list (.use "[1]#[0]" functor monoid)] ["[0]" set]]] - [macro - ["^" pattern]] [math ["[0]" random (.only Random)] [number ["n" nat]]] [meta ["[0]" location] - ["[0]" symbol (.use "[1]#[0]" equivalence)]]]] + ["[0]" symbol (.use "[1]#[0]" equivalence)] + [macro + ["^" pattern]]]]] [\\library ["[0]" / (.only) ["[0]" type (.use "[1]#[0]" equivalence)]]] @@ -38,7 +38,8 @@ ["[1][0]" symbol] ["[1][0]" configuration] ["[1][0]" version] - ["[1][0]" type]]) + ["[1][0]" type] + ["[1][0]" macro]]) (def !expect (template (_ ) @@ -1024,4 +1025,5 @@ /configuration.test /version.test /type.test + /macro.test ))) diff --git a/stdlib/source/test/lux/meta/code.lux b/stdlib/source/test/lux/meta/code.lux index 49db56a18..65d848f76 100644 --- a/stdlib/source/test/lux/meta/code.lux +++ b/stdlib/source/test/lux/meta/code.lux @@ -16,8 +16,6 @@ ["[0]" text] [collection ["[0]" list (.use "[1]#[0]" functor)]]] - [macro - ["^" pattern]] [math ["[0]" random (.only Random) (.use "[1]#[0]" monad)] [number @@ -27,7 +25,9 @@ ["[0]" frac]]] [meta ["[0]" symbol] - ["[0]" location]] + ["[0]" location] + [macro + ["^" pattern]]] [tool [compiler [language diff --git a/stdlib/source/test/lux/meta/configuration.lux b/stdlib/source/test/lux/meta/configuration.lux index 141d7ed96..0630f5186 100644 --- a/stdlib/source/test/lux/meta/configuration.lux +++ b/stdlib/source/test/lux/meta/configuration.lux @@ -16,13 +16,13 @@ ["<[1]>" \\parser]] [collection ["[0]" list]]] - ["[0]" macro (.only) - [syntax (.only syntax)]] [math ["[0]" random (.only Random) (.use "[1]#[0]" monad)]] ["[0]" meta (.only) ["[0]" code (.only) - ["<[1]>" \\parser]]]]] + ["<[1]>" \\parser]] + ["[0]" macro (.only) + [syntax (.only syntax)]]]]] [\\library ["[0]" /]]) diff --git a/stdlib/source/test/lux/meta/macro.lux b/stdlib/source/test/lux/meta/macro.lux new file mode 100644 index 000000000..d128a74be --- /dev/null +++ b/stdlib/source/test/lux/meta/macro.lux @@ -0,0 +1,250 @@ +(.require + [library + [lux (.except) + ["_" test (.only Test)] + ["[0]" static] + [abstract + [monad (.only do)]] + [control + ["[0]" try (.use "[1]#[0]" functor)]] + [data + ["[0]" bit (.use "[1]#[0]" equivalence)] + ["[0]" text (.only) + ["%" \\format (.only format)]] + [collection + ["[0]" list]]] + [math + ["[0]" random (.only Random) (.use "[1]#[0]" functor)] + [number + ["n" nat]]] + ["[0]" meta (.only) + ["[0]" location] + ["[0]" symbol] + ["[0]" code (.use "[1]#[0]" equivalence) + ["<[1]>" \\parser]] + [macro + ["^" pattern]]]]] + [\\library + ["[0]" / (.only) + [syntax (.only syntax)] + ["[0]" template]]] + ["[0]" / + ["[1][0]" local] + ["[1][0]" syntax] + ["[1][0]" template] + ["[1][0]" pattern] + ["[1][0]" context]]) + +(def !expect + (template (_ ) + [(case + true + _ false)])) + +(def !global + (template (_ ) + [(is [Text .Global] + [(template.text []) {.#Definition [true .Macro ]}])])) + +(def pow/2 + (syntax (_ [number .any]) + (in (list (` (n.* (, number) (, number))))))) + +(def pow/4 + (syntax (_ [number .any]) + (in (list (` (..pow/2 (..pow/2 (, number)))))))) + +(def repeated + (syntax (_ [times .nat + token .any]) + (in (list.repeated times token)))) + +(def fresh_symbol + (syntax (_ []) + (do meta.monad + [g!fresh (/.symbol "fresh")] + (in (list g!fresh))))) + +(def random_lux + (Random [Nat Text .Lux]) + (do [! random.monad] + [seed random.nat + symbol_prefix (random.upper_case 1) + .let [macro_module (symbol.module (symbol /._)) + current_module (symbol.module (symbol .._))]] + (in [seed + symbol_prefix + [.#info [.#target "" + .#version "" + .#mode {.#Build} + .#configuration (list)] + .#source [location.dummy 0 ""] + .#location location.dummy + .#current_module {.#Some current_module} + .#modules (list [macro_module + [.#module_hash 0 + .#module_aliases (list) + .#definitions (is (List [Text .Global]) + (list (!global /.log_single_expansion!) + (!global /.log_expansion!) + (!global /.log_full_expansion!))) + .#imports (list) + .#module_state {.#Active}]] + [current_module + [.#module_hash 0 + .#module_aliases (list) + .#definitions (is (List [Text .Global]) + (list (!global ..pow/2) + (!global ..pow/4) + (!global ..repeated))) + .#imports (list) + .#module_state {.#Active}]]) + .#scopes (list) + .#type_context [.#ex_counter 0 + .#var_counter 0 + .#var_bindings (list)] + .#expected {.#None} + .#seed seed + .#scope_type_vars (list) + .#extensions [] + .#eval (as (-> Type Code (Meta Any)) []) + .#host []]]))) + +(def iterated + (syntax (_ [cycle .nat + it .any]) + (in (list (case cycle + 0 it + _ (` (..iterated (, (code.nat (-- cycle))) (, it)))))))) + +(def test|expansion + Test + (do [! random.monad] + [[seed symbol_prefix lux] ..random_lux + + pow/1 (at ! each code.nat random.nat) + + repetitions (at ! each (n.% 10) random.nat) + .let [single_expansion (` (..pow/2 (..pow/2 (, pow/1)))) + expansion (` (n.* (..pow/2 (, pow/1)) + (..pow/2 (, pow/1)))) + full_expansion (` (n.* (n.* (, pow/1) (, pow/1)) + (n.* (, pow/1) (, pow/1))))]] + (`` (all _.and + (,, (with_template [ ] + [(_.coverage [] + (|> ( (` (..pow/4 (, pow/1)))) + (meta.result lux) + (try#each (at (list.equivalence code.equivalence) = + (list ))) + (try.else false))) + + (_.coverage [] + (and (|> (/.single_expansion (` ( "omit" (..pow/4 (, pow/1))))) + (meta.result lux) + (try#each (at (list.equivalence code.equivalence) = (list))) + (try.else false)) + (|> (/.single_expansion (` ( (..pow/4 (, pow/1))))) + (meta.result lux) + (try#each (at (list.equivalence code.equivalence) = (list ))) + (try.else false))))] + + [/.single_expansion /.log_single_expansion! single_expansion] + [/.expansion /.log_expansion! expansion] + [/.full_expansion /.log_full_expansion! full_expansion] + )) + (_.coverage [/.one_expansion] + (bit#= (not (n.= 1 repetitions)) + (|> (/.one_expansion (` (..repeated (, (code.nat repetitions)) (, pow/1)))) + (meta.result lux) + (!expect {try.#Failure _})))) + (_.coverage [/.final] + (with_expansions [ (static.random_nat) + (static.random code.nat + (random#each (|>> (n.% 5) ++) random.nat)) + (/.final (..iterated ))] + (case (' ) + [_ {.#Nat actual}] + (n.= actual) + + _ + false))) + (_.coverage [/.times] + (with_expansions [ (static.random_nat) + (static.random code.nat + (random#each (|>> (n.% 10) (n.+ 2)) random.nat)) + (static.random code.nat + (random#each (|>> (n.% ) ++) random.nat)) + (/.times (..iterated ))] + (let [expected_remaining (n.- )] + (case (` ) + (^.` (..iterated (, [_ {.#Nat actual_remaining}]) (, [_ {.#Nat actual}]))) + (and (n.= expected_remaining actual_remaining) + (n.= actual)) + + _ + false)))) + )))) + +(def sum + (macro (_ tokens) + (loop (again [tokens tokens + output 0]) + (case tokens + {.#End} + (at meta.monad in (list (code.nat output))) + + {.#Item [_ {.#Nat head}] tail} + (again tail (n.+ head output)) + + _ + (meta.failure ""))))) + +(def sum' + (macro (_ tokens lux) + ((/.function ..sum) tokens lux))) + +(def .public test + Test + (<| (_.covering /._) + (all _.and + (do [! random.monad] + [[seed symbol_prefix lux] ..random_lux] + (all _.and + (_.coverage [/.symbol] + (|> (/.symbol symbol_prefix) + (at meta.monad each %.code) + (meta.result lux) + (!expect (^.multi {try.#Success actual_symbol} + (and (text.contains? symbol_prefix actual_symbol) + (text.contains? (%.nat seed) actual_symbol)))))) + (_.coverage [/.wrong_syntax_error] + (|> (/.single_expansion (` (/.log_single_expansion!))) + (meta.result lux) + (!expect (^.multi {try.#Failure error} + (text.contains? (/.wrong_syntax_error (symbol /.log_single_expansion!)) + error))))) + (_.coverage [/.with_symbols] + (with_expansions [ (fresh_symbol)] + (|> (/.with_symbols [] + (at meta.monad in )) + (meta.result lux) + (!expect (^.multi {try.#Success [_ {.#Symbol ["" actual]}]} + (text.contains? (template.text []) + actual)))))) + (_.coverage [/.function] + (with_expansions [n/0 (static.random_nat) + n/1 (static.random_nat) + n/1 (static.random_nat)] + (n.= (..sum n/0 n/1 n/1) + (..sum' n/0 n/1 n/1)))) + )) + + ..test|expansion + + /local.test + /syntax.test + /template.test + /pattern.test + /context.test + ))) diff --git a/stdlib/source/test/lux/meta/macro/context.lux b/stdlib/source/test/lux/meta/macro/context.lux new file mode 100644 index 000000000..52df97710 --- /dev/null +++ b/stdlib/source/test/lux/meta/macro/context.lux @@ -0,0 +1,12 @@ +(.require + [library + [lux (.except) + ["_" test (.only Test)]]] + [\\library + ["[0]" /]]) + +(def .public test + Test + (<| (_.covering /._) + (_.property "TBD" false) + )) diff --git a/stdlib/source/test/lux/meta/macro/local.lux b/stdlib/source/test/lux/meta/macro/local.lux new file mode 100644 index 000000000..1aa793639 --- /dev/null +++ b/stdlib/source/test/lux/meta/macro/local.lux @@ -0,0 +1,130 @@ +(.require + [library + [lux (.except with) + ["_" test (.only Test)] + [abstract + [monad (.only do)]] + [control + ["<>" parser] + ["[0]" try] + ["[0]" exception]] + [data + [text + ["%" \\format]] + [collection + ["[0]" list + ["[0]" property]]]] + [math + ["[0]" random (.only Random)] + [number + ["n" nat]]] + ["[0]" meta (.only) + ["[0]" code (.only) + ["<[1]>" \\parser]] + ["[0]" macro (.only) + [syntax (.only syntax)]]]]] + [\\library + ["[0]" /]]) + +(/.let [!pow/2 (template (_ ) + [(n.* )])] + (def pow/2 + (-> Nat Nat) + (|>> !pow/2))) + +(def macro_error + (syntax (_ [macro .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) + ("lux macro" + (function (_ inputs lux) + {try.#Success [lux (list output)]}))) + +(def with + (syntax (_ [name (.tuple (<>.and .text .text)) + constant .any + pre_remove .bit + body .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 (property.lacks short)))] + (function (_ lux) + {try.#Success [(revised .#modules (property.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 + (<| (_.covering /._) + (do [! random.monad] + [expected random.nat] + (all _.and + (_.coverage [/.push] + (..with ["" "actual"] expected #0 + (n.= expected (..actual)))) + (_.coverage [/.unknown_module] + (exception.match? /.unknown_module + (..macro_error + (..with ["123yolo456" "actual"] expected #0 + (n.= expected (..actual)))))) + (_.coverage [/.cannot_shadow_definition] + (exception.match? /.cannot_shadow_definition + (..macro_error + (..with ["" "with"] expected #0 + (n.= expected (..actual)))))) + (_.coverage [/.unknown_definition] + (exception.match? /.unknown_definition + (<| ..macro_error + (..with ["" "actual"] expected #1) + (n.= expected (..actual))))) + (do ! + [scalar random.nat] + (_.coverage [/.let] + (let [can_use_with_statements! + (n.= (all n.* scalar scalar) + (..pow/2 scalar))] + (and can_use_with_statements! + (/.let [pow/3 (template (_ ) + [(all n.* )]) + pow/9 (template (_ ) + [(pow/3 (pow/3 ))])] + (let [can_use_with_expressions! + (n.= (all n.* scalar scalar scalar) + (pow/3 scalar)) + + can_refer! + (n.= (all n.* + scalar scalar scalar + scalar scalar scalar + scalar scalar scalar) + (pow/9 scalar)) + + can_shadow! + (let [pow/3 (function (_ scalar) + (all n.+ scalar scalar scalar))] + (n.= (all n.+ scalar scalar scalar) + (pow/3 scalar)))] + (and can_use_with_expressions! + can_refer! + can_shadow!))) + )))) + )))) diff --git a/stdlib/source/test/lux/meta/macro/pattern.lux b/stdlib/source/test/lux/meta/macro/pattern.lux new file mode 100644 index 000000000..7b9e161c1 --- /dev/null +++ b/stdlib/source/test/lux/meta/macro/pattern.lux @@ -0,0 +1,99 @@ +(.require + [library + [lux (.except) + ["_" test (.only Test)] + [abstract + [monad (.only do)]] + [data + ["[0]" bit (.use "[1]#[0]" equivalence)]] + [math + ["[0]" random (.only Random)] + [number + ["n" nat] + ["i" int] + ["f" frac]]] + [meta + ["[0]" code]]]] + [\\library + ["[0]" /]]) + +(type (Pair l r) + (Record + [#left l + #right r])) + +(def !pair + (template (_ ) + [[..#left + ..#right ]])) + +(def .public test + Test + (<| (_.covering /._) + (do [! random.monad] + [expected_nat (at ! each (n.% 1) random.nat) + expected_int (at ! each (i.% +1) random.int) + expected_rev (random.either (in .5) + (in .25)) + expected_frac (random.either (in +0.5) + (in +1.25)) + expected_text (random.either (in "+0.5") + (in "+1.25"))] + (all _.and + (do [! random.monad] + [sample (at ! each (n.% 5) random.nat)] + (_.coverage [/.with_template] + (case sample + (/.with_template [] + [ true]) + ([0] [1] [2] [3] [4]) + + _ + false))) + (_.coverage [/.or] + (and (/.case expected_rev + (/.or .5 .25) true + _ false) + (/.case expected_frac + (/.or +0.5 +1.25) true + _ false) + (/.case expected_text + (/.or "+0.5" "+1.25") true + _ false))) + (_.coverage [/.let] + (let [expected_pair (is (Pair Nat Int) + [..#left expected_nat ..#right expected_int])] + (/.case expected_pair + (/.let actual_pair (/.pattern (!pair actual_left actual_right))) + (and (/.same? expected_pair actual_pair) + (/.same? expected_nat actual_left) + (/.same? expected_int actual_right))))) + (_.coverage [/.multi] + (let [expected_pair (is (Pair Nat Int) + [..#left expected_nat ..#right expected_int])] + (and (/.case expected_pair + (/.multi (/.pattern (!pair 0 actual_right)) + [actual_right + +0]) + true + + _ + false) + (/.case expected_pair + (/.multi (/.pattern (!pair 0 actual_right)) + (i.= +0 actual_right)) + true + + _ + false)))) + (_.coverage [/.|>] + (case expected_frac + (/.|> actual_frac [(f.* +2.0) (f.* +2.0)]) + (f.= (f.* +4.0 expected_frac) + actual_frac))) + (_.coverage [/.`] + (case (code.text expected_text) + (/.` "+0.5") true + (/.` "+1.25") true + _ false)) + )))) diff --git a/stdlib/source/test/lux/meta/macro/syntax.lux b/stdlib/source/test/lux/meta/macro/syntax.lux new file mode 100644 index 000000000..5c6b392f1 --- /dev/null +++ b/stdlib/source/test/lux/meta/macro/syntax.lux @@ -0,0 +1,49 @@ +(.require + [library + [lux (.except) + ["_" test (.only Test)] + [abstract + [monad (.only do)]] + [math + ["[0]" random] + [number + ["n" nat]]] + [meta + ["[0]" code + ["<[1]>" \\parser]]]]] + [\\library + ["[0]" /]] + ["[0]" / + ["[1][0]" check] + ["[1][0]" declaration] + ["[1][0]" definition] + ["[1][0]" export] + ["[1][0]" input] + ["[1][0]" type + ["[1]/[0]" variable]]]) + +(def +/3 + (/.syntax (_ [a .any + b .any + c .any]) + (in (list (` (all n.+ (, a) (, b) (, c))))))) + +(def .public test + Test + (<| (_.covering /._) + (all _.and + (do random.monad + [x random.nat + y random.nat + z random.nat] + (_.coverage [/.syntax] + (n.= (all n.+ x y z) + (+/3 x y z)))) + + /check.test + /declaration.test + /definition.test + /export.test + /input.test + /type/variable.test + ))) diff --git a/stdlib/source/test/lux/meta/macro/syntax/check.lux b/stdlib/source/test/lux/meta/macro/syntax/check.lux new file mode 100644 index 000000000..1820536b8 --- /dev/null +++ b/stdlib/source/test/lux/meta/macro/syntax/check.lux @@ -0,0 +1,48 @@ +(.require + [library + [lux (.except) + ["_" test (.only Test)] + [abstract + [monad (.only do)] + [\\specification + ["$[0]" equivalence]]] + [control + ["<>" parser] + ["[0]" try]] + [math + ["[0]" random (.only Random)]] + [meta + ["[0]" code (.use "[1]#[0]" equivalence) + ["<[1]>" \\parser]]]]] + [\\library + ["[0]" /]] + ["$[0]" //// + ["[1][0]" code]]) + +(def .public random + (Random /.Check) + (all random.and + $////code.random + $////code.random + )) + +(def .public test + Test + (<| (_.covering /._) + (_.for [/.Check]) + (all _.and + (_.for [/.equivalence] + ($equivalence.spec /.equivalence ..random)) + + (do random.monad + [[type value] ..random] + (_.coverage [/.format /.parser] + (case (.result /.parser + (list (/.format [/.#type type + /.#value value]))) + {try.#Failure _} + false + + {try.#Success check} + (and (code#= type (the /.#type check)) + (code#= value (the /.#value check))))))))) diff --git a/stdlib/source/test/lux/meta/macro/syntax/declaration.lux b/stdlib/source/test/lux/meta/macro/syntax/declaration.lux new file mode 100644 index 000000000..d81a44ac3 --- /dev/null +++ b/stdlib/source/test/lux/meta/macro/syntax/declaration.lux @@ -0,0 +1,48 @@ +(.require + [library + [lux (.except) + ["_" test (.only Test)] + [abstract + [monad (.only do)] + [\\specification + ["$[0]" equivalence]]] + [control + ["[0]" try]] + [math + ["[0]" random (.only Random)] + [number + ["n" nat]]]]] + [\\library + ["[0]" / (.only) + [//// + ["[0]" code + ["<[1]>" \\parser]]]]]) + +(def .public random + (Random /.Declaration) + (let [word (random.alphabetic 10)] + (all random.and + word + (do [! random.monad] + [size (at ! each (n.% 10) random.nat)] + (random.list size word)) + ))) + +(def .public test + Test + (<| (_.covering /._) + (_.for [/.Declaration]) + (all _.and + (_.for [/.equivalence] + ($equivalence.spec /.equivalence ..random)) + + (do random.monad + [expected ..random] + (_.coverage [/.format /.parser] + (case (.result /.parser + (list (/.format expected))) + {try.#Failure _} + false + + {try.#Success actual} + (at /.equivalence = expected actual))))))) diff --git a/stdlib/source/test/lux/meta/macro/syntax/definition.lux b/stdlib/source/test/lux/meta/macro/syntax/definition.lux new file mode 100644 index 000000000..878cc8ee9 --- /dev/null +++ b/stdlib/source/test/lux/meta/macro/syntax/definition.lux @@ -0,0 +1,96 @@ +(.require + [library + [lux (.except) + ["_" test (.only Test)] + [abstract + [monad (.only do)] + [\\specification + ["$[0]" equivalence]]] + [control + ["<>" parser] + ["[0]" try] + ["[0]" exception]] + [math + ["[0]" random (.only Random)]] + [meta + ["[0]" location] + ["[0]" code (.use "[1]#[0]" equivalence) + ["<[1]>" \\parser]]]]] + [\\library + ["[0]" /]] + ["$[0]"// + ["[1][0]" check] + ["[1]//" /// + ["[1][0]" code]]]) + +(def .public random + (Random /.Definition) + (all random.and + (random.alphabetic 5) + (random.or $//check.random + $////code.random) + random.bit + )) + +(def compiler + [.#info [.#target "FAKE" + .#version "0.0.0" + .#mode {.#Build} + .#configuration (list)] + .#source [location.dummy 0 ""] + .#location location.dummy + .#current_module {.#None} + .#modules (list) + .#scopes (list) + .#type_context [.#ex_counter 0 + .#var_counter 0 + .#var_bindings (list)] + .#expected {.#None} + .#seed 0 + .#scope_type_vars (list) + .#extensions [] + .#eval (as (-> Type Code (Meta Any)) []) + .#host []]) + +(def .public test + Test + (<| (_.covering /._) + (_.for [/.Definition]) + (all _.and + (_.for [/.equivalence] + ($equivalence.spec /.equivalence ..random)) + + (do random.monad + [expected ..random + + type $////code.random + untyped_value $////code.random] + (all _.and + (_.coverage [/.format /.parser] + (case (.result (/.parser compiler) + (list (/.format expected))) + {try.#Failure error} + false + + {try.#Success actual} + (at /.equivalence = expected actual))) + (_.coverage [/.typed] + (let [expected (has /.#value {.#Left [type untyped_value]} expected)] + (case (.result (/.typed compiler) + (list (/.format expected))) + {try.#Failure error} + false + + {try.#Success actual} + (at /.equivalence = expected actual)))) + (_.coverage [/.lacks_type] + (let [expected (has /.#value {.#Right untyped_value} expected)] + (case (.result (/.typed compiler) + (list (/.format expected))) + {try.#Failure error} + (exception.match? /.lacks_type error) + + {try.#Success actual} + false))) + ))) + )) diff --git a/stdlib/source/test/lux/meta/macro/syntax/export.lux b/stdlib/source/test/lux/meta/macro/syntax/export.lux new file mode 100644 index 000000000..bace31485 --- /dev/null +++ b/stdlib/source/test/lux/meta/macro/syntax/export.lux @@ -0,0 +1,46 @@ +(.require + [library + [lux (.except) + ["_" test (.only Test)] + [abstract + [monad (.only do)]] + [control + ["[0]" maybe] + ["[0]" try (.use "[1]#[0]" functor)]] + [math + ["[0]" random (.only Random)] + [number + ["n" nat]]] + [meta + ["[0]" code (.use "[1]#[0]" equivalence) + ["<[1]>" \\parser]]]]] + [\\library + ["[0]" /]]) + +(def export + (Random [(Maybe Code) Nat]) + (all random.and + (|> random.bit + (at random.monad each code.bit) + random.maybe) + random.nat)) + +(def .public test + Test + (<| (_.covering /._) + (do random.monad + [[expected_export_policy expected_un_exported] ..export] + (_.coverage [/.parser /.default_policy] + (|> (case expected_export_policy + {.#Some expected_export_policy} + (list expected_export_policy (code.nat expected_un_exported)) + + {.#None} + (list (code.nat expected_un_exported))) + (.result (/.parser .nat)) + (try#each (function (_ [actual_export_policy actual_un_exported]) + (|> expected_export_policy + (maybe.else /.default_policy) + (code#= actual_export_policy) + (and (n.= expected_un_exported actual_un_exported))))) + (try.else false)))))) diff --git a/stdlib/source/test/lux/meta/macro/syntax/input.lux b/stdlib/source/test/lux/meta/macro/syntax/input.lux new file mode 100644 index 000000000..49ae69f1c --- /dev/null +++ b/stdlib/source/test/lux/meta/macro/syntax/input.lux @@ -0,0 +1,49 @@ +(.require + [library + [lux (.except) + ["_" test (.only Test)] + [abstract + [monad (.only do)] + [\\specification + ["$[0]" equivalence]]] + [control + ["[0]" try]] + [data + [collection + ["[0]" list]]] + [math + ["[0]" random (.only Random)] + [number + ["n" nat]]] + [meta + ["[0]" code + ["<[1]>" \\parser]]]]] + [\\library + ["[0]" /]] + ["$[0]" //// + ["[1][0]" code]]) + +(def .public random + (Random /.Input) + (all random.and + $////code.random + $////code.random + )) + +(def .public test + Test + (<| (_.covering /._) + (_.for [/.Input]) + (all _.and + (_.for [/.equivalence] + ($equivalence.spec /.equivalence ..random)) + + (do random.monad + [expected ..random] + (_.coverage [/.format /.parser] + (case (.result /.parser (list (/.format (list expected)))) + {try.#Failure _} + false + + {try.#Success actual} + (at (list.equivalence /.equivalence) = (list expected) actual))))))) diff --git a/stdlib/source/test/lux/meta/macro/syntax/type/variable.lux b/stdlib/source/test/lux/meta/macro/syntax/type/variable.lux new file mode 100644 index 000000000..c0c2c146d --- /dev/null +++ b/stdlib/source/test/lux/meta/macro/syntax/type/variable.lux @@ -0,0 +1,38 @@ +(.require + [library + [lux (.except) + ["_" test (.only Test)] + [abstract + [monad (.only do)] + [\\specification + ["$[0]" equivalence]]] + [control + ["[0]" try (.use "[1]#[0]" functor)]] + [math + ["[0]" random (.only Random)]]]] + [\\library + ["[0]" / (.only) + [///// + ["[0]" code + ["<[1]>" \\parser]]]]]) + +(def .public random + (Random /.Variable) + (random.alphabetic 10)) + +(def .public test + Test + (<| (_.covering /._) + (_.for [/.Variable]) + (all _.and + (_.for [/.equivalence] + ($equivalence.spec /.equivalence ..random)) + + (do random.monad + [expected ..random] + (_.coverage [/.format /.parser] + (|> (list (/.format expected)) + (.result /.parser) + (try#each (at /.equivalence = expected)) + (try.else false)))) + ))) diff --git a/stdlib/source/test/lux/meta/macro/template.lux b/stdlib/source/test/lux/meta/macro/template.lux new file mode 100644 index 000000000..d2952d268 --- /dev/null +++ b/stdlib/source/test/lux/meta/macro/template.lux @@ -0,0 +1,117 @@ +(.require + [library + [lux (.except) + ["_" test (.only Test)] + [abstract + [monad (.only do)]] + [control + ["[0]" try] + ["[0]" exception]] + [data + [collection + ["[0]" list]]] + [math + ["[0]" random (.only Random)] + [number + ["[0]" nat]]] + [meta + ["[0]" code (.only) + ["<[1]>" \\parser]] + ["[0]" macro (.only) + [syntax (.only syntax)]]]]] + [\\library + ["[0]" /]]) + +(/.let [(!pow/2 ) + [(nat.* )]] + (def pow/2 + (-> Nat Nat) + (|>> !pow/2))) + +(def macro_error + (syntax (_ [macro .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 + (<| (_.covering /._) + (do [! random.monad] + [left random.nat + mid random.nat + right random.nat] + (with_expansions [ (these [.5 -4 +3 2 #1 #0 c b "a"]) + ' ".5-4+32#1#0cba" + (these ["a" b c #0 #1 2 +3 -4 .5]) + ' "abc#0#12+3-4.5"] + (all _.and + (_.coverage [/.spliced] + (at (list.equivalence nat.equivalence) = + (list left mid right) + (`` (list (,, (/.spliced [left mid right])))))) + (_.coverage [/.amount] + (case (/.amount [left mid right]) + 3 true + _ false)) + (_.coverage [/.text] + (case (/.text ) + ' true + _ false)) + (_.coverage [/.symbol] + (and (case (`` (symbol (,, (/.symbol )))) + ["" '] true + _ false) + (case (`` (symbol (,, (/.symbol )))) + [' '] true + _ false) + )) + (_.coverage [/.with_locals] + (/.with_locals [var0 var1] + (let [var0 left + var1 right] + (and (nat.= left var0) + (nat.= right var1))))) + (do ! + [scalar random.nat] + (_.coverage [/.let] + (let [can_use_with_statements! + (nat.= (all nat.* scalar scalar) + (..pow/2 scalar))] + (and can_use_with_statements! + (/.let [(pow/3 ) + [(all nat.* )] + + (pow/9 ) + [(pow/3 (pow/3 ))]] + (let [can_use_with_expressions! + (nat.= (all nat.* scalar scalar scalar) + (pow/3 scalar)) + + can_refer! + (nat.= (all nat.* + scalar scalar scalar + scalar scalar scalar + scalar scalar scalar) + (pow/9 scalar)) + + can_shadow! + (let [pow/3 (function (_ scalar) + (all nat.+ scalar scalar scalar))] + (nat.= (all nat.+ scalar scalar scalar) + (pow/3 scalar)))] + (and can_use_with_expressions! + can_refer! + can_shadow!))) + )))) + (_.coverage [/.irregular_arguments] + (/.let [(arity/3 <0> <1> <2>) + [""]] + (exception.match? /.irregular_arguments + (macro_error (arity/3 "a" "b"))))) + ))) + )) diff --git a/stdlib/source/test/lux/meta/symbol.lux b/stdlib/source/test/lux/meta/symbol.lux index f7825cfe8..8644c6057 100644 --- a/stdlib/source/test/lux/meta/symbol.lux +++ b/stdlib/source/test/lux/meta/symbol.lux @@ -11,12 +11,13 @@ ["$[0]" codec]]] [data ["[0]" text]] - [macro - ["^" pattern]] [math ["[0]" random (.only Random)] [number - ["n" nat]]]]] + ["n" nat]]] + [meta + [macro + ["^" pattern]]]]] [\\library ["[0]" /]]) diff --git a/stdlib/source/test/lux/meta/type.lux b/stdlib/source/test/lux/meta/type.lux index 86359c7de..d00adca34 100644 --- a/stdlib/source/test/lux/meta/type.lux +++ b/stdlib/source/test/lux/meta/type.lux @@ -19,15 +19,15 @@ [collection ["[0]" list] ["[0]" array]]] - [macro - ["^" pattern]] [math ["[0]" random (.only Random) (.use "[1]#[0]" monad)] [number ["n" nat]]] [meta ["[0]" symbol (.use "[1]#[0]" equivalence)] - ["[0]" code (.use "[1]#[0]" equivalence)]]]] + ["[0]" code (.use "[1]#[0]" equivalence)] + [macro + ["^" pattern]]]]] ["[0]" \\parser] [\\library ["[0]" / (.use "[1]#[0]" equivalence)]] diff --git a/stdlib/source/test/lux/meta/type/check.lux b/stdlib/source/test/lux/meta/type/check.lux index d568d5b76..a8d6bfb34 100644 --- a/stdlib/source/test/lux/meta/type/check.lux +++ b/stdlib/source/test/lux/meta/type/check.lux @@ -21,12 +21,13 @@ [collection ["[0]" list (.use "[1]#[0]" functor monoid)] ["[0]" set]]] - [macro - ["^" pattern]] [math ["[0]" random (.only Random) (.use "[1]#[0]" monad)] [number - ["n" nat]]]]] + ["n" nat]]] + [meta + [macro + ["^" pattern]]]]] [\\library ["[0]" / (.only) ["/[1]" // (.use "[1]#[0]" equivalence)]]]) diff --git a/stdlib/source/test/lux/meta/type/primitive.lux b/stdlib/source/test/lux/meta/type/primitive.lux index 8766f07c2..899c0d75b 100644 --- a/stdlib/source/test/lux/meta/type/primitive.lux +++ b/stdlib/source/test/lux/meta/type/primitive.lux @@ -9,16 +9,16 @@ ["[0]" exception]] [data ["[0]" text (.use "[1]#[0]" equivalence)]] - ["[0]" macro (.only) - [syntax (.only syntax)] - ["[0]" template]] ["[0]" math (.only) ["[0]" random] [number ["n" nat]]] ["[0]" meta (.only) ["[0]" code (.only) - ["<[1]>" \\parser]]]]] + ["<[1]>" \\parser]] + ["[0]" macro (.only) + [syntax (.only syntax)] + ["[0]" template]]]]] [\\library ["[0]" /]]) diff --git a/stdlib/source/test/lux/meta/type/resource.lux b/stdlib/source/test/lux/meta/type/resource.lux index 00bb863c3..34a3bc422 100644 --- a/stdlib/source/test/lux/meta/type/resource.lux +++ b/stdlib/source/test/lux/meta/type/resource.lux @@ -15,13 +15,13 @@ ["[0]" identity (.only Identity)] ["[0]" text (.use "[1]#[0]" equivalence) ["%" \\format (.only format)]]] - ["[0]" macro (.only) - [syntax (.only syntax)]] [math ["[0]" random]] ["[0]" meta (.only) ["[0]" code (.only) - ["<[1]>" \\parser]]]]] + ["<[1]>" \\parser]] + ["[0]" macro (.only) + [syntax (.only syntax)]]]]] [\\library ["[0]" / (.only Res)]]) diff --git a/stdlib/source/test/lux/meta/type/unit/scale.lux b/stdlib/source/test/lux/meta/type/unit/scale.lux index 15b5dab9a..6a4a8c625 100644 --- a/stdlib/source/test/lux/meta/type/unit/scale.lux +++ b/stdlib/source/test/lux/meta/type/unit/scale.lux @@ -5,15 +5,15 @@ [abstract [monad (.only do)] [equivalence (.only Equivalence)]] - [macro - [syntax (.only syntax)]] [math ["[0]" random (.only Random)] [number ["i" int] ["[0]" ratio (.use "[1]#[0]" equivalence)]]] ["[0]" meta (.only) - ["[0]" code]]]] + ["[0]" code] + [macro + [syntax (.only syntax)]]]]] [\\library ["[0]" / (.only) ["/[1]" //]]]) diff --git a/stdlib/source/test/lux/meta/version.lux b/stdlib/source/test/lux/meta/version.lux index e225265da..eebef8c0b 100644 --- a/stdlib/source/test/lux/meta/version.lux +++ b/stdlib/source/test/lux/meta/version.lux @@ -10,15 +10,15 @@ ["[0]" exception]] [data ["[0]" text]] - ["[0]" macro (.only) - [syntax (.only syntax)]] [math ["[0]" random] [number ["n" nat]]] ["[0]" meta (.only) ["[0]" code (.only) - ["<[1]>" \\parser]]]]] + ["<[1]>" \\parser]] + ["[0]" macro (.only) + [syntax (.only syntax)]]]]] [\\library ["[0]" /]]) diff --git a/stdlib/source/test/lux/program.lux b/stdlib/source/test/lux/program.lux index cedad66d5..1f31b3874 100644 --- a/stdlib/source/test/lux/program.lux +++ b/stdlib/source/test/lux/program.lux @@ -12,16 +12,16 @@ ["[0]" text (.use "[1]#[0]" equivalence)] [collection ["[0]" list]]] - [macro - [syntax (.only syntax)] - ["^" pattern]] [math ["[0]" random] [number ["n" nat (.use "[1]#[0]" decimal)]]] [meta ["[0]" code - ["<[1]>" \\parser]]]]] + ["<[1]>" \\parser]] + [macro + [syntax (.only syntax)] + ["^" pattern]]]]] ["[0]" \\parser] [\\library ["[0]" /]]) diff --git a/stdlib/source/test/lux/target/js.lux b/stdlib/source/test/lux/target/js.lux index 739381cf4..0288ca3b1 100644 --- a/stdlib/source/test/lux/target/js.lux +++ b/stdlib/source/test/lux/target/js.lux @@ -17,15 +17,16 @@ ["%" \\format (.only format)]] [collection ["[0]" list (.use "[1]#[0]" functor)]]] - [macro - ["[0]" template]] [math ["[0]" random (.only Random) (.use "[1]#[0]" monad)] [number ["n" nat] ["i" int] ["f" frac] - ["[0]" i64]]]]] + ["[0]" i64]]] + [meta + [macro + ["[0]" template]]]]] [\\library ["[0]" /]]) diff --git a/stdlib/source/test/lux/target/lua.lux b/stdlib/source/test/lux/target/lua.lux index 318f8ae57..129748613 100644 --- a/stdlib/source/test/lux/target/lua.lux +++ b/stdlib/source/test/lux/target/lua.lux @@ -20,15 +20,16 @@ ["%" \\format (.only format)]] [collection ["[0]" list (.use "[1]#[0]" functor)]]] - [macro - ["[0]" template]] [math ["[0]" random (.only Random) (.use "[1]#[0]" monad)] [number ["n" nat] ["i" int] ["f" frac] - ["[0]" i64]]]]] + ["[0]" i64]]] + [meta + [macro + ["[0]" template]]]]] [\\library ["[0]" /]]) diff --git a/stdlib/source/test/lux/tool/compiler/language/lux/analysis.lux b/stdlib/source/test/lux/tool/compiler/language/lux/analysis.lux index 487daeb16..afa79d64e 100644 --- a/stdlib/source/test/lux/tool/compiler/language/lux/analysis.lux +++ b/stdlib/source/test/lux/tool/compiler/language/lux/analysis.lux @@ -19,8 +19,6 @@ ["[0]" text (.use "[1]#[0]" equivalence)] [collection ["[0]" list]]] - [macro - ["[0]" template]] [math ["[0]" random (.only Random) (.use "[1]#[0]" monad)] [number @@ -30,6 +28,8 @@ ["r" rev]]] [meta ["[0]" symbol (.use "[1]#[0]" equivalence)] + [macro + ["[0]" template]] ["[0]" configuration ["$[1]" \\test]]] [tool diff --git a/stdlib/source/test/lux/tool/compiler/language/lux/analysis/coverage.lux b/stdlib/source/test/lux/tool/compiler/language/lux/analysis/coverage.lux index 49dd92a3b..eb47e634e 100644 --- a/stdlib/source/test/lux/tool/compiler/language/lux/analysis/coverage.lux +++ b/stdlib/source/test/lux/tool/compiler/language/lux/analysis/coverage.lux @@ -21,15 +21,16 @@ ["[0]" set] ["[0]" dictionary] ["[0]" list (.use "[1]#[0]" functor mix)]]] - [macro - ["^" pattern]] [math ["[0]" random (.only Random) (.use "[1]#[0]" monad)] [number ["n" nat (.use "[1]#[0]" interval)] ["i" int] ["r" rev] - ["f" frac]]]]] + ["f" frac]]] + [meta + [macro + ["^" pattern]]]]] [\\library ["[0]" / (.only) ["/[1]" // diff --git a/stdlib/source/test/lux/tool/compiler/language/lux/analysis/inference.lux b/stdlib/source/test/lux/tool/compiler/language/lux/analysis/inference.lux index a1bae7897..24433b8d0 100644 --- a/stdlib/source/test/lux/tool/compiler/language/lux/analysis/inference.lux +++ b/stdlib/source/test/lux/tool/compiler/language/lux/analysis/inference.lux @@ -2,7 +2,6 @@ [library [lux (.except) ["_" test (.only Test)] - ["[0]" macro] [abstract [monad (.only do)]] [control @@ -21,6 +20,7 @@ ["n" nat]]] [meta ["[0]" code] + ["[0]" macro] ["[0]" symbol ["$[1]" \\test]] ["[0]" configuration diff --git a/stdlib/source/test/lux/tool/compiler/language/lux/analysis/macro.lux b/stdlib/source/test/lux/tool/compiler/language/lux/analysis/macro.lux index 5a830ba38..19c701bef 100644 --- a/stdlib/source/test/lux/tool/compiler/language/lux/analysis/macro.lux +++ b/stdlib/source/test/lux/tool/compiler/language/lux/analysis/macro.lux @@ -2,7 +2,6 @@ [library [lux (.except) ["_" test (.only Test)] - ["[0]" macro] [abstract [monad (.only do)] [\\specification @@ -23,6 +22,7 @@ ["n" nat]]] ["[0]" meta (.only) ["[0]" code (.use "[1]#[0]" equivalence)] + ["[0]" macro] ["[0]" configuration ["$[1]" \\test]]]]] ["$" /////// diff --git a/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis.lux b/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis.lux index fd16878b1..317a4ec53 100644 --- a/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis.lux +++ b/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis.lux @@ -2,7 +2,6 @@ [library [lux (.except) ["_" test (.only Test)] - ["[0]" macro] [abstract [monad (.only do)]] [control @@ -19,6 +18,7 @@ ["n" nat]]] [meta ["[0]" code] + ["[0]" macro] ["[0]" type (.use "[1]#[0]" equivalence) ["[0]" check]]]]] [\\library diff --git a/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis/case.lux b/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis/case.lux index b905363d0..5c1752fe3 100644 --- a/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis/case.lux +++ b/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis/case.lux @@ -2,7 +2,6 @@ [library [lux (.except) ["_" test (.only Test)] - ["[0]" macro] [abstract [monad (.only do)]] [control @@ -16,6 +15,7 @@ ["[0]" random]] [meta ["[0]" code] + ["[0]" macro] ["[0]" type (.use "[1]#[0]" equivalence) ["[0]" check]]]]] [\\library diff --git a/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis/complex.lux b/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis/complex.lux index f8f6e693c..2e7b3e031 100644 --- a/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis/complex.lux +++ b/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis/complex.lux @@ -17,8 +17,6 @@ [collection ["[0]" list (.use "[1]#[0]" monad monoid)] ["[0]" set]]] - ["[0]" macro (.only) - ["^" pattern]] [math ["[0]" random (.only Random) (.use "[1]#[0]" monad)] [number @@ -26,6 +24,8 @@ ["f" frac]]] [meta ["[0]" code] + ["[0]" macro (.only) + ["^" pattern]] ["[0]" symbol (.only) ["$[1]" \\test]] ["[0]" configuration diff --git a/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis/function.lux b/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis/function.lux index 8c2212df4..efd22de9a 100644 --- a/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis/function.lux +++ b/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis/function.lux @@ -2,7 +2,6 @@ [library [lux (.except) ["_" test (.only Test)] - ["[0]" macro] [abstract [monad (.only do)]] [control @@ -21,6 +20,7 @@ ["n" nat]]] [meta ["[0]" code] + ["[0]" macro] ["[0]" symbol ["$[1]" \\test]] ["[0]" type (.use "[1]#[0]" equivalence) diff --git a/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/function.lux b/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/function.lux index e4631f5ad..10700d853 100644 --- a/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/function.lux +++ b/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/function.lux @@ -15,10 +15,11 @@ ["[0]" list (.use "[1]#[0]" functor mix monoid)] ["[0]" dictionary (.only Dictionary)] ["[0]" set]]] - [macro - ["^" pattern]] [math - ["[0]" random (.only Random)]]] + ["[0]" random (.only Random)]] + [meta + [macro + ["^" pattern]]]] ["[0]" // ["[1][0]" primitive]] [\\ diff --git a/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/variable.lux b/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/variable.lux index 85cb4dedc..309ba20ff 100644 --- a/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/variable.lux +++ b/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/variable.lux @@ -3,8 +3,6 @@ ["_" test (.only Test)] [abstract ["[0]" monad (.only do)]] - [math - ["[0]" random (.only Random)]] [control ["[0]" try]] [data @@ -16,8 +14,11 @@ [collection ["[0]" list (.use "[1]#[0]" functor mix)] ["[0]" dictionary (.only Dictionary)]]] - [macro - ["^" pattern]]] + [math + ["[0]" random (.only Random)]] + [meta + [macro + ["^" pattern]]]] [\\ ["[0]" / [//// diff --git a/stdlib/source/test/lux/tool/compiler/language/lux/synthesis.lux b/stdlib/source/test/lux/tool/compiler/language/lux/synthesis.lux index 9f69c7972..46ae030bc 100644 --- a/stdlib/source/test/lux/tool/compiler/language/lux/synthesis.lux +++ b/stdlib/source/test/lux/tool/compiler/language/lux/synthesis.lux @@ -13,8 +13,6 @@ ["[0]" text] [collection ["[0]" list (.use "[1]#[0]" functor)]]] - [macro - ["^" pattern]] [math ["[0]" random (.only Random)] [number @@ -22,7 +20,9 @@ ["[0]" i64] ["[0]" frac]]] [meta - ["[0]" symbol]] + ["[0]" symbol] + [macro + ["^" pattern]]] [tool [compiler [reference (.only) diff --git a/stdlib/source/test/lux/world/file.lux b/stdlib/source/test/lux/world/file.lux index 5fd673e83..5133e9c39 100644 --- a/stdlib/source/test/lux/world/file.lux +++ b/stdlib/source/test/lux/world/file.lux @@ -17,10 +17,11 @@ [collection ["[0]" dictionary (.only Dictionary)] ["[0]" list]]] - [macro - ["^" pattern]] [math ["[0]" random]] + [meta + [macro + ["^" pattern]]] [time ["[0]" instant (.only Instant)]]]] ["[0]" / diff --git a/stdlib/source/test/lux/world/input/keyboard.lux b/stdlib/source/test/lux/world/input/keyboard.lux index 25b652db6..ef44188ba 100644 --- a/stdlib/source/test/lux/world/input/keyboard.lux +++ b/stdlib/source/test/lux/world/input/keyboard.lux @@ -11,12 +11,13 @@ [collection ["[0]" list] ["[0]" set (.only Set)]]] - [macro - ["[0]" template]] [math ["[0]" random (.only Random)] [number - ["n" nat]]]]] + ["n" nat]]] + [meta + [macro + ["[0]" template]]]]] [\\library ["[0]" /]]) diff --git a/stdlib/source/test/lux/world/net/http/status.lux b/stdlib/source/test/lux/world/net/http/status.lux index 7e890002b..370c1e6bd 100644 --- a/stdlib/source/test/lux/world/net/http/status.lux +++ b/stdlib/source/test/lux/world/net/http/status.lux @@ -6,11 +6,12 @@ [collection ["[0]" list] ["[0]" set (.only Set)]]] - [macro - ["[0]" template]] [math [number - ["n" nat]]]]] + ["n" nat]]] + [meta + [macro + ["[0]" template]]]]] [\\library ["[0]" / (.only) ["/[1]" //]]]) -- cgit v1.2.3