diff options
Diffstat (limited to 'stdlib/source/documentation/lux/control/function/contract.lux')
-rw-r--r-- | stdlib/source/documentation/lux/control/function/contract.lux | 38 |
1 files changed, 18 insertions, 20 deletions
diff --git a/stdlib/source/documentation/lux/control/function/contract.lux b/stdlib/source/documentation/lux/control/function/contract.lux index 9545d94e2..d1a24154f 100644 --- a/stdlib/source/documentation/lux/control/function/contract.lux +++ b/stdlib/source/documentation/lux/control/function/contract.lux @@ -1,7 +1,7 @@ (.require [library [lux (.except if loop) - ["$" documentation (.only documentation:)] + ["$" documentation] [data [text (.only \n) ["%" \\format (.only format)]]] @@ -10,27 +10,25 @@ [\\library ["[0]" /]]) -(documentation: /.pre - (format "Pre-conditions." - \n "Given a test and an expression to run, only runs the expression if the test passes." - \n "Otherwise, an error is raised.") - [(pre (i.= +4 (i.+ +2 +2)) - (foo +123 +456 +789))]) - -(documentation: /.post - (format "Post-conditions." - \n "Given a predicate and an expression to run, evaluates the expression and then tests the output with the predicate." - \n "If the predicate returns #1, returns the value of the expression." - \n "Otherwise, an error is raised.") - [(post i.even? - (i.+ +2 +2))]) - (.def .public documentation (.List $.Module) ($.module /._ "" - [..pre - ..post - ($.default /.pre_condition_failed) - ($.default /.post_condition_failed)] + [($.default /.pre_condition_failed) + ($.default /.post_condition_failed) + + ($.documentation /.pre + (format "Pre-conditions." + \n "Given a test and an expression to run, only runs the expression if the test passes." + \n "Otherwise, an error is raised.") + [(pre (i.= +4 (i.+ +2 +2)) + (foo +123 +456 +789))]) + + ($.documentation /.post + (format "Post-conditions." + \n "Given a predicate and an expression to run, evaluates the expression and then tests the output with the predicate." + \n "If the predicate returns #1, returns the value of the expression." + \n "Otherwise, an error is raised.") + [(post i.even? + (i.+ +2 +2))])] [])) |