From f6a2fe158979230dcf2d271981ff34be39c7bffc Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Mon, 20 Apr 2020 23:56:15 -0400 Subject: Added some testing machinery to measure the code coverage of tests. --- stdlib/source/lux.lux | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) (limited to 'stdlib/source/lux.lux') diff --git a/stdlib/source/lux.lux b/stdlib/source/lux.lux index c33f025ea..265b8e979 100644 --- a/stdlib/source/lux.lux +++ b/stdlib/source/lux.lux @@ -1456,16 +1456,6 @@ ys} xs)) -(def:''' #export (splice-helper xs ys) - #Nil - (-> ($' List Code) ($' List Code) ($' List Code)) - ({(#Cons x xs') - (#Cons x (splice-helper xs' ys)) - - #Nil - ys} - xs)) - (def:''' (_$_joiner op a1 a2) #Nil (-> Code Code Code Code) @@ -1752,6 +1742,14 @@ (#Left ($_ text@compose "Unknown module: " module " @ " (name@encode full-name)))} (get module modules)))) +(def:''' (as-code-list expression) + #Nil + (-> Code Code) + (let' [type (form$ (list (tag$ ["lux" "Apply"]) + (identifier$ ["lux" "Code"]) + (identifier$ ["lux" "List"])))] + (form$ (list (text$ "lux check") type expression)))) + (def:''' (splice replace? untemplate elems) #Nil (-> Bit (-> Code ($' Meta Code)) ($' List Code) ($' Meta Code)) @@ -1762,21 +1760,21 @@ (#Cons lastI inits) (do meta-monad [lastO ({[_ (#Form (#Cons [[_ (#Identifier ["" "~+"])] (#Cons [spliced #Nil])]))] - (let' [[[_module-name _ _] _] spliced] - (wrap spliced)) + (wrap (as-code-list spliced)) _ (do meta-monad [lastO (untemplate lastI)] - (wrap (form$ (list (tag$ ["lux" "Cons"]) (tuple$ (list lastO (tag$ ["lux" "Nil"])))))))} + (wrap (as-code-list (form$ (list (tag$ ["lux" "Cons"]) + (tuple$ (list lastO (tag$ ["lux" "Nil"]))))))))} lastI)] (monad@fold meta-monad (function' [leftI rightO] ({[_ (#Form (#Cons [[_ (#Identifier ["" "~+"])] (#Cons [spliced #Nil])]))] - (let' [[[_module-name _ _] _] spliced] - (wrap (form$ (list (identifier$ ["lux" "splice-helper"]) - spliced - rightO)))) + (let' [g!in-module (form$ (list (text$ "lux in-module") + (text$ "lux") + (identifier$ ["lux" "list@compose"])))] + (wrap (form$ (list g!in-module (as-code-list spliced) rightO)))) _ (do meta-monad @@ -1847,7 +1845,9 @@ (return (wrap-meta (form$ (list (tag$ ["lux" "Identifier"]) (tuple$ (list (text$ module) (text$ name))))))) [#1 [_ (#Form (#Cons [[_ (#Identifier ["" "~"])] (#Cons [unquoted #Nil])]))]] - (return unquoted) + (return (form$ (list (text$ "lux check") + (identifier$ ["lux" "Code"]) + unquoted))) [#1 [_ (#Form (#Cons [[_ (#Identifier ["" "~!"])] (#Cons [dependent #Nil])]))]] (do meta-monad -- cgit v1.2.3