From eff4c59794868b89d60fdc411f9b544a270b817e Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Mon, 2 Aug 2021 20:26:21 -0400 Subject: Fixed a bug in the new compiler which allowed the same module to be imported more than once. --- stdlib/source/test/lux.lux | 53 ++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 47 insertions(+), 6 deletions(-) (limited to 'stdlib/source/test/lux.lux') diff --git a/stdlib/source/test/lux.lux b/stdlib/source/test/lux.lux index 63d468945..ca533e853 100644 --- a/stdlib/source/test/lux.lux +++ b/stdlib/source/test/lux.lux @@ -10,8 +10,7 @@ ["@" target] ["." meta] [abstract - [monad (#+ do)] - [predicate (#+ Predicate)]] + [monad (#+ do)]] [control ["." io] [concurrency @@ -21,11 +20,13 @@ ["." text ("#\." equivalence) ["%" format (#+ format)]] [collection - ["." list]]] + ["." list] + ["." set (#+ Set)]]] ["." macro + [syntax (#+ syntax:)] ["." code ("#\." equivalence)]] ["." math - ["." random (#+ Random) ("#\." functor)] + ["." random ("#\." functor)] [number [i8 (#+)] [i16 (#+)] @@ -462,8 +463,7 @@ expected_left random.nat expected_right random.nat - #let [existential_type (: (Random /.Type) - (\ ! map (|>> #.Ex) random.nat))] + #let [existential_type (\ ! map (|>> #.Ex) random.nat)] expected/0 existential_type expected/1 existential_type] (<| (_.for [/.Type]) @@ -1051,6 +1051,46 @@ I16))) ))) +(def: possible_targets + (Set @.Target) + (<| (set.of_list text.hash) + (list @.old + @.js + @.jvm + @.lua + @.python + @.ruby))) + +(syntax: (for_meta|Info) + (function (_ lux) + (let [info (get@ #.info lux) + + conforming_target! + (set.member? ..possible_targets (get@ #.target info)) + + compiling! + (case (get@ #.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 (get@ #.module_state prelude_module) + #.Active false + _ true)))))) + +(def: for_meta + Test + ($_ _.and + (_.cover [/.Mode /.Info] + (for_meta|Info)) + (_.cover [/.Module_State] + (for_meta|Module_State)) + )) + (def: test Test (<| (_.covering /._) @@ -1076,6 +1116,7 @@ ..for_control_flow ..for_def: ..for_import + ..for_meta ..sub_tests ))) -- cgit v1.2.3