diff options
Diffstat (limited to '')
-rw-r--r-- | stdlib/source/documentation/lux/test.lux | 199 |
1 files changed, 90 insertions, 109 deletions
diff --git a/stdlib/source/documentation/lux/test.lux b/stdlib/source/documentation/lux/test.lux index b9196ae25..f15eacf9d 100644 --- a/stdlib/source/documentation/lux/test.lux +++ b/stdlib/source/documentation/lux/test.lux @@ -1,7 +1,7 @@ (.require [library [lux (.except and for) - ["$" documentation (.only documentation:)] + ["$" documentation] [data ["[0]" text (.only \n) ["%" \\format (.only format)]]] @@ -10,116 +10,97 @@ [\\library ["[0]" /]]) -(documentation: /.Tally - "A record of successes and failures while executing tests.") - -(documentation: /.Assertion - "An asynchronous operation that yields test results.") - -(documentation: /.Test - "A test that relies on random data generation to thoroughly cover different scenarios.") - -(documentation: /.and' - "Sequencing combinator (for assertions)." - [(and' left right)]) - -(documentation: /.and - "Sequencing combinator." - [(and left right)]) - -(documentation: /.context - "Adds a contextual description to a test's documentation." - [(context description)]) - -(documentation: /.failure - "A failing test, with a given error message.") - -(documentation: /.assertion - "Check that a condition is #1, and fail with the given message otherwise." - [(assertion message condition)]) - -(documentation: /.property - "Check that a condition is #1, and fail with the given message otherwise." - [(property message condition)]) - -(documentation: /.lifted - "" - [(lifted message random)]) - -(documentation: /.Seed - "The seed value used for random testing (if that feature is used).") - -(documentation: /.seed - (format "Execute the given test with a specific seed value." - \n "This allows you to reproduce a failing test case as many times as you want while debugging.") - [(seed value test)]) - -(documentation: /.times - (format "Allows executing a test several times." - \n "By doing this, it's possible to thoroughly test code with many different scenarios." - \n "This assumes that random data generation is being used in tests instead of fixed/constant inputs.") - [(times amount test)]) - -(documentation: /.run! - (format "Executes a test, and exits the program with either a successful or a failing exit code." - \n "WARNING: This procedure is only meant to be used in (program: ...) forms.") - [(run! test)]) - -(documentation: /.coverage' - (format "Specifies a test as covering one or more definitions." - \n "Adds to the test tally information to track which definitions have been tested.") - [(coverage' [definition/0 definition/1 ,,, definition/N] - (is Bit - (some "computation")))]) - -(documentation: /.coverage - (format "Specifies a test as covering one or more definitions." - \n "Adds to the test tally information to track which definitions have been tested.") - [(coverage [definition/0 definition/1 ,,, definition/N] - (is Bit - (some "computation")))]) - -(documentation: /.for - (format "Specifies a context for tests as covering one or more definitions." - \n "Adds to the test tally information to track which definitions have been tested.") - [(for [definition/0 definition/1 ,,, definition/N] - (is Test - some_test))]) - -(documentation: /.covering - (format "Specifies the module being covered by a test." - \n "Adds tracking information to the tally to know which exported definitions in the module need to be covered.") - [(covering .._ - (is Test - some_test))]) - -(documentation: /.in_parallel - "Executes multiple tests in parallel (if the host platform supports it) to take advantage of multiple cores." - [(in_parallel tests)]) - (.def .public documentation (.List $.Module) ($.module /._ "Tools for unit & property-based/generative testing." - [..Tally - ..Assertion - ..Test - ..and' - ..and - ..context - ..failure - ..assertion - ..property - ..lifted - ..Seed - ..seed - ..times - ..run! - ..coverage' - ..coverage - ..for - ..covering - ..in_parallel - ($.default /.must_try_test_at_least_once) - ($.default /.error_during_execution)] + [($.default /.must_try_test_at_least_once) + ($.default /.error_during_execution) + + ($.documentation /.Tally + "A record of successes and failures while executing tests.") + + ($.documentation /.Assertion + "An asynchronous operation that yields test results.") + + ($.documentation /.Test + "A test that relies on random data generation to thoroughly cover different scenarios.") + + ($.documentation /.and' + "Sequencing combinator (for assertions)." + [(and' left right)]) + + ($.documentation /.and + "Sequencing combinator." + [(and left right)]) + + ($.documentation /.context + "Adds a contextual description to a test's documentation." + [(context description)]) + + ($.documentation /.failure + "A failing test, with a given error message.") + + ($.documentation /.assertion + "Check that a condition is #1, and fail with the given message otherwise." + [(assertion message condition)]) + + ($.documentation /.property + "Check that a condition is #1, and fail with the given message otherwise." + [(property message condition)]) + + ($.documentation /.lifted + "" + [(lifted message random)]) + + ($.documentation /.Seed + "The seed value used for random testing (if that feature is used).") + + ($.documentation /.seed + (format "Execute the given test with a specific seed value." + \n "This allows you to reproduce a failing test case as many times as you want while debugging.") + [(seed value test)]) + + ($.documentation /.times + (format "Allows executing a test several times." + \n "By doing this, it's possible to thoroughly test code with many different scenarios." + \n "This assumes that random data generation is being used in tests instead of fixed/constant inputs.") + [(times amount test)]) + + ($.documentation /.run! + (format "Executes a test, and exits the program with either a successful or a failing exit code." + \n "WARNING: This procedure is only meant to be used in (program: ...) forms.") + [(run! test)]) + + ($.documentation /.coverage' + (format "Specifies a test as covering one or more definitions." + \n "Adds to the test tally information to track which definitions have been tested.") + [(coverage' [definition/0 definition/1 ,,, definition/N] + (is Bit + (some "computation")))]) + + ($.documentation /.coverage + (format "Specifies a test as covering one or more definitions." + \n "Adds to the test tally information to track which definitions have been tested.") + [(coverage [definition/0 definition/1 ,,, definition/N] + (is Bit + (some "computation")))]) + + ($.documentation /.for + (format "Specifies a context for tests as covering one or more definitions." + \n "Adds to the test tally information to track which definitions have been tested.") + [(for [definition/0 definition/1 ,,, definition/N] + (is Test + some_test))]) + + ($.documentation /.covering + (format "Specifies the module being covered by a test." + \n "Adds tracking information to the tally to know which exported definitions in the module need to be covered.") + [(covering .._ + (is Test + some_test))]) + + ($.documentation /.in_parallel + "Executes multiple tests in parallel (if the host platform supports it) to take advantage of multiple cores." + [(in_parallel tests)])] [])) |