diff options
author | Eduardo Julian | 2022-07-28 17:39:01 -0400 |
---|---|---|
committer | Eduardo Julian | 2022-07-28 17:39:01 -0400 |
commit | a4b64bf1cdf47160b6b615d2c6493039abfd7a94 (patch) | |
tree | 3fe8c149d9cad89bbf067c736d196260203d1a01 | |
parent | a4847190df926d35f7ece97da50a2a8b1462a24f (diff) |
Extracted unit-testing machinery into its own module.
117 files changed, 3281 insertions, 3085 deletions
diff --git a/licentia/source/test/licentia.lux b/licentia/source/test/licentia.lux index fe5829e74..6b6230347 100644 --- a/licentia/source/test/licentia.lux +++ b/licentia/source/test/licentia.lux @@ -158,36 +158,36 @@ (def (about_grant present? termination) (Concern Termination) (all _.and - (_.property "Copyright grant is present." + (_.test "Copyright grant is present." (present? grant.copyright)) - (_.property "Patent grant is present." + (_.test "Patent grant is present." (present? (grant.patent (the license.#patent_retaliation? termination)))) - (_.property "Effective date for the grants is present." + (_.test "Effective date for the grants is present." (present? grant.date)) - (_.property "Patent grant is present." + (_.test "Patent grant is present." (present? (grant.termination (the license.#termination_period termination) (the license.#grace_period termination)))) - (_.property "The termination period is accurately conveyed." + (_.test "The termination period is accurately conveyed." (present? (grant.grant_restoration_clause (the license.#termination_period termination)))) - (_.property "The grace period is accurately conveyed." + (_.test "The grace period is accurately conveyed." (present? (grant.grace_period_clause (the license.#grace_period termination)))) - (_.property "The grants are not retro-actively terminated." + (_.test "The grants are not retro-actively terminated." (present? grant.no_retroactive_termination)) )) (def (about_liability present? liability) (Concern Liability) (all _.and - (_.property "Warranty liability disclaimer is present." + (_.test "Warranty liability disclaimer is present." (present? liability.warranty)) - (_.property "Limitation of liability is present." + (_.test "Limitation of liability is present." (present? liability.limitation)) - (_.property "Litigation conditions are present." + (_.test "Litigation conditions are present." (present? liability.litigation)) - (_.property "Liability acceptance conditions may be present." + (_.test "Liability acceptance conditions may be present." (bit#= (the license.#can_accept? liability) (present? liability.can_accept))) - (_.property "Liability acceptance conditions may be present." + (_.test "Liability acceptance conditions may be present." (bit#= (the license.#disclaim_high_risk? liability) (present? liability.disclaim_high_risk))) )) @@ -195,24 +195,24 @@ (def (about_distribution present? distribution) (Concern Distribution) (all _.and - (_.property "Conditions for source-code distribution are present." + (_.test "Conditions for source-code distribution are present." (present? distribution.source_code_form)) - (_.property "Conditions for object-code distribution are present." + (_.test "Conditions for object-code distribution are present." (present? distribution.object_form)) - (_.property "Conditions for extension distribution are present." + (_.test "Conditions for extension distribution are present." (present? (distribution.extension distribution))) )) (def (about_commercial present? commercial) (Concern Commercial) (all _.and - (_.property "Non-commercial clause is present." + (_.test "Non-commercial clause is present." (bit#= (not (the license.#can_sell? commercial)) (present? commercial.cannot_sell))) - (_.property "Contributor credit condition is present." + (_.test "Contributor credit condition is present." (bit#= (the license.#require_contributor_credit? commercial) (present? commercial.require_contributor_attribution))) - (_.property "Anti-endorsement condition is present." + (_.test "Anti-endorsement condition is present." (bit#= (not (the license.#allow_contributor_endorsement? commercial)) (present? commercial.disallow_contributor_endorsement))) )) @@ -220,21 +220,21 @@ (def (about_extension present? extension) (Concern Extension) (all _.and - (_.property "The license is viral." + (_.test "The license is viral." (bit#= (the license.#same_license? extension) (and (list.every? present? extension.sharing_requirement) (list.every? present? extension.license_conflict_resolution)))) - (_.property "Extensions must be distinguishable from the original work." + (_.test "Extensions must be distinguishable from the original work." (bit#= (the license.#must_be_distinguishable? extension) (present? extension.distinctness_requirement))) - (_.property "The community must be notified of new extensions." + (_.test "The community must be notified of new extensions." (case (the license.#notification_period extension) {.#Some period} (present? (extension.notification_requirement period)) {.#None} true)) - (_.property "Must describe modifications." + (_.test "Must describe modifications." (bit#= (the license.#must_describe_modifications? extension) (present? extension.description_requirement))) )) @@ -242,16 +242,16 @@ (def (about_attribution present? attribution) (Concern Attribution) (all _.and - (_.property "The attribution copyright notice is present." + (_.test "The attribution copyright notice is present." (present? (the license.#copyright_notice attribution))) - (_.property "The attribution phrase is present." + (_.test "The attribution phrase is present." (|> attribution (the license.#phrase) (maybe#each present?) (maybe.default true))) - (_.property "The attribution URL is present." + (_.test "The attribution URL is present." (present? (the license.#url attribution))) - (_.property "The attribution image is present." + (_.test "The attribution image is present." (|> attribution (the license.#image) (maybe#each present?) @@ -261,24 +261,24 @@ (def (about_miscellaneous present?) (-> (-> Text Bit) Test) (all _.and - (_.property "License constitutes the entire agreement." + (_.test "License constitutes the entire agreement." (present? miscellaneous.entire_agreement)) - (_.property "Disclaims relationship of parties." + (_.test "Disclaims relationship of parties." (present? miscellaneous.relationship_of_parties)) - (_.property "Explicitly allows independent development." + (_.test "Explicitly allows independent development." (present? miscellaneous.independent_development)) - (_.property "Clarifies consent to breach does not waiver." + (_.test "Clarifies consent to breach does not waiver." (present? miscellaneous.not_waiver)) - (_.property "Provides severability." + (_.test "Provides severability." (present? miscellaneous.severability)) - (_.property "Covers export restrictions." + (_.test "Covers export restrictions." (present? miscellaneous.export_restrictions)) )) (def (about_addendum present? value) (Concern Addendum) (all _.and - (_.property "Commons clause" + (_.test "Commons clause" (bit#= (the license.#commons_clause? value) (present? addendum.commons_clause))) )) @@ -292,11 +292,11 @@ (function (_ snippet) (text.contains? snippet writ)))]] (all _.and - (_.property "Copyright notices are present." + (_.test "Copyright notices are present." (list.every? (|>> notice.copyright_holder present?) (the license.#copyright_holders license))) - (_.property "Identification is present (if the license is identified)." + (_.test "Identification is present (if the license is identified)." (case (the license.#identification license) {.#Some identification} (and (present? (output.identification identification)) @@ -305,7 +305,7 @@ {.#None} (not (present? miscellaneous.new_versions)))) - (_.property "Black-lists (if wanted by licensor) are explicitly enumerated and justified." + (_.test "Black-lists (if wanted by licensor) are explicitly enumerated and justified." (list.every? (function (_ black_list) (let [black_list_is_justified? (case (the license.#justification black_list) {.#Some justification} @@ -321,22 +321,22 @@ every_entity_is_mentioned?))) (the license.#black_lists license))) - (_.property "All definitions are present." + (_.test "All definitions are present." (list.every? (|>> output.definition present?) definition.all)) - (_.property "Acceptance of the license is demanded." + (_.test "Acceptance of the license is demanded." (present? limitation.acceptance)) (..about_grant present? (the license.#termination license)) - (_.property "All limitations are present." + (_.test "All limitations are present." (present? output.limitation)) - (_.property "All assurances are present." + (_.test "All assurances are present." (present? output.assurance)) - (_.property "The terms of submission are present." + (_.test "The terms of submission are present." (present? submission.contribution)) (..about_liability present? (the license.#liability license)) @@ -352,14 +352,14 @@ (..about_attribution present? attribution) {.#None} - (_.property "Attribution is missing." + (_.test "Attribution is missing." bit.yes)) (..about_miscellaneous present?) (..about_addendum present? (the license.#addendum license)) - (_.property "License ending footer is present." + (_.test "License ending footer is present." (present? notice.end_of_license)) ))) diff --git a/lux-mode/lux-mode.el b/lux-mode/lux-mode.el index ca2a16a83..c165b483d 100644 --- a/lux-mode/lux-mode.el +++ b/lux-mode/lux-mode.el @@ -628,10 +628,9 @@ This function also returns nil meaning don't specify the indentation." (to_do 'defun) (fix_me 'defun) - (property 'defun) - ("property'" 'defun) + (test 'defun) + ("test'" 'defun) (coverage 'defun) - ("coverage'" 'defun) ) ;;;###autoload diff --git a/stdlib/source/documentation/lux/data.lux b/stdlib/source/documentation/lux/data.lux index 088366a27..93ecf8753 100644 --- a/stdlib/source/documentation/lux/data.lux +++ b/stdlib/source/documentation/lux/data.lux @@ -16,8 +16,8 @@ ["[1][0]" sum] ["[1][0]" text]]) -(.def .public documentation - (.List $.Module) +(def .public documentation + (List $.Documentation) (list.together (list /binary.documentation /bit.documentation diff --git a/stdlib/source/documentation/lux/data/binary.lux b/stdlib/source/documentation/lux/data/binary.lux index 6a660752e..34b12a2b6 100644 --- a/stdlib/source/documentation/lux/data/binary.lux +++ b/stdlib/source/documentation/lux/data/binary.lux @@ -4,247 +4,256 @@ ["$" documentation] [data [text (.only \n) - ["%" \\format (.only format)]]]]] + ["%" \\format (.only format)]] + [collection + ["[0]" list (.use "[1]#[0]" monoid)]]]]] ["[0]" \\format] ["[0]" \\parser] [\\library ["[0]" /]]) -(`` (.def \\parser - (.List $.Module) - ($.module \\parser._ - "" - [($.definition \\parser.binary_was_not_fully_read) - ($.definition \\parser.size_8) - ($.definition \\parser.size_16) - ($.definition \\parser.size_32) - ($.definition \\parser.size_64) - ($.definition \\parser.bits_8) - ($.definition \\parser.bits_16) - ($.definition \\parser.bits_32) - ($.definition \\parser.bits_64) - ($.definition \\parser.nat) - ($.definition \\parser.int) - ($.definition \\parser.rev) - ($.definition \\parser.frac) - ($.definition \\parser.invalid_tag) - ($.definition \\parser.or) - ($.definition \\parser.not_a_bit) - ($.definition \\parser.bit) - ($.definition \\parser.text) - ($.definition \\parser.maybe) - ($.definition \\parser.set_elements_are_not_unique) - ($.definition \\parser.symbol) - ($.definition \\parser.type) - ($.definition \\parser.location) - ($.definition \\parser.code) - - ($.definition \\parser.Offset - "An offset for reading within binary data.") - - ($.definition (\\parser.Parser it) - "A parser for raw binary data.") - - ($.definition \\parser.result - "Runs a parser and checks that all the binary data was read by it." - [(result parser input)]) - - ($.definition \\parser.end? - "Checks whether there is no more data to read.") - - ($.definition \\parser.offset - "The current offset (i.e. how much data has been read).") - - ($.definition \\parser.remaining - "How much of the data remains to be read.") - - ($.definition \\parser.Size - "The size of a chunk of data within a binary array.") - - ($.definition \\parser.rec - "Tie the knot for a recursive parser.") - - ($.definition \\parser.any - "Does no parsing, and just returns a dummy value.") - - ($.definition \\parser.segment - "Parses a chunk of data of a given size." - [(segment size)]) - - (,, (with_template [<size> <name>] - [($.definition <name> - (format "Parses a block of data prefixed with a size that is " (%.nat <size>) " bytes long."))] - - [08 \\parser.binary_8] - [16 \\parser.binary_16] - [32 \\parser.binary_32] - [64 \\parser.binary_64] - )) - - (,, (with_template [<size> <name>] - [($.definition <name> - (format "Parses a block of (UTF-8 encoded) text prefixed with a size that is " (%.nat <size>) " bytes long."))] - - [08 \\parser.utf8_8] - [16 \\parser.utf8_16] - [32 \\parser.utf8_32] - [64 \\parser.utf8_64] - )) - - (,, (with_template [<size> <name>] - [($.definition <name> - (format "Parses a sequence of values prefixed with a size that is " (%.nat <size>) " bytes long."))] - - [08 \\parser.sequence_8] - [16 \\parser.sequence_16] - [32 \\parser.sequence_32] - [64 \\parser.sequence_64] - )) - - ($.definition \\parser.list - "Parses an arbitrarily long list of values." - [(list value)]) - - ($.definition \\parser.set - "" - [(set hash value)])] - []))) - -(.def \\format - (.List $.Module) - ($.module \\format._ - "" - [($.definition \\format.monoid) - ($.definition \\format.bits_8) - ($.definition \\format.bits_16) - ($.definition \\format.bits_32) - ($.definition \\format.bits_64) - ($.definition \\format.any) - ($.definition \\format.bit) - ($.definition \\format.nat) - ($.definition \\format.int) - ($.definition \\format.rev) - ($.definition \\format.frac) - ($.definition \\format.binary_8) - ($.definition \\format.binary_16) - ($.definition \\format.binary_32) - ($.definition \\format.binary_64) - ($.definition \\format.utf8_8) - ($.definition \\format.utf8_16) - ($.definition \\format.utf8_32) - ($.definition \\format.utf8_64) - ($.definition \\format.text) - ($.definition \\format.sequence_8) - ($.definition \\format.sequence_16) - ($.definition \\format.sequence_32) - ($.definition \\format.sequence_64) - ($.definition \\format.maybe) - ($.definition \\format.list) - ($.definition \\format.set) - ($.definition \\format.symbol) - ($.definition \\format.type) - ($.definition \\format.location) - ($.definition \\format.code) - - ($.definition \\format.Mutation - "A mutation of binary data, tracking where in the data to transform.") - - ($.definition \\format.Specification - "A description of how to transform binary data.") - - ($.definition \\format.no_op - "A specification for empty binary data.") - - ($.definition \\format.instance - "Given a specification of how to construct binary data, yields a binary blob that matches it.") - - ($.definition (\\format.Format it) - "An operation that knows how to write information into a binary blob.") - - ($.definition \\format.result - "Yields a binary blob with all the information written to it." - [(result format value)]) - - ($.definition \\format.or - "" - [(or left right)]) - - ($.definition \\format.and - "" - [(and pre post)]) - - ($.definition \\format.rec - "A combinator for recursive formats." - [(rec body)]) - - ($.definition \\format.segment - "Writes at most 'size' bytes of an input binary blob." - [(segment size)])] - [])) - -(.def .public documentation - (.List $.Module) - ($.module /._ - "" - [($.definition /.index_out_of_bounds) - ($.definition /.slice_out_of_bounds) - ($.definition /.size) - ($.definition /.equivalence) - ($.definition /.monoid) - - ($.definition /.Binary - "A binary BLOB of data.") - - ($.definition /.empty - "A fresh/empty binary BLOB of the specified size." - [(empty size)]) - - ($.definition /.mix - "" - [(mix f init binary)]) - - ($.definition /.bits_8 - "Read 1 byte (8 bits) at the given index." - [(bits_8 index binary)]) - - ($.definition /.bits_16 - "Read 2 bytes (16 bits) at the given index." - [(bits_16 index binary)]) - - ($.definition /.bits_32 - "Read 4 bytes (32 bits) at the given index." - [(bits_32 index binary)]) - - ($.definition /.bits_64 - "Read 8 bytes (64 bits) at the given index." - [(bits_64 index binary)]) - - ($.definition /.has_8! - "Write 1 byte (8 bits) at the given index." - [(has_8! index value binary)]) - - ($.definition /.has_16! - "Write 2 bytes (16 bits) at the given index." - [(has_16! index value binary)]) - - ($.definition /.has_32! - "Write 4 bytes (32 bits) at the given index." - [(has_32! index value binary)]) - - ($.definition /.has_64! - "Write 8 bytes (64 bits) at the given index." - [(has_64! index value binary)]) - - ($.definition /.copy! - "Mutates the target binary BLOB by copying bytes from the source BLOB to it." - [(copy! bytes source_offset source target_offset target)]) - - ($.definition /.slice - "Yields a subset of the binary BLOB, so long as the specified range is valid." - [(slice offset length binary)]) - - ($.definition /.after - "Yields a binary BLOB with at most the specified number of bytes removed." - [(after bytes binary)])] - [..\\format - ..\\parser])) +(`` (def \\parser + (List $.Documentation) + (list ($.module \\parser._ + "") + + ($.definition \\parser.binary_was_not_fully_read) + ($.definition \\parser.size_8) + ($.definition \\parser.size_16) + ($.definition \\parser.size_32) + ($.definition \\parser.size_64) + ($.definition \\parser.bits_8) + ($.definition \\parser.bits_16) + ($.definition \\parser.bits_32) + ($.definition \\parser.bits_64) + ($.definition \\parser.nat) + ($.definition \\parser.int) + ($.definition \\parser.rev) + ($.definition \\parser.frac) + ($.definition \\parser.invalid_tag) + ($.definition \\parser.or) + ($.definition \\parser.not_a_bit) + ($.definition \\parser.bit) + ($.definition \\parser.text) + ($.definition \\parser.maybe) + ($.definition \\parser.set_elements_are_not_unique) + ($.definition \\parser.symbol) + ($.definition \\parser.type) + ($.definition \\parser.location) + ($.definition \\parser.code) + + ($.definition \\parser.Offset + "An offset for reading within binary data.") + + ($.definition (\\parser.Parser it) + "A parser for raw binary data.") + + ($.definition \\parser.result + "Runs a parser and checks that all the binary data was read by it." + [(result parser input)]) + + ($.definition \\parser.end? + "Checks whether there is no more data to read.") + + ($.definition \\parser.offset + "The current offset (i.e. how much data has been read).") + + ($.definition \\parser.remaining + "How much of the data remains to be read.") + + ($.definition \\parser.Size + "The size of a chunk of data within a binary array.") + + ($.definition \\parser.rec + "Tie the knot for a recursive parser.") + + ($.definition \\parser.any + "Does no parsing, and just returns a dummy value.") + + ($.definition \\parser.segment + "Parses a chunk of data of a given size." + [(segment size)]) + + (,, (with_template [<size> <name>] + [($.definition <name> + (format "Parses a block of data prefixed with a size that is " (%.nat <size>) " bytes long."))] + + [08 \\parser.binary_8] + [16 \\parser.binary_16] + [32 \\parser.binary_32] + [64 \\parser.binary_64] + )) + + (,, (with_template [<size> <name>] + [($.definition <name> + (format "Parses a block of (UTF-8 encoded) text prefixed with a size that is " (%.nat <size>) " bytes long."))] + + [08 \\parser.utf8_8] + [16 \\parser.utf8_16] + [32 \\parser.utf8_32] + [64 \\parser.utf8_64] + )) + + (,, (with_template [<size> <name>] + [($.definition <name> + (format "Parses a sequence of values prefixed with a size that is " (%.nat <size>) " bytes long."))] + + [08 \\parser.sequence_8] + [16 \\parser.sequence_16] + [32 \\parser.sequence_32] + [64 \\parser.sequence_64] + )) + + ($.definition \\parser.list + "Parses an arbitrarily long list of values." + [(list value)]) + + ($.definition \\parser.set + "" + [(set hash value)]) + ))) + +(def \\format + (List $.Documentation) + (list ($.module \\format._ + "") + + ($.definition \\format.monoid) + ($.definition \\format.bits_8) + ($.definition \\format.bits_16) + ($.definition \\format.bits_32) + ($.definition \\format.bits_64) + ($.definition \\format.any) + ($.definition \\format.bit) + ($.definition \\format.nat) + ($.definition \\format.int) + ($.definition \\format.rev) + ($.definition \\format.frac) + ($.definition \\format.binary_8) + ($.definition \\format.binary_16) + ($.definition \\format.binary_32) + ($.definition \\format.binary_64) + ($.definition \\format.utf8_8) + ($.definition \\format.utf8_16) + ($.definition \\format.utf8_32) + ($.definition \\format.utf8_64) + ($.definition \\format.text) + ($.definition \\format.sequence_8) + ($.definition \\format.sequence_16) + ($.definition \\format.sequence_32) + ($.definition \\format.sequence_64) + ($.definition \\format.maybe) + ($.definition \\format.list) + ($.definition \\format.set) + ($.definition \\format.symbol) + ($.definition \\format.type) + ($.definition \\format.location) + ($.definition \\format.code) + + ($.definition \\format.Mutation + "A mutation of binary data, tracking where in the data to transform.") + + ($.definition \\format.Specification + "A description of how to transform binary data.") + + ($.definition \\format.no_op + "A specification for empty binary data.") + + ($.definition \\format.instance + "Given a specification of how to construct binary data, yields a binary blob that matches it.") + + ($.definition (\\format.Format it) + "An operation that knows how to write information into a binary blob.") + + ($.definition \\format.result + "Yields a binary blob with all the information written to it." + [(result format value)]) + + ($.definition \\format.or + "" + [(or left right)]) + + ($.definition \\format.and + "" + [(and pre post)]) + + ($.definition \\format.rec + "A combinator for recursive formats." + [(rec body)]) + + ($.definition \\format.segment + "Writes at most 'size' bytes of an input binary blob." + [(segment size)]) + )) + +(def .public documentation + (List $.Documentation) + (list.partial ($.module /._ + "") + + ($.definition /.index_out_of_bounds) + ($.definition /.slice_out_of_bounds) + ($.definition /.size) + ($.definition /.equivalence) + ($.definition /.monoid) + + ($.definition /.Binary + "A binary BLOB of data.") + + ($.definition /.empty + "A fresh/empty binary BLOB of the specified size." + [(empty size)]) + + ($.definition /.mix + "" + [(mix f init binary)]) + + ($.definition /.bits_8 + "Read 1 byte (8 bits) at the given index." + [(bits_8 index binary)]) + + ($.definition /.bits_16 + "Read 2 bytes (16 bits) at the given index." + [(bits_16 index binary)]) + + ($.definition /.bits_32 + "Read 4 bytes (32 bits) at the given index." + [(bits_32 index binary)]) + + ($.definition /.bits_64 + "Read 8 bytes (64 bits) at the given index." + [(bits_64 index binary)]) + + ($.definition /.has_8! + "Write 1 byte (8 bits) at the given index." + [(has_8! index value binary)]) + + ($.definition /.has_16! + "Write 2 bytes (16 bits) at the given index." + [(has_16! index value binary)]) + + ($.definition /.has_32! + "Write 4 bytes (32 bits) at the given index." + [(has_32! index value binary)]) + + ($.definition /.has_64! + "Write 8 bytes (64 bits) at the given index." + [(has_64! index value binary)]) + + ($.definition /.copy! + "Mutates the target binary BLOB by copying bytes from the source BLOB to it." + [(copy! bytes source_offset source target_offset target)]) + + ($.definition /.slice + "Yields a subset of the binary BLOB, so long as the specified range is valid." + [(slice offset length binary)]) + + ($.definition /.after + "Yields a binary BLOB with at most the specified number of bytes removed." + [(after bytes binary)]) + + (all list#composite + ..\\format + ..\\parser + ) + )) diff --git a/stdlib/source/documentation/lux/data/bit.lux b/stdlib/source/documentation/lux/data/bit.lux index 99238c240..bb6f5430e 100644 --- a/stdlib/source/documentation/lux/data/bit.lux +++ b/stdlib/source/documentation/lux/data/bit.lux @@ -8,21 +8,22 @@ [\\library ["[0]" /]]) -(.def .public documentation - (.List $.Module) - ($.module /._ - "" - [($.definition /.no) - ($.definition /.yes) - ($.definition /.off) - ($.definition /.on) - ($.definition /.equivalence) - ($.definition /.hash) - ($.definition /.disjunction) - ($.definition /.conjunction) - ($.definition /.codec) +(def .public documentation + (List $.Documentation) + (list ($.module /._ + "") - ($.definition /.complement - (format "Generates the complement of a predicate." - \n "That is a predicate that returns the oposite of the original predicate."))] - [])) + ($.definition /.no) + ($.definition /.yes) + ($.definition /.off) + ($.definition /.on) + ($.definition /.equivalence) + ($.definition /.hash) + ($.definition /.disjunction) + ($.definition /.conjunction) + ($.definition /.codec) + + ($.definition /.complement + (format "Generates the complement of a predicate." + \n "That is a predicate that returns the oposite of the original predicate.")) + )) diff --git a/stdlib/source/documentation/lux/data/collection.lux b/stdlib/source/documentation/lux/data/collection.lux index 5712aa398..8920b36e7 100644 --- a/stdlib/source/documentation/lux/data/collection.lux +++ b/stdlib/source/documentation/lux/data/collection.lux @@ -19,8 +19,8 @@ ["[1][0]" set] ["[1][0]" tree]]) -(.def .public documentation - (.List $.Module) +(def .public documentation + (List $.Documentation) (list.together (list /array.documentation /bits.documentation diff --git a/stdlib/source/documentation/lux/data/collection/array.lux b/stdlib/source/documentation/lux/data/collection/array.lux index 164e10326..e821b976c 100644 --- a/stdlib/source/documentation/lux/data/collection/array.lux +++ b/stdlib/source/documentation/lux/data/collection/array.lux @@ -1,6 +1,6 @@ (.require [library - [lux (.except list) + [lux (.except) ["$" documentation] [data ["[0]" text (.only \n) @@ -10,89 +10,90 @@ [\\library ["[0]" /]]) -(.def .public documentation - (.List $.Module) - ($.module /._ - "" - [($.definition /.primitive) - ($.definition /.equivalence) - ($.definition /.monoid) - ($.definition /.functor) - ($.definition /.mix) - ($.definition /.every?) - ($.definition /.any?) - - ($.definition (/.Array it) - "Mutable arrays.") - - ($.definition /.empty - "An empty array of the specified size." - [(empty size)]) - - ($.definition /.size - "" - [(size array)]) - - ($.definition /.item - "" - [(item index array)]) - - ($.definition /.has! - "Mutate the array by writing a value to the specified index." - [(has! index value array)]) - - ($.definition /.lacks! - "Mutate the array by deleting the value at the specified index." - [(lacks! index array)]) - - ($.definition /.has? - "" - [(has? index array)]) - - ($.definition /.revised! - "Mutate the array by updating the value at the specified index." - [(revised! index transform array)]) - - ($.definition /.upsert! - (format "Mutate the array by updating the value at the specified index." - \n "If there is no value, update and write the default value given.") - [(upsert! index default transform array)]) - - ($.definition /.copy! - "Writes the contents of one array into the other." - [(copy! length src_start src_array dest_start dest_array)]) - - ($.definition /.occupancy - "Finds out how many cells in an array are occupied." - [(occupancy array)]) - - ($.definition /.vacancy - "Finds out how many cells in an array are vacant." - [(vacancy array)]) - - ($.definition /.only! - "Delete every item of the array that fails to satisfy the predicate." - [(only! p xs)]) - - ($.definition /.example - "Yields the first item in the array that satisfies the predicate." - [(example p xs)]) - - ($.definition /.example' - "Just like 'example', but with access to the index of each value." - [(example' p xs)]) - - ($.definition /.clone - "Yields a shallow clone of the array." - [(clone xs)]) - - ($.definition /.of_list - "" - [(of_list xs)]) - - ($.definition /.list - (format "Yields a list with every non-empty item in the array." - \n "Can use the optional default value when encountering an empty cell in the array.") - [(list {.#None} array) - (list {.#Some default} array)])] - [])) +(def .public documentation + (.List $.Documentation) + (list ($.module /._ + "") + + ($.definition /.primitive) + ($.definition /.equivalence) + ($.definition /.monoid) + ($.definition /.functor) + ($.definition /.mix) + ($.definition /.every?) + ($.definition /.any?) + + ($.definition (/.Array it) + "Mutable arrays.") + + ($.definition /.empty + "An empty array of the specified size." + [(empty size)]) + + ($.definition /.size + "" + [(size array)]) + + ($.definition /.item + "" + [(item index array)]) + + ($.definition /.has! + "Mutate the array by writing a value to the specified index." + [(has! index value array)]) + + ($.definition /.lacks! + "Mutate the array by deleting the value at the specified index." + [(lacks! index array)]) + + ($.definition /.has? + "" + [(has? index array)]) + + ($.definition /.revised! + "Mutate the array by updating the value at the specified index." + [(revised! index transform array)]) + + ($.definition /.upsert! + (format "Mutate the array by updating the value at the specified index." + \n "If there is no value, update and write the default value given.") + [(upsert! index default transform array)]) + + ($.definition /.copy! + "Writes the contents of one array into the other." + [(copy! length src_start src_array dest_start dest_array)]) + + ($.definition /.occupancy + "Finds out how many cells in an array are occupied." + [(occupancy array)]) + + ($.definition /.vacancy + "Finds out how many cells in an array are vacant." + [(vacancy array)]) + + ($.definition /.only! + "Delete every item of the array that fails to satisfy the predicate." + [(only! p xs)]) + + ($.definition /.example + "Yields the first item in the array that satisfies the predicate." + [(example p xs)]) + + ($.definition /.example' + "Just like 'example', but with access to the index of each value." + [(example' p xs)]) + + ($.definition /.clone + "Yields a shallow clone of the array." + [(clone xs)]) + + ($.definition /.of_list + "" + [(of_list xs)]) + + ($.definition /.list + (format "Yields a list with every non-empty item in the array." + \n "Can use the optional default value when encountering an empty cell in the array.") + [(list {.#None} array) + (list {.#Some default} array)]) + )) diff --git a/stdlib/source/documentation/lux/data/collection/bits.lux b/stdlib/source/documentation/lux/data/collection/bits.lux index 4a4fa900d..296d9f087 100644 --- a/stdlib/source/documentation/lux/data/collection/bits.lux +++ b/stdlib/source/documentation/lux/data/collection/bits.lux @@ -5,42 +5,43 @@ [\\library ["[0]" /]]) -(.def .public documentation - (.List $.Module) - ($.module /._ - "" - [($.definition /.Chunk) - ($.definition /.chunk_size) - ($.definition /.empty) - ($.definition /.empty?) - ($.definition /.equivalence) - ($.definition /.one) - ($.definition /.zero) - ($.definition /.flipped) - ($.definition /.and) - ($.definition /.or) - ($.definition /.xor) - - ($.definition /.Bits - "A bit-map.") - - ($.definition /.size - "Measures the size of a bit-map by counting all the 1s in the bit-map." - [(size bits)]) - - ($.definition /.capacity - "" - [(capacity bits)]) - - ($.definition /.bit - "" - [(bit index bits)]) - - ($.definition /.intersects? - "" - [(intersects? reference sample)]) - - ($.definition /.not - "" - [(not input)])] - [])) +(def .public documentation + (.List $.Documentation) + (list ($.module /._ + "") + + ($.definition /.Chunk) + ($.definition /.chunk_size) + ($.definition /.empty) + ($.definition /.empty?) + ($.definition /.equivalence) + ($.definition /.one) + ($.definition /.zero) + ($.definition /.flipped) + ($.definition /.and) + ($.definition /.or) + ($.definition /.xor) + + ($.definition /.Bits + "A bit-map.") + + ($.definition /.size + "Measures the size of a bit-map by counting all the 1s in the bit-map." + [(size bits)]) + + ($.definition /.capacity + "" + [(capacity bits)]) + + ($.definition /.bit + "" + [(bit index bits)]) + + ($.definition /.intersects? + "" + [(intersects? reference sample)]) + + ($.definition /.not + "" + [(not input)]) + )) diff --git a/stdlib/source/documentation/lux/data/collection/dictionary.lux b/stdlib/source/documentation/lux/data/collection/dictionary.lux index dcf2afce1..da8bd13e8 100644 --- a/stdlib/source/documentation/lux/data/collection/dictionary.lux +++ b/stdlib/source/documentation/lux/data/collection/dictionary.lux @@ -4,81 +4,86 @@ ["$" documentation] [data [text (.only \n) - ["%" \\format (.only format)]]]]] + ["%" \\format (.only format)]] + [collection + ["[0]" list]]]]] [\\library ["[0]" /]] ["[0]" / ["[1][0]" ordered]]) -(.def .public documentation - (.List $.Module) - ($.module /._ - "" - [($.definition /.key_hash) - ($.definition /.key_already_exists) - ($.definition /.size) - ($.definition /.empty?) - ($.definition /.entries) - ($.definition /.keys) - ($.definition /.values) - ($.definition /.equivalence) - ($.definition /.functor) - - ($.definition (/.Dictionary key value) - "A dictionary implemented as a Hash-Array Mapped Trie (HAMT).") - - ($.definition /.empty - "An empty dictionary." - [(empty key_hash)]) - - ($.definition /.has - "" - [(has key val dict)]) - - ($.definition /.lacks - "" - [(lacks key dict)]) - - ($.definition /.value - "" - [(value key dict)]) - - ($.definition /.key? - "" - [(key? dict key)]) - - ($.definition /.has' - "Only puts the KV-pair if the key is not already present." - [(has' key val dict)]) - - ($.definition /.revised - "Transforms the value located at key (if available), using the given function." - [(revised key f dict)]) - - ($.definition /.revised' - (format "Updates the value at the key; if it exists." - \n "Otherwise, puts a value by applying the function to a default.") - [(revised' key default f dict)]) - - ($.definition /.of_list - "" - [(of_list key_hash kvs)]) - - ($.definition /.composite - (format "Merges 2 dictionaries." - \n "If any collisions with keys occur, the values of dict2 will overwrite those of dict1.") - [(composite dict2 dict1)]) - - ($.definition /.composite_with - (format "Merges 2 dictionaries." - \n "If any collisions with keys occur, a new value will be computed by applying 'f' to the values of dict2 and dict1.") - [(composite_with f dict2 dict1)]) - - ($.definition /.re_bound - "If there is a value under 'from_key', remove 'from_key' and store the value under 'to_key'." - [(re_bound from_key to_key dict)]) - - ($.definition /.sub - "A sub-dictionary, with only the specified keys." - [(sub keys dict)])] - [/ordered.documentation])) +(def .public documentation + (List $.Documentation) + (list.partial ($.module /._ + "") + + ($.definition /.key_hash) + ($.definition /.key_already_exists) + ($.definition /.size) + ($.definition /.empty?) + ($.definition /.entries) + ($.definition /.keys) + ($.definition /.values) + ($.definition /.equivalence) + ($.definition /.functor) + + ($.definition (/.Dictionary key value) + "A dictionary implemented as a Hash-Array Mapped Trie (HAMT).") + + ($.definition /.empty + "An empty dictionary." + [(empty key_hash)]) + + ($.definition /.has + "" + [(has key val dict)]) + + ($.definition /.lacks + "" + [(lacks key dict)]) + + ($.definition /.value + "" + [(value key dict)]) + + ($.definition /.key? + "" + [(key? dict key)]) + + ($.definition /.has' + "Only puts the KV-pair if the key is not already present." + [(has' key val dict)]) + + ($.definition /.revised + "Transforms the value located at key (if available), using the given function." + [(revised key f dict)]) + + ($.definition /.revised' + (format "Updates the value at the key; if it exists." + \n "Otherwise, puts a value by applying the function to a default.") + [(revised' key default f dict)]) + + ($.definition /.of_list + "" + [(of_list key_hash kvs)]) + + ($.definition /.composite + (format "Merges 2 dictionaries." + \n "If any collisions with keys occur, the values of dict2 will overwrite those of dict1.") + [(composite dict2 dict1)]) + + ($.definition /.composite_with + (format "Merges 2 dictionaries." + \n "If any collisions with keys occur, a new value will be computed by applying 'f' to the values of dict2 and dict1.") + [(composite_with f dict2 dict1)]) + + ($.definition /.re_bound + "If there is a value under 'from_key', remove 'from_key' and store the value under 'to_key'." + [(re_bound from_key to_key dict)]) + + ($.definition /.sub + "A sub-dictionary, with only the specified keys." + [(sub keys dict)]) + + /ordered.documentation + )) diff --git a/stdlib/source/documentation/lux/data/collection/dictionary/ordered.lux b/stdlib/source/documentation/lux/data/collection/dictionary/ordered.lux index c264b55f6..d44fe0863 100644 --- a/stdlib/source/documentation/lux/data/collection/dictionary/ordered.lux +++ b/stdlib/source/documentation/lux/data/collection/dictionary/ordered.lux @@ -1,6 +1,6 @@ (.require [library - [lux (.except has revised) + [lux (.except) ["$" documentation] [data [text @@ -11,56 +11,57 @@ [\\library ["[0]" /]]) -(`` (.def .public documentation - (.List $.Module) - ($.module /._ - "" - [($.definition /.empty?) - ($.definition /.entries) - ($.definition /.keys) - ($.definition /.values) - ($.definition /.equivalence) +(`` (def .public documentation + (.List $.Documentation) + (list ($.module /._ + "") - ($.definition (/.Dictionary key value) - "A dictionary data-structure with ordered entries.") + ($.definition /.empty?) + ($.definition /.entries) + ($.definition /.keys) + ($.definition /.values) + ($.definition /.equivalence) - ($.definition /.empty - "An empty dictionary, employing the given order." - [(empty order)]) + ($.definition (/.Dictionary key value) + "A dictionary data-structure with ordered entries.") - ($.definition /.value - "" - [(value key dict)]) + ($.definition /.empty + "An empty dictionary, employing the given order." + [(empty order)]) - ($.definition /.key? - "" - [(key? dict key)]) + ($.definition /.value + "" + [(value key dict)]) - (,, (with_template [<name>] - [(`` ($.definition <name> - (format "Yields value under the " (,, (template.text [<name>])) "imum key.")))] + ($.definition /.key? + "" + [(key? dict key)]) - [/.min] - [/.max] - )) + (,, (with_template [<name>] + [(`` ($.definition <name> + (format "Yields value under the " (,, (template.text [<name>])) "imum key.")))] - ($.definition /.size - "" - [(size dict)]) + [/.min] + [/.max] + )) - ($.definition /.has - "" - [(has key value dict)]) + ($.definition /.size + "" + [(size dict)]) - ($.definition /.lacks - "" - [(lacks key dict)]) + ($.definition /.has + "" + [(has key value dict)]) - ($.definition /.revised - "" - [(revised key transform dict)]) + ($.definition /.lacks + "" + [(lacks key dict)]) - ($.definition /.of_list - "" - [(of_list order list)])] - []))) + ($.definition /.revised + "" + [(revised key transform dict)]) + + ($.definition /.of_list + "" + [(of_list order list)]) + ))) diff --git a/stdlib/source/documentation/lux/data/collection/list.lux b/stdlib/source/documentation/lux/data/collection/list.lux index bd4cf4a7d..cf08192c2 100644 --- a/stdlib/source/documentation/lux/data/collection/list.lux +++ b/stdlib/source/documentation/lux/data/collection/list.lux @@ -1,6 +1,6 @@ (.require [library - [lux (.except all) + [lux (.except) ["$" documentation] [data [text (.only \n) @@ -10,11 +10,12 @@ ["[0]" / ["[1][0]" property]]) -(`` (.def .public documentation - (.List $.Module) - ($.module /._ - "" - [($.definition /.mix) +(`` (def .public documentation + (List $.Documentation) + (/.partial ($.module /._ + "") + + ($.definition /.mix) ($.definition /.equivalence) ($.definition /.hash) ($.definition /.monoid) @@ -163,5 +164,7 @@ [(do monad [value (do_something 1 2 3) .when (passes_test? value)] - (do_something_else 4 5 6))])] - [/property.documentation]))) + (do_something_else 4 5 6))]) + + /property.documentation + ))) diff --git a/stdlib/source/documentation/lux/data/collection/list/property.lux b/stdlib/source/documentation/lux/data/collection/list/property.lux index 1d8ac9892..c2d694d62 100644 --- a/stdlib/source/documentation/lux/data/collection/list/property.lux +++ b/stdlib/source/documentation/lux/data/collection/list/property.lux @@ -8,38 +8,39 @@ [\\library ["[0]" /]]) -(.def .public documentation - (.List $.Module) - ($.module /._ - "" - [($.definition /.empty) - ($.definition /.size) - ($.definition /.empty?) - ($.definition /.keys) - ($.definition /.values) - ($.definition /.equivalence) - - ($.definition (/.List it) - (format "A property list." - \n "It's a simple dictionary-like structure with Text keys.")) - - ($.definition /.value - "" - [(value key properties)]) - - ($.definition /.contains? - "" - [(contains? key properties)]) - - ($.definition /.has - "" - [(has key val properties)]) - - ($.definition /.revised - "" - [(revised key f properties)]) - - ($.definition /.lacks - "" - [(lacks key properties)])] - [])) +(def .public documentation + (.List $.Documentation) + (list ($.module /._ + "") + + ($.definition /.empty) + ($.definition /.size) + ($.definition /.empty?) + ($.definition /.keys) + ($.definition /.values) + ($.definition /.equivalence) + + ($.definition (/.List it) + (format "A property list." + \n "It's a simple dictionary-like structure with Text keys.")) + + ($.definition /.value + "" + [(value key properties)]) + + ($.definition /.contains? + "" + [(contains? key properties)]) + + ($.definition /.has + "" + [(has key val properties)]) + + ($.definition /.revised + "" + [(revised key f properties)]) + + ($.definition /.lacks + "" + [(lacks key properties)]) + )) diff --git a/stdlib/source/documentation/lux/data/collection/queue.lux b/stdlib/source/documentation/lux/data/collection/queue.lux index d61c7dae6..44dd7f209 100644 --- a/stdlib/source/documentation/lux/data/collection/queue.lux +++ b/stdlib/source/documentation/lux/data/collection/queue.lux @@ -1,45 +1,51 @@ (.require [library - [lux (.except list) - ["$" documentation]]] + [lux (.except) + ["$" documentation] + [data + [collection + ["[0]" list]]]]] [\\library ["[0]" /]] ["[0]" / ["[1][0]" priority]]) -(.def .public documentation - (.List $.Module) - ($.module /._ - "" - [($.definition /.empty) - ($.definition /.size) - ($.definition /.empty?) - ($.definition /.equivalence) - ($.definition /.functor) - - ($.definition (/.Queue it) - "A first-in, first-out sequential data-structure.") - - ($.definition /.of_list - "" - [(of_list entries)]) - - ($.definition /.list - "" - [(list queue)]) - - ($.definition /.front - "Yields the first value in the queue, if any.") - - ($.definition /.member? - "" - [(member? equivalence queue member)]) - - ($.definition /.next - "" - [(next queue)]) - - ($.definition /.end - "" - [(end val queue)])] - [/priority.documentation])) +(def .public documentation + (List $.Documentation) + (list.partial ($.module /._ + "") + + ($.definition /.empty) + ($.definition /.size) + ($.definition /.empty?) + ($.definition /.equivalence) + ($.definition /.functor) + + ($.definition (/.Queue it) + "A first-in, first-out sequential data-structure.") + + ($.definition /.of_list + "" + [(of_list entries)]) + + ($.definition /.list + "" + [(list queue)]) + + ($.definition /.front + "Yields the first value in the queue, if any.") + + ($.definition /.member? + "" + [(member? equivalence queue member)]) + + ($.definition /.next + "" + [(next queue)]) + + ($.definition /.end + "" + [(end val queue)]) + + /priority.documentation + )) diff --git a/stdlib/source/documentation/lux/data/collection/queue/priority.lux b/stdlib/source/documentation/lux/data/collection/queue/priority.lux index 94eb7dc59..e08056fe3 100644 --- a/stdlib/source/documentation/lux/data/collection/queue/priority.lux +++ b/stdlib/source/documentation/lux/data/collection/queue/priority.lux @@ -1,29 +1,30 @@ (.require [library - [lux (.except list) + [lux (.except) ["$" documentation]]] [\\library ["[0]" /]]) -(.def .public documentation - (.List $.Module) - ($.module /._ - "" - [($.definition /.Priority) - ($.definition /.max) - ($.definition /.min) - ($.definition (/.Queue it)) - ($.definition /.empty) - ($.definition /.front) - ($.definition /.size) - ($.definition /.next) - ($.definition /.empty?) +(def .public documentation + (.List $.Documentation) + (list ($.module /._ + "") - ($.definition /.member? - "" - [(member? equivalence queue member)]) + ($.definition /.Priority) + ($.definition /.max) + ($.definition /.min) + ($.definition (/.Queue it)) + ($.definition /.empty) + ($.definition /.front) + ($.definition /.size) + ($.definition /.next) + ($.definition /.empty?) - ($.definition /.end - "" - [(end priority value queue)])] - [])) + ($.definition /.member? + "" + [(member? equivalence queue member)]) + + ($.definition /.end + "" + [(end priority value queue)]) + )) diff --git a/stdlib/source/documentation/lux/data/collection/sequence.lux b/stdlib/source/documentation/lux/data/collection/sequence.lux index 2db4aba19..5dbbe420f 100644 --- a/stdlib/source/documentation/lux/data/collection/sequence.lux +++ b/stdlib/source/documentation/lux/data/collection/sequence.lux @@ -1,66 +1,67 @@ (.require [library - [lux (.except list has revised) + [lux (.except) ["$" documentation]]] [\\library ["[0]" /]]) -(.def .public documentation - (.List $.Module) - ($.module /._ - "" - [($.definition /.empty) - ($.definition /.size) - ($.definition /.index_out_of_bounds) - ($.definition /.of_list) - ($.definition /.empty?) - ($.definition /.equivalence) - ($.definition /.mix) - ($.definition /.monoid) - ($.definition /.functor) - ($.definition /.apply) - ($.definition /.monad) - ($.definition /.reversed) - ($.definition /.every?) - ($.definition /.any?) +(def .public documentation + (List $.Documentation) + (list ($.module /._ + "") - ($.definition (/.Sequence it) - "A sequential data-structure with fast random access.") + ($.definition /.empty) + ($.definition /.size) + ($.definition /.index_out_of_bounds) + ($.definition /.of_list) + ($.definition /.empty?) + ($.definition /.equivalence) + ($.definition /.mix) + ($.definition /.monoid) + ($.definition /.functor) + ($.definition /.apply) + ($.definition /.monad) + ($.definition /.reversed) + ($.definition /.every?) + ($.definition /.any?) - ($.definition /.suffix - "" - [(suffix val sequence)]) + ($.definition (/.Sequence it) + "A sequential data-structure with fast random access.") - ($.definition /.within_bounds? - "Determines whether the index is within the bounds of the sequence." - [(within_bounds? sequence idx)]) + ($.definition /.suffix + "" + [(suffix val sequence)]) - ($.definition /.item - "" - [(item idx sequence)]) + ($.definition /.within_bounds? + "Determines whether the index is within the bounds of the sequence." + [(within_bounds? sequence idx)]) - ($.definition /.has - "" - [(has idx val sequence)]) + ($.definition /.item + "" + [(item idx sequence)]) - ($.definition /.revised - "" - [(revised idx f sequence)]) + ($.definition /.has + "" + [(has idx val sequence)]) - ($.definition /.prefix - "" - [(prefix sequence)]) + ($.definition /.revised + "" + [(revised idx f sequence)]) - ($.definition /.list - "" - [(list sequence)]) + ($.definition /.prefix + "" + [(prefix sequence)]) - ($.definition /.member? - "" - [(member? equivalence sequence val)]) + ($.definition /.list + "" + [(list sequence)]) - ($.definition /.sequence - "Sequence literals." - [(is (Sequence Nat) - (sequence 12 34 56 78 90))])] - [])) + ($.definition /.member? + "" + [(member? equivalence sequence val)]) + + ($.definition /.sequence + "Sequence literals." + [(is (Sequence Nat) + (sequence 12 34 56 78 90))]) + )) diff --git a/stdlib/source/documentation/lux/data/collection/set.lux b/stdlib/source/documentation/lux/data/collection/set.lux index c9c02c488..94ad8e8d9 100644 --- a/stdlib/source/documentation/lux/data/collection/set.lux +++ b/stdlib/source/documentation/lux/data/collection/set.lux @@ -4,50 +4,57 @@ ["$" documentation] [data ["[0]" text (.only \n) - ["%" \\format (.only format)]]]]] + ["%" \\format (.only format)]] + [collection + ["[0]" list (.use "[1]#[0]" monoid)]]]]] [\\library ["[0]" /]] ["[0]" / ["[1][0]" multi] ["[1][0]" ordered]]) -(.def .public documentation - (.List $.Module) - ($.module /._ - "" - [($.definition (/.Set it)) - ($.definition /.member_hash) - ($.definition /.empty) - ($.definition /.size) - ($.definition /.lacks) - ($.definition /.member?) - ($.definition /.list) - ($.definition /.union) - ($.definition /.equivalence) - ($.definition /.hash) - ($.definition /.monoid) - ($.definition /.empty?) - ($.definition /.of_list) - ($.definition /.predicate) - - ($.definition /.has - "" - [(has elem set)]) - - ($.definition /.difference - "" - [(difference sub base)]) - - ($.definition /.intersection - "" - [(intersection filter base)]) - - ($.definition /.sub? - "" - [(sub? super sub)]) - - ($.definition /.super? - "" - [(super? sub super)])] - [/multi.documentation - /ordered.documentation])) +(def .public documentation + (List $.Documentation) + (list.partial ($.module /._ + "") + + ($.definition (/.Set it)) + ($.definition /.member_hash) + ($.definition /.empty) + ($.definition /.size) + ($.definition /.lacks) + ($.definition /.member?) + ($.definition /.list) + ($.definition /.union) + ($.definition /.equivalence) + ($.definition /.hash) + ($.definition /.monoid) + ($.definition /.empty?) + ($.definition /.of_list) + ($.definition /.predicate) + + ($.definition /.has + "" + [(has elem set)]) + + ($.definition /.difference + "" + [(difference sub base)]) + + ($.definition /.intersection + "" + [(intersection filter base)]) + + ($.definition /.sub? + "" + [(sub? super sub)]) + + ($.definition /.super? + "" + [(super? sub super)]) + + (all list#composite + /multi.documentation + /ordered.documentation + ) + )) diff --git a/stdlib/source/documentation/lux/data/collection/set/multi.lux b/stdlib/source/documentation/lux/data/collection/set/multi.lux index 77944599e..8c84efe56 100644 --- a/stdlib/source/documentation/lux/data/collection/set/multi.lux +++ b/stdlib/source/documentation/lux/data/collection/set/multi.lux @@ -1,6 +1,6 @@ (.require [library - [lux (.except list has) + [lux (.except) ["$" documentation] [data ["[0]" text (.only \n) @@ -8,50 +8,51 @@ [\\library ["[0]" /]]) -(.def .public documentation - (.List $.Module) - ($.module /._ - "" - [($.definition /.empty) - ($.definition /.size) - ($.definition /.list) - ($.definition /.equivalence) - ($.definition /.hash) - ($.definition /.empty?) - ($.definition /.of_list) - ($.definition /.of_set) - ($.definition /.union) - ($.definition /.sum) - ($.definition /.intersection) - ($.definition /.difference) - - ($.definition (/.Set it) - "A set that keeps track of repetition in its entries.") - - ($.definition /.has - "" - [(has multiplicity elem set)]) - - ($.definition /.lacks - "" - [(lacks multiplicity elem set)]) - - ($.definition /.multiplicity - "" - [(multiplicity set elem)]) - - ($.definition /.sub? - "Is 'subject' a sub-set of 'reference'?" - [(sub? reference subject)]) - - ($.definition /.support - "A set of the unique (non repeated) members." - [(support set)]) - - ($.definition /.member? - "" - [(member? set elem)]) - - ($.definition /.super? - "Is 'subject' a super-set of 'reference'?")] - [])) +(def .public documentation + (.List $.Documentation) + (list ($.module /._ + "") + + ($.definition /.empty) + ($.definition /.size) + ($.definition /.list) + ($.definition /.equivalence) + ($.definition /.hash) + ($.definition /.empty?) + ($.definition /.of_list) + ($.definition /.of_set) + ($.definition /.union) + ($.definition /.sum) + ($.definition /.intersection) + ($.definition /.difference) + + ($.definition (/.Set it) + "A set that keeps track of repetition in its entries.") + + ($.definition /.has + "" + [(has multiplicity elem set)]) + + ($.definition /.lacks + "" + [(lacks multiplicity elem set)]) + + ($.definition /.multiplicity + "" + [(multiplicity set elem)]) + + ($.definition /.sub? + "Is 'subject' a sub-set of 'reference'?" + [(sub? reference subject)]) + + ($.definition /.support + "A set of the unique (non repeated) members." + [(support set)]) + + ($.definition /.member? + "" + [(member? set elem)]) + + ($.definition /.super? + "Is 'subject' a super-set of 'reference'?") + )) diff --git a/stdlib/source/documentation/lux/data/collection/set/ordered.lux b/stdlib/source/documentation/lux/data/collection/set/ordered.lux index a34ad7bb2..82f29e9d9 100644 --- a/stdlib/source/documentation/lux/data/collection/set/ordered.lux +++ b/stdlib/source/documentation/lux/data/collection/set/ordered.lux @@ -1,6 +1,6 @@ (.require [library - [lux (.except list has) + [lux (.except) ["$" documentation] [data ["[0]" text (.only \n) @@ -8,45 +8,46 @@ [\\library ["[0]" /]]) -(.def .public documentation - (.List $.Module) - ($.module /._ - "" - [($.definition /.empty) - ($.definition /.min) - ($.definition /.max) - ($.definition /.size) - ($.definition /.empty?) - ($.definition /.list) - ($.definition /.of_list) - ($.definition /.union) - ($.definition /.intersection) - ($.definition /.equivalence) - - ($.definition (/.Set it) - "A set with ordered entries.") - - ($.definition /.member? - "" - [(member? set elem)]) - - ($.definition /.has - "" - [(has elem set)]) - - ($.definition /.lacks - "" - [(lacks elem set)]) - - ($.definition /.difference - "" - [(difference param subject)]) - - ($.definition /.sub? - "Is 'sub' a sub-set of 'super'?" - [(sub? super sub)]) - - ($.definition /.super? - "Is 'super' a super-set of 'sub'?" - [(super? sub super)])] - [])) +(def .public documentation + (.List $.Documentation) + (list ($.module /._ + "") + + ($.definition /.empty) + ($.definition /.min) + ($.definition /.max) + ($.definition /.size) + ($.definition /.empty?) + ($.definition /.list) + ($.definition /.of_list) + ($.definition /.union) + ($.definition /.intersection) + ($.definition /.equivalence) + + ($.definition (/.Set it) + "A set with ordered entries.") + + ($.definition /.member? + "" + [(member? set elem)]) + + ($.definition /.has + "" + [(has elem set)]) + + ($.definition /.lacks + "" + [(lacks elem set)]) + + ($.definition /.difference + "" + [(difference param subject)]) + + ($.definition /.sub? + "Is 'sub' a sub-set of 'super'?" + [(sub? super sub)]) + + ($.definition /.super? + "Is 'super' a super-set of 'sub'?" + [(super? sub super)]) + )) diff --git a/stdlib/source/documentation/lux/data/collection/stack.lux b/stdlib/source/documentation/lux/data/collection/stack.lux index 5a334c846..e882391c7 100644 --- a/stdlib/source/documentation/lux/data/collection/stack.lux +++ b/stdlib/source/documentation/lux/data/collection/stack.lux @@ -1,6 +1,6 @@ (.require [library - [lux (.except list) + [lux (.except) ["$" documentation] [data ["[0]" text (.only \n) @@ -8,28 +8,29 @@ [\\library ["[0]" /]]) -(.def .public documentation - (.List $.Module) - ($.module /._ - "" - [($.definition /.empty) - ($.definition /.size) - ($.definition /.empty?) - ($.definition /.equivalence) - ($.definition /.functor) +(def .public documentation + (List $.Documentation) + (list ($.module /._ + "") - ($.definition (/.Stack it) - "A first-in, last-out sequential data-structure.") + ($.definition /.empty) + ($.definition /.size) + ($.definition /.empty?) + ($.definition /.equivalence) + ($.definition /.functor) - ($.definition /.value - "Yields the top value in the stack, if any." - [(value stack)]) + ($.definition (/.Stack it) + "A first-in, last-out sequential data-structure.") - ($.definition /.next - "" - [(next stack)]) + ($.definition /.value + "Yields the top value in the stack, if any." + [(value stack)]) - ($.definition /.top - "" - [(top value stack)])] - [])) + ($.definition /.next + "" + [(next stack)]) + + ($.definition /.top + "" + [(top value stack)]) + )) diff --git a/stdlib/source/documentation/lux/data/collection/stream.lux b/stdlib/source/documentation/lux/data/collection/stream.lux index 095642068..d32960d0d 100644 --- a/stdlib/source/documentation/lux/data/collection/stream.lux +++ b/stdlib/source/documentation/lux/data/collection/stream.lux @@ -1,6 +1,6 @@ (.require [library - [lux (.except list pattern) + [lux (.except) ["$" documentation] [data [text (.only \n) @@ -8,53 +8,54 @@ [\\library ["[0]" /]]) -(.def .public documentation - (.List $.Module) - ($.module /._ - "" - [($.definition /.head) - ($.definition /.tail) - ($.definition /.functor) - ($.definition /.comonad) - ($.definition /.while) - ($.definition /.until) - ($.definition /.first) - ($.definition /.after) - ($.definition /.split_when) - ($.definition /.split_at) - - ($.definition (/.Stream it) - "An infinite sequence of values.") - - ($.definition /.iterations - "A stateful way of infinitely calculating the values of a stream." - [(iterations step init)]) - - ($.definition /.repeated - "Repeat a value forever." - [(repeated x)]) - - ($.definition /.cycle - "Go over the elements of a list forever." - [(cycle [start next])]) - - ($.definition /.item - "" - [(item idx stream)]) - - ($.definition /.only - "A new stream only with items that satisfy the predicate." - [(only predicate stream)]) - - ($.definition /.partition - (format "Split a stream in two based on a predicate." - \n "The left side contains all entries for which the predicate is #1." - \n "The right side contains all entries for which the predicate is #0.") - [(partition left? xs)]) - - ($.definition /.pattern - (format "Allows destructuring of streams in pattern-matching expressions." - \n "Caveat emptor: Only use it for destructuring, and not for testing values within the streams.") - [(let [(pattern x y z _tail) (some_stream_func +1 +2 +3)] - (func x y z))])] - [])) +(def .public documentation + (List $.Documentation) + (list ($.module /._ + "") + + ($.definition /.head) + ($.definition /.tail) + ($.definition /.functor) + ($.definition /.comonad) + ($.definition /.while) + ($.definition /.until) + ($.definition /.first) + ($.definition /.after) + ($.definition /.split_when) + ($.definition /.split_at) + + ($.definition (/.Stream it) + "An infinite sequence of values.") + + ($.definition /.iterations + "A stateful way of infinitely calculating the values of a stream." + [(iterations step init)]) + + ($.definition /.repeated + "Repeat a value forever." + [(repeated x)]) + + ($.definition /.cycle + "Go over the elements of a list forever." + [(cycle [start next])]) + + ($.definition /.item + "" + [(item idx stream)]) + + ($.definition /.only + "A new stream only with items that satisfy the predicate." + [(only predicate stream)]) + + ($.definition /.partition + (format "Split a stream in two based on a predicate." + \n "The left side contains all entries for which the predicate is #1." + \n "The right side contains all entries for which the predicate is #0.") + [(partition left? xs)]) + + ($.definition /.pattern + (format "Allows destructuring of streams in pattern-matching expressions." + \n "Caveat emptor: Only use it for destructuring, and not for testing values within the streams.") + [(let [(pattern x y z _tail) (some_stream_func +1 +2 +3)] + (func x y z))]) + )) diff --git a/stdlib/source/documentation/lux/data/collection/tree.lux b/stdlib/source/documentation/lux/data/collection/tree.lux index 139d88ca3..ef03b419c 100644 --- a/stdlib/source/documentation/lux/data/collection/tree.lux +++ b/stdlib/source/documentation/lux/data/collection/tree.lux @@ -1,10 +1,12 @@ (.require [library - [lux (.except list) + [lux (.except) ["$" documentation] [data ["[0]" text (.only \n) - ["%" \\format (.only format)]]]]] + ["%" \\format (.only format)]] + [collection + ["[0]" list (.use "[1]#[0]" monoid)]]]]] ["[0]" \\parser] [\\library ["[0]" /]] @@ -12,78 +14,83 @@ ["[1][0]" finger] ["[1][0]" zipper]]) -(`` (.def \\parser - (.List $.Module) - ($.module \\parser._ - "" - [($.definition \\parser.cannot_move_further) +(`` (def \\parser + (List $.Documentation) + (list ($.module \\parser._ + "") - ($.definition (\\parser.Parser it) - "A parser of arbitrary trees.") + ($.definition \\parser.cannot_move_further) - ($.definition \\parser.result' - "Applies the parser against a tree zipper." - [(result' parser zipper)]) + ($.definition (\\parser.Parser it) + "A parser of arbitrary trees.") - ($.definition \\parser.result - "Applies the parser against a tree." - [(result parser tree)]) + ($.definition \\parser.result' + "Applies the parser against a tree zipper." + [(result' parser zipper)]) - ($.definition \\parser.value - "Yields the value inside the current tree node.") + ($.definition \\parser.result + "Applies the parser against a tree." + [(result parser tree)]) - (,, (with_template [<name> <doc>] - [($.definition <name> - <doc>)] + ($.definition \\parser.value + "Yields the value inside the current tree node.") - [\\parser.down "Move down."] - [\\parser.up "Move up."] + (,, (with_template [<name> <doc>] + [($.definition <name> + <doc>)] - [\\parser.right "Move to the right."] - [\\parser.rightmost "Move to the rightmost node."] + [\\parser.down "Move down."] + [\\parser.up "Move up."] - [\\parser.left "Move to the left."] - [\\parser.leftmost "Move to the leftmost node."] - - [\\parser.next "Move to the next node."] - [\\parser.end "Move to the last node."] - - [\\parser.previous "Move to the previous node."] - [\\parser.start "Move to the root node."] - ))] - []))) + [\\parser.right "Move to the right."] + [\\parser.rightmost "Move to the rightmost node."] + + [\\parser.left "Move to the left."] + [\\parser.leftmost "Move to the leftmost node."] + + [\\parser.next "Move to the next node."] + [\\parser.end "Move to the last node."] + + [\\parser.previous "Move to the previous node."] + [\\parser.start "Move to the root node."] + )) + ))) (.def .public documentation - (.List $.Module) - ($.module /._ - "" - [($.definition /.equivalence) - ($.definition /.functor) - ($.definition /.mix) - - ($.definition (/.Tree it) - "A generic tree data-structure.") - - ($.definition /.flat - "All the leaf values of the tree, in order." - [(flat tree)]) - - ($.definition /.leaf - "" - [(leaf value)]) - - ($.definition /.branch - "" - [(branch value children)]) - - ($.definition /.tree - "Tree literals." - [(is (Tree Nat) - (tree 12 - {34 {} - 56 {} - 78 {90 {}}}))])] - [..\\parser - - /finger.documentation - /zipper.documentation])) + (List $.Documentation) + (list.partial ($.module /._ + "") + + ($.definition /.equivalence) + ($.definition /.functor) + ($.definition /.mix) + + ($.definition (/.Tree it) + "A generic tree data-structure.") + + ($.definition /.flat + "All the leaf values of the tree, in order." + [(flat tree)]) + + ($.definition /.leaf + "" + [(leaf value)]) + + ($.definition /.branch + "" + [(branch value children)]) + + ($.definition /.tree + "Tree literals." + [(is (Tree Nat) + (tree 12 + {34 {} + 56 {} + 78 {90 {}}}))]) + + (all list#composite + ..\\parser + /finger.documentation + /zipper.documentation + ) + )) diff --git a/stdlib/source/documentation/lux/data/collection/tree/finger.lux b/stdlib/source/documentation/lux/data/collection/tree/finger.lux index cc6573633..dacba465b 100644 --- a/stdlib/source/documentation/lux/data/collection/tree/finger.lux +++ b/stdlib/source/documentation/lux/data/collection/tree/finger.lux @@ -1,6 +1,6 @@ (.require [library - [lux (.except list) + [lux (.except) ["$" documentation] [data ["[0]" text (.only \n) @@ -8,40 +8,41 @@ [\\library ["[0]" /]]) -(.def .public documentation - (.List $.Module) - ($.module /._ - "" - [($.definition /.tag) - ($.definition /.root) +(def .public documentation + (.List $.Documentation) + (list ($.module /._ + "") - ($.definition (/.Tree @ tag value) - "A finger tree.") + ($.definition /.tag) + ($.definition /.root) - ($.definition (/.Builder @ tag) - "A builder for finter tree structures.") + ($.definition (/.Tree @ tag value) + "A finger tree.") - ($.definition /.builder - "A new builder using the given monoid." - [(builder monoid)]) + ($.definition (/.Builder @ tag) + "A builder for finter tree structures.") - ($.definition /.value - "" - [(value tree)]) + ($.definition /.builder + "A new builder using the given monoid." + [(builder monoid)]) - ($.definition /.tags - "" - [(tags tree)]) + ($.definition /.value + "" + [(value tree)]) - ($.definition /.values - "" - [(values tree)]) + ($.definition /.tags + "" + [(tags tree)]) - ($.definition /.one - "Finds one value that meets the predicate." - [(one predicate tree)]) + ($.definition /.values + "" + [(values tree)]) - ($.definition /.exists? - "Verifies that a value exists which meets the predicate." - [(exists? predicate tree)])] - [])) + ($.definition /.one + "Finds one value that meets the predicate." + [(one predicate tree)]) + + ($.definition /.exists? + "Verifies that a value exists which meets the predicate." + [(exists? predicate tree)]) + )) diff --git a/stdlib/source/documentation/lux/data/collection/tree/zipper.lux b/stdlib/source/documentation/lux/data/collection/tree/zipper.lux index 7d33d944a..052f816fb 100644 --- a/stdlib/source/documentation/lux/data/collection/tree/zipper.lux +++ b/stdlib/source/documentation/lux/data/collection/tree/zipper.lux @@ -1,6 +1,6 @@ (.require [library - [lux (.except list) + [lux (.except) ["$" documentation] [data ["[0]" text (.only \n) @@ -8,50 +8,51 @@ [\\library ["[0]" /]]) -(.def .public documentation - (.List $.Module) - ($.module /._ - "" - [($.definition /.equivalence) - ($.definition /.zipper) - ($.definition /.tree) - ($.definition /.value) - ($.definition /.leaf?) - ($.definition /.branch?) - ($.definition /.start?) - ($.definition /.down) - ($.definition /.up) - ($.definition /.right) - ($.definition /.rightmost) - ($.definition /.left) - ($.definition /.leftmost) - ($.definition /.next) - ($.definition /.previous) - ($.definition /.end) - ($.definition /.start) - ($.definition /.end?) - ($.definition /.remove) - ($.definition /.insert_left) - ($.definition /.insert_right) - ($.definition /.functor) - ($.definition /.comonad) +(def .public documentation + (.List $.Documentation) + (list ($.module /._ + "") - ($.definition (/.Zipper it) - "Tree zippers, for easy navigation and editing of trees.") + ($.definition /.equivalence) + ($.definition /.zipper) + ($.definition /.tree) + ($.definition /.value) + ($.definition /.leaf?) + ($.definition /.branch?) + ($.definition /.start?) + ($.definition /.down) + ($.definition /.up) + ($.definition /.right) + ($.definition /.rightmost) + ($.definition /.left) + ($.definition /.leftmost) + ($.definition /.next) + ($.definition /.previous) + ($.definition /.end) + ($.definition /.start) + ($.definition /.end?) + ($.definition /.remove) + ($.definition /.insert_left) + ($.definition /.insert_right) + ($.definition /.functor) + ($.definition /.comonad) - ($.definition /.set - "" - [(set value zipper)]) + ($.definition (/.Zipper it) + "Tree zippers, for easy navigation and editing of trees.") - ($.definition /.update - "" - [(update transform zipper)]) + ($.definition /.set + "" + [(set value zipper)]) - ($.definition /.interpose - "" - [(interpose value zipper)]) + ($.definition /.update + "" + [(update transform zipper)]) - ($.definition /.adopt - "" - [(adopt value zipper)])] - [])) + ($.definition /.interpose + "" + [(interpose value zipper)]) + + ($.definition /.adopt + "" + [(adopt value zipper)]) + )) diff --git a/stdlib/source/documentation/lux/data/color.lux b/stdlib/source/documentation/lux/data/color.lux index 5c2f37e09..b6ed59dab 100644 --- a/stdlib/source/documentation/lux/data/color.lux +++ b/stdlib/source/documentation/lux/data/color.lux @@ -4,7 +4,9 @@ ["$" documentation] [data ["[0]" text (.only \n) - ["%" \\format (.only format)]]] + ["%" \\format (.only format)]] + [collection + ["[0]" list]]] [meta ["[0]" code (.only) ["<[1]>" \\parser]] @@ -20,88 +22,91 @@ (syntax (_ [[_ name] <code>.symbol]) (in (list (code.text (format "A " (text.replaced "_" "-" name) " palette.")))))) -(`` (.def .public documentation - (.List $.Module) - ($.module /._ - "" - [($.definition /.of_rgb) - ($.definition /.rgb) - ($.definition /.equivalence) - ($.definition /.hash) - ($.definition /.black) - ($.definition /.white) - ($.definition /.addition) - ($.definition /.subtraction) - ($.definition /.hsl) - ($.definition /.of_hsl) - ($.definition /.hsb) - ($.definition /.of_hsb) - ($.definition /.cmyk) - ($.definition /.of_cmyk) - ($.definition /.gray_scale) - ($.definition /.Spread) - ($.definition /.Palette) - ($.definition /.darker) - ($.definition /.brighter) - ($.definition /.saturated) - ($.definition /.un_saturated) - - ($.definition /.RGB - "Red-Green-Blue color format.") - - ($.definition /.HSL - "Hue-Saturation-Lightness color format.") - - ($.definition /.CMYK - "Cyan-Magenta-Yellow-Key color format.") - - ($.definition /.HSB - "Hue-Saturation-Brightness color format.") - - ($.definition /.Color - "A color value, independent of color format.") - - ($.definition /.complement - "The opposite color." - [(complement color)]) - - ($.definition /.interpolated - "" - [(interpolated ratio end start)]) - - ($.definition /.analogous - (palette_documentation /.analogous) - [(analogous spread variations color)]) - - ($.definition /.monochromatic - (palette_documentation /.monochromatic) - [(monochromatic spread variations color)]) - - ($.definition /.Alpha - "The degree of transparency of a pigment.") - - ($.definition /.transparent - "The maximum degree of transparency.") - - ($.definition /.translucent - "The average degree of transparency.") - - ($.definition /.opaque - "The minimum degree of transparency.") - - ($.definition /.Pigment - "A color with some degree of transparency.") - - (,, (with_template [<name>] - [(`` ($.definition <name> - (format "A " - (text.replaced "_" "-" (,, (template.text [<name>]))) - " color scheme.")))] - - [/.triad] - [/.clash] - [/.split_complement] - [/.square] - [/.tetradic] - ))] - [/named.documentation]))) +(`` (def .public documentation + (List $.Documentation) + (list.partial ($.module /._ + "") + + ($.definition /.of_rgb) + ($.definition /.rgb) + ($.definition /.equivalence) + ($.definition /.hash) + ($.definition /.black) + ($.definition /.white) + ($.definition /.addition) + ($.definition /.subtraction) + ($.definition /.hsl) + ($.definition /.of_hsl) + ($.definition /.hsb) + ($.definition /.of_hsb) + ($.definition /.cmyk) + ($.definition /.of_cmyk) + ($.definition /.gray_scale) + ($.definition /.Spread) + ($.definition /.Palette) + ($.definition /.darker) + ($.definition /.brighter) + ($.definition /.saturated) + ($.definition /.un_saturated) + + ($.definition /.RGB + "Red-Green-Blue color format.") + + ($.definition /.HSL + "Hue-Saturation-Lightness color format.") + + ($.definition /.CMYK + "Cyan-Magenta-Yellow-Key color format.") + + ($.definition /.HSB + "Hue-Saturation-Brightness color format.") + + ($.definition /.Color + "A color value, independent of color format.") + + ($.definition /.complement + "The opposite color." + [(complement color)]) + + ($.definition /.interpolated + "" + [(interpolated ratio end start)]) + + ($.definition /.analogous + (palette_documentation /.analogous) + [(analogous spread variations color)]) + + ($.definition /.monochromatic + (palette_documentation /.monochromatic) + [(monochromatic spread variations color)]) + + ($.definition /.Alpha + "The degree of transparency of a pigment.") + + ($.definition /.transparent + "The maximum degree of transparency.") + + ($.definition /.translucent + "The average degree of transparency.") + + ($.definition /.opaque + "The minimum degree of transparency.") + + ($.definition /.Pigment + "A color with some degree of transparency.") + + (,, (with_template [<name>] + [(`` ($.definition <name> + (format "A " + (text.replaced "_" "-" (,, (template.text [<name>]))) + " color scheme.")))] + + [/.triad] + [/.clash] + [/.split_complement] + [/.square] + [/.tetradic] + )) + + /named.documentation + ))) diff --git a/stdlib/source/documentation/lux/data/color/named.lux b/stdlib/source/documentation/lux/data/color/named.lux index 239281ab1..4ed4c3324 100644 --- a/stdlib/source/documentation/lux/data/color/named.lux +++ b/stdlib/source/documentation/lux/data/color/named.lux @@ -12,159 +12,160 @@ ["[0]" / (.only) ["/[1]" //]]]) -(`` (.def .public documentation - (.List $.Module) - ($.module /._ - "" - [(,, (with_template [<name>] - [($.definition <name> - (let [[red green blue] (//.rgb <name>) - [_ name] (symbol <name>)] - (format "R:" (hex#encoded red) - " G:" (hex#encoded green) - " B:" (hex#encoded blue) - " | " (text.replaced "_" " " name))))] +(`` (def .public documentation + (List $.Documentation) + (list ($.module /._ + "") - [/.alice_blue] - [/.antique_white] - [/.aqua] - [/.aquamarine] - [/.azure] - [/.beige] - [/.bisque] - [/.black] - [/.blanched_almond] - [/.blue] - [/.blue_violet] - [/.brown] - [/.burly_wood] - [/.cadet_blue] - [/.chartreuse] - [/.chocolate] - [/.coral] - [/.cornflower_blue] - [/.cornsilk] - [/.crimson] - [/.cyan] - [/.dark_blue] - [/.dark_cyan] - [/.dark_goldenrod] - [/.dark_gray] - [/.dark_green] - [/.dark_khaki] - [/.dark_magenta] - [/.dark_olive_green] - [/.dark_orange] - [/.dark_orchid] - [/.dark_red] - [/.dark_salmon] - [/.dark_sea_green] - [/.dark_slate_blue] - [/.dark_slate_gray] - [/.dark_turquoise] - [/.dark_violet] - [/.deep_pink] - [/.deep_sky_blue] - [/.dim_gray] - [/.dodger_blue] - [/.fire_brick] - [/.floral_white] - [/.forest_green] - [/.fuchsia] - [/.gainsboro] - [/.ghost_white] - [/.gold] - [/.goldenrod] - [/.gray] - [/.green] - [/.green_yellow] - [/.honey_dew] - [/.hot_pink] - [/.indian_red] - [/.indigo] - [/.ivory] - [/.khaki] - [/.lavender] - [/.lavender_blush] - [/.lawn_green] - [/.lemon_chiffon] - [/.light_blue] - [/.light_coral] - [/.light_cyan] - [/.light_goldenrod_yellow] - [/.light_gray] - [/.light_green] - [/.light_pink] - [/.light_salmon] - [/.light_sea_green] - [/.light_sky_blue] - [/.light_slate_gray] - [/.light_steel_blue] - [/.light_yellow] - [/.lime] - [/.lime_green] - [/.linen] - [/.magenta] - [/.maroon] - [/.medium_aquamarine] - [/.medium_blue] - [/.medium_orchid] - [/.medium_purple] - [/.medium_sea_green] - [/.medium_slate_blue] - [/.medium_spring_green] - [/.medium_turquoise] - [/.medium_violet_red] - [/.midnight_blue] - [/.mint_cream] - [/.misty_rose] - [/.moccasin] - [/.navajo_white] - [/.navy] - [/.old_lace] - [/.olive] - [/.olive_drab] - [/.orange] - [/.orange_red] - [/.orchid] - [/.pale_goldenrod] - [/.pale_green] - [/.pale_turquoise] - [/.pale_violet_red] - [/.papaya_whip] - [/.peach_puff] - [/.peru] - [/.pink] - [/.plum] - [/.powder_blue] - [/.purple] - [/.rebecca_purple] - [/.red] - [/.rosy_brown] - [/.royal_blue] - [/.saddle_brown] - [/.salmon] - [/.sandy_brown] - [/.sea_green] - [/.sea_shell] - [/.sienna] - [/.silver] - [/.sky_blue] - [/.slate_blue] - [/.slate_gray] - [/.snow] - [/.spring_green] - [/.steel_blue] - [/.tan] - [/.teal] - [/.thistle] - [/.tomato] - [/.turquoise] - [/.violet] - [/.wheat] - [/.white] - [/.white_smoke] - [/.yellow] - [/.yellow_green] - ))] - []))) + (,, (with_template [<name>] + [($.definition <name> + (let [[red green blue] (//.rgb <name>) + [_ name] (symbol <name>)] + (format "R:" (hex#encoded red) + " G:" (hex#encoded green) + " B:" (hex#encoded blue) + " | " (text.replaced "_" " " name))))] + + [/.alice_blue] + [/.antique_white] + [/.aqua] + [/.aquamarine] + [/.azure] + [/.beige] + [/.bisque] + [/.black] + [/.blanched_almond] + [/.blue] + [/.blue_violet] + [/.brown] + [/.burly_wood] + [/.cadet_blue] + [/.chartreuse] + [/.chocolate] + [/.coral] + [/.cornflower_blue] + [/.cornsilk] + [/.crimson] + [/.cyan] + [/.dark_blue] + [/.dark_cyan] + [/.dark_goldenrod] + [/.dark_gray] + [/.dark_green] + [/.dark_khaki] + [/.dark_magenta] + [/.dark_olive_green] + [/.dark_orange] + [/.dark_orchid] + [/.dark_red] + [/.dark_salmon] + [/.dark_sea_green] + [/.dark_slate_blue] + [/.dark_slate_gray] + [/.dark_turquoise] + [/.dark_violet] + [/.deep_pink] + [/.deep_sky_blue] + [/.dim_gray] + [/.dodger_blue] + [/.fire_brick] + [/.floral_white] + [/.forest_green] + [/.fuchsia] + [/.gainsboro] + [/.ghost_white] + [/.gold] + [/.goldenrod] + [/.gray] + [/.green] + [/.green_yellow] + [/.honey_dew] + [/.hot_pink] + [/.indian_red] + [/.indigo] + [/.ivory] + [/.khaki] + [/.lavender] + [/.lavender_blush] + [/.lawn_green] + [/.lemon_chiffon] + [/.light_blue] + [/.light_coral] + [/.light_cyan] + [/.light_goldenrod_yellow] + [/.light_gray] + [/.light_green] + [/.light_pink] + [/.light_salmon] + [/.light_sea_green] + [/.light_sky_blue] + [/.light_slate_gray] + [/.light_steel_blue] + [/.light_yellow] + [/.lime] + [/.lime_green] + [/.linen] + [/.magenta] + [/.maroon] + [/.medium_aquamarine] + [/.medium_blue] + [/.medium_orchid] + [/.medium_purple] + [/.medium_sea_green] + [/.medium_slate_blue] + [/.medium_spring_green] + [/.medium_turquoise] + [/.medium_violet_red] + [/.midnight_blue] + [/.mint_cream] + [/.misty_rose] + [/.moccasin] + [/.navajo_white] + [/.navy] + [/.old_lace] + [/.olive] + [/.olive_drab] + [/.orange] + [/.orange_red] + [/.orchid] + [/.pale_goldenrod] + [/.pale_green] + [/.pale_turquoise] + [/.pale_violet_red] + [/.papaya_whip] + [/.peach_puff] + [/.peru] + [/.pink] + [/.plum] + [/.powder_blue] + [/.purple] + [/.rebecca_purple] + [/.red] + [/.rosy_brown] + [/.royal_blue] + [/.saddle_brown] + [/.salmon] + [/.sandy_brown] + [/.sea_green] + [/.sea_shell] + [/.sienna] + [/.silver] + [/.sky_blue] + [/.slate_blue] + [/.slate_gray] + [/.snow] + [/.spring_green] + [/.steel_blue] + [/.tan] + [/.teal] + [/.thistle] + [/.tomato] + [/.turquoise] + [/.violet] + [/.wheat] + [/.white] + [/.white_smoke] + [/.yellow] + [/.yellow_green] + )) + ))) diff --git a/stdlib/source/documentation/lux/data/format.lux b/stdlib/source/documentation/lux/data/format.lux index 7dbf22055..b1aaea3b6 100644 --- a/stdlib/source/documentation/lux/data/format.lux +++ b/stdlib/source/documentation/lux/data/format.lux @@ -12,8 +12,8 @@ ["[1][0]" tar] ["[1][0]" xml]]) -(.def .public documentation - (.List $.Module) +(def .public documentation + (List $.Documentation) (list.together (list /json.documentation /tar.documentation diff --git a/stdlib/source/documentation/lux/data/format/json.lux b/stdlib/source/documentation/lux/data/format/json.lux index 93bc3add9..48a62f2e0 100644 --- a/stdlib/source/documentation/lux/data/format/json.lux +++ b/stdlib/source/documentation/lux/data/format/json.lux @@ -4,7 +4,9 @@ ["$" documentation] [data [text (.only \n) - ["%" \\format (.only format)]]] + ["%" \\format (.only format)]] + [collection + ["[0]" list]]] [meta [macro ["[0]" template]]]]] @@ -12,122 +14,126 @@ [\\library ["[0]" /]]) -(`` (.def \\parser - (.List $.Module) - ($.module \\parser._ - "" - [($.definition \\parser.unconsumed_input) - ($.definition \\parser.empty_input) - ($.definition \\parser.unexpected_value) - ($.definition \\parser.value_mismatch) - - ($.definition (\\parser.Parser it) - "A JSON parser.") - - ($.definition \\parser.result - (format "Executes the parser against a JSON object." - \n "Verifies that all of the JSON was consumed by the parser.") - [(result parser json)]) - - ($.definition \\parser.any - "Just returns the JSON input without applying any logic.") - - (,, (with_template [<name>] - [(`` ($.definition <name> - (format "Reads a JSON value as " (,, (template.text [<name>])) ".")))] - - [\\parser.null] - [\\parser.boolean] - [\\parser.number] - [\\parser.string] - )) - - (,, (with_template [<test> <check> <read>] - [(`` ($.definition <test> - (format "Asks whether a JSON value is a " (,, (template.text [<read>])) "."))) - (`` ($.definition <check> - (format "Ensures a JSON value is a " (,, (template.text [<read>])) ".")))] - - [\\parser.boolean? \\parser.this_boolean ..boolean] - [\\parser.number? \\parser.this_number ..number] - [\\parser.string? \\parser.this_string ..string] - )) - - ($.definition \\parser.nullable - "Enhances parser by adding NULL-handling." - [(nullable parser)]) - - ($.definition \\parser.array - "Parses the contents of a JSON array." - [(array parser)]) - - ($.definition \\parser.object - (format "Parses the contents of a JSON object." - \n "Use this with the 'field' combinator.") - [(object parser)]) - - ($.definition \\parser.field - (format "Parses a field inside a JSON object." - \n "Use this inside the 'object' combinator.") - [(field field_name parser)]) - - ($.definition \\parser.dictionary - "Parses a dictionary-like JSON object.")] - []))) +(`` (def \\parser + (List $.Documentation) + (list ($.module \\parser._ + "") + + ($.definition \\parser.unconsumed_input) + ($.definition \\parser.empty_input) + ($.definition \\parser.unexpected_value) + ($.definition \\parser.value_mismatch) + + ($.definition (\\parser.Parser it) + "A JSON parser.") + + ($.definition \\parser.result + (format "Executes the parser against a JSON object." + \n "Verifies that all of the JSON was consumed by the parser.") + [(result parser json)]) + + ($.definition \\parser.any + "Just returns the JSON input without applying any logic.") + + (,, (with_template [<name>] + [(`` ($.definition <name> + (format "Reads a JSON value as " (,, (template.text [<name>])) ".")))] + + [\\parser.null] + [\\parser.boolean] + [\\parser.number] + [\\parser.string] + )) + + (,, (with_template [<test> <check> <read>] + [(`` ($.definition <test> + (format "Asks whether a JSON value is a " (,, (template.text [<read>])) "."))) + (`` ($.definition <check> + (format "Ensures a JSON value is a " (,, (template.text [<read>])) ".")))] + + [\\parser.boolean? \\parser.this_boolean ..boolean] + [\\parser.number? \\parser.this_number ..number] + [\\parser.string? \\parser.this_string ..string] + )) + + ($.definition \\parser.nullable + "Enhances parser by adding NULL-handling." + [(nullable parser)]) + + ($.definition \\parser.array + "Parses the contents of a JSON array." + [(array parser)]) + + ($.definition \\parser.object + (format "Parses the contents of a JSON object." + \n "Use this with the 'field' combinator.") + [(object parser)]) + + ($.definition \\parser.field + (format "Parses a field inside a JSON object." + \n "Use this inside the 'object' combinator.") + [(field field_name parser)]) + + ($.definition \\parser.dictionary + "Parses a dictionary-like JSON object.") + ))) (`` (.def .public documentation - (.List $.Module) - ($.module /._ - (format "Functionality for reading and writing values in the JSON format." - \n "For more information, please see: http://www.json.org/") - [($.definition /.Null) - ($.definition /.Boolean) - ($.definition /.Number) - ($.definition /.String) - ($.definition /.JSON) - ($.definition /.Array) - ($.definition /.Object) - ($.definition /.null?) - ($.definition /.object) - ($.definition /.equivalence) - ($.definition /.format) - ($.definition /.codec) - - ($.definition /.json - "A simple way to produce JSON literals." - ["null" - (json #null)] - ["true" - (json #1)] - ["123.456" - (json +123.456)] - ["'this is a string'" - (json "this is a string")] - ["['this' 'is' 'an' 'array']" - (json ["this" "is" "an" "array"])] - ["{'this' 'is', 'an' 'object'}" - (json {"this" "is" "an" "object"})]) - - ($.definition /.fields - "Get all the fields in a JSON object." - [(fields json)]) - - ($.definition /.field - "A JSON object field getter." - [(field key json)]) - - ($.definition /.has - "A JSON object field setter." - [(has key value json)]) - - (,, (with_template [<name> <desc>] - [($.definition <name> - (format "A JSON object field getter for " <desc> "."))] - - [/.boolean_field "booleans"] - [/.number_field "numbers"] - [/.string_field "strings"] - [/.array_field "arrays"] - [/.object_field "objects"] - ))] - [..\\parser]))) + (List $.Documentation) + (list.partial ($.module /._ + (format "Functionality for reading and writing values in the JSON format." + \n "For more information, please see: http://www.json.org/")) + + ($.definition /.Null) + ($.definition /.Boolean) + ($.definition /.Number) + ($.definition /.String) + ($.definition /.JSON) + ($.definition /.Array) + ($.definition /.Object) + ($.definition /.null?) + ($.definition /.object) + ($.definition /.equivalence) + ($.definition /.format) + ($.definition /.codec) + + ($.definition /.json + "A simple way to produce JSON literals." + ["null" + (json #null)] + ["true" + (json #1)] + ["123.456" + (json +123.456)] + ["'this is a string'" + (json "this is a string")] + ["['this' 'is' 'an' 'array']" + (json ["this" "is" "an" "array"])] + ["{'this' 'is', 'an' 'object'}" + (json {"this" "is" "an" "object"})]) + + ($.definition /.fields + "Get all the fields in a JSON object." + [(fields json)]) + + ($.definition /.field + "A JSON object field getter." + [(field key json)]) + + ($.definition /.has + "A JSON object field setter." + [(has key value json)]) + + (,, (with_template [<name> <desc>] + [($.definition <name> + (format "A JSON object field getter for " <desc> "."))] + + [/.boolean_field "booleans"] + [/.number_field "numbers"] + [/.string_field "strings"] + [/.array_field "arrays"] + [/.object_field "objects"] + )) + + ..\\parser + ))) diff --git a/stdlib/source/documentation/lux/data/format/tar.lux b/stdlib/source/documentation/lux/data/format/tar.lux index 9de7d8ca9..ec8c7f373 100644 --- a/stdlib/source/documentation/lux/data/format/tar.lux +++ b/stdlib/source/documentation/lux/data/format/tar.lux @@ -8,79 +8,80 @@ [\\library ["[0]" /]]) -(.def .public documentation - (.List $.Module) - ($.module /._ - "" - [($.definition /.not_a_small_number) - ($.definition /.small_limit) - ($.definition /.Small) - ($.definition /.small) - ($.definition /.from_small) +(def .public documentation + (List $.Documentation) + (list ($.module /._ + "") - ($.definition /.not_a_big_number) - ($.definition /.big_limit) - ($.definition /.Big) - ($.definition /.big) - ($.definition /.from_big) + ($.definition /.not_a_small_number) + ($.definition /.small_limit) + ($.definition /.Small) + ($.definition /.small) + ($.definition /.from_small) - ($.definition /.wrong_character) - ($.definition /.not_ascii) - ($.definition /.name_size) - ($.definition /.path_size) + ($.definition /.not_a_big_number) + ($.definition /.big_limit) + ($.definition /.Big) + ($.definition /.big) + ($.definition /.from_big) - ($.definition /.Name) - ($.definition /.name_is_too_long) - ($.definition /.name) - ($.definition /.from_name) - ($.definition /.anonymous) + ($.definition /.wrong_character) + ($.definition /.not_ascii) + ($.definition /.name_size) + ($.definition /.path_size) - ($.definition /.Path) - ($.definition /.path_is_too_long) - ($.definition /.path) - ($.definition /.from_path) - ($.definition /.no_path) + ($.definition /.Name) + ($.definition /.name_is_too_long) + ($.definition /.name) + ($.definition /.from_name) + ($.definition /.anonymous) - ($.definition /.invalid_link_flag) - ($.definition /.Mode) - ($.definition /.mode) - ($.definition /.and) - ($.definition /.invalid_mode) + ($.definition /.Path) + ($.definition /.path_is_too_long) + ($.definition /.path) + ($.definition /.from_path) + ($.definition /.no_path) - ($.definition /.none) - - ($.definition /.execute_by_other) - ($.definition /.write_by_other) - ($.definition /.read_by_other) + ($.definition /.invalid_link_flag) + ($.definition /.Mode) + ($.definition /.mode) + ($.definition /.and) + ($.definition /.invalid_mode) - ($.definition /.execute_by_group) - ($.definition /.write_by_group) - ($.definition /.read_by_group) + ($.definition /.none) + + ($.definition /.execute_by_other) + ($.definition /.write_by_other) + ($.definition /.read_by_other) - ($.definition /.execute_by_owner) - ($.definition /.write_by_owner) - ($.definition /.read_by_owner) + ($.definition /.execute_by_group) + ($.definition /.write_by_group) + ($.definition /.read_by_group) - ($.definition /.save_text) - ($.definition /.set_group_id_on_execution) - ($.definition /.set_user_id_on_execution) - - ($.definition /.Content) - ($.definition /.content) - ($.definition /.data) - ($.definition /.ID) - ($.definition /.no_id) - ($.definition /.Owner) - ($.definition /.Ownership) - ($.definition /.File) - ($.definition /.Normal) - ($.definition /.Symbolic_Link) - ($.definition /.Directory) - ($.definition /.Contiguous) - ($.definition /.Entry) - ($.definition /.Tar) - ($.definition /.format) - ($.definition /.wrong_checksum) - ($.definition /.invalid_end_of_archive) - ($.definition /.parser)] - [])) + ($.definition /.execute_by_owner) + ($.definition /.write_by_owner) + ($.definition /.read_by_owner) + + ($.definition /.save_text) + ($.definition /.set_group_id_on_execution) + ($.definition /.set_user_id_on_execution) + + ($.definition /.Content) + ($.definition /.content) + ($.definition /.data) + ($.definition /.ID) + ($.definition /.no_id) + ($.definition /.Owner) + ($.definition /.Ownership) + ($.definition /.File) + ($.definition /.Normal) + ($.definition /.Symbolic_Link) + ($.definition /.Directory) + ($.definition /.Contiguous) + ($.definition /.Entry) + ($.definition /.Tar) + ($.definition /.format) + ($.definition /.wrong_checksum) + ($.definition /.invalid_end_of_archive) + ($.definition /.parser) + )) diff --git a/stdlib/source/documentation/lux/data/format/xml.lux b/stdlib/source/documentation/lux/data/format/xml.lux index 60c2841e9..22c80ea1f 100644 --- a/stdlib/source/documentation/lux/data/format/xml.lux +++ b/stdlib/source/documentation/lux/data/format/xml.lux @@ -4,70 +4,76 @@ ["$" documentation] [data [text (.only \n) - ["%" \\format (.only format)]]]]] + ["%" \\format (.only format)]] + [collection + ["[0]" list]]]]] ["[0]" \\parser] [\\library ["[0]" /]]) -(.def \\parser - (.List $.Module) - ($.module \\parser._ - "" - [($.definition \\parser.empty_input) - ($.definition \\parser.unexpected_input) - ($.definition \\parser.wrong_tag) - ($.definition \\parser.unknown_attribute) - ($.definition \\parser.unconsumed_inputs) - ($.definition \\parser.nowhere) - - ($.definition (\\parser.Parser it) - "A parser of XML-encoded data.") - - ($.definition \\parser.result - (format "Applies a parser against a stream of XML documents." - \n "Verifies that all of the inputs are consumed by the parser.") - [(result parser documents)]) - - ($.definition \\parser.text - "Yields text from a text node.") - - ($.definition \\parser.tag - "Yields the tag from the next node.") - - ($.definition \\parser.attribute - "Yields the value of an attribute in the current node." - [(attribute name)]) - - ($.definition \\parser.node - "Parses the contents of the next node if the tag matches." - [(node expected parser)]) - - ($.definition \\parser.any - "Yields the next node.") - - ($.definition \\parser.somewhere - "Applies the parser somewhere among the remaining inputs; instead of demanding that the parser succeeds against the immediate inputs." - [(somewhere parser)])] - [])) - -(.def .public documentation - (.List $.Module) - ($.module /._ - "" - [($.definition /.Tag) - ($.definition /.Attribute) - ($.definition /.Attrs) - ($.definition /.XML) - ($.definition /.codec) - ($.definition /.equivalence) - - ($.definition /.attributes - "An empty set of XML attributes.") - - ($.definition /.tag - "The text format of a XML tag." - [(tag name)]) - - ($.definition /.attribute - "The text format of a XML attribute.")] - [..\\parser])) +(def \\parser + (List $.Documentation) + (list ($.module \\parser._ + "") + + ($.definition \\parser.empty_input) + ($.definition \\parser.unexpected_input) + ($.definition \\parser.wrong_tag) + ($.definition \\parser.unknown_attribute) + ($.definition \\parser.unconsumed_inputs) + ($.definition \\parser.nowhere) + + ($.definition (\\parser.Parser it) + "A parser of XML-encoded data.") + + ($.definition \\parser.result + (format "Applies a parser against a stream of XML documents." + \n "Verifies that all of the inputs are consumed by the parser.") + [(result parser documents)]) + + ($.definition \\parser.text + "Yields text from a text node.") + + ($.definition \\parser.tag + "Yields the tag from the next node.") + + ($.definition \\parser.attribute + "Yields the value of an attribute in the current node." + [(attribute name)]) + + ($.definition \\parser.node + "Parses the contents of the next node if the tag matches." + [(node expected parser)]) + + ($.definition \\parser.any + "Yields the next node.") + + ($.definition \\parser.somewhere + "Applies the parser somewhere among the remaining inputs; instead of demanding that the parser succeeds against the immediate inputs." + [(somewhere parser)]) + )) + +(def .public documentation + (List $.Documentation) + (list.partial ($.module /._ + "") + + ($.definition /.Tag) + ($.definition /.Attribute) + ($.definition /.Attrs) + ($.definition /.XML) + ($.definition /.codec) + ($.definition /.equivalence) + + ($.definition /.attributes + "An empty set of XML attributes.") + + ($.definition /.tag + "The text format of a XML tag." + [(tag name)]) + + ($.definition /.attribute + "The text format of a XML attribute.") + + ..\\parser + )) diff --git a/stdlib/source/documentation/lux/data/identity.lux b/stdlib/source/documentation/lux/data/identity.lux index acf3d9bed..c150d7d97 100644 --- a/stdlib/source/documentation/lux/data/identity.lux +++ b/stdlib/source/documentation/lux/data/identity.lux @@ -1,6 +1,6 @@ (.require [library - [lux (.except nat int rev list or and) + [lux (.except) ["$" documentation] [data [text (.only \n) @@ -8,15 +8,16 @@ [\\library ["[0]" /]]) -(.def .public documentation - (.List $.Module) - ($.module /._ - "" - [($.definition /.functor) - ($.definition /.apply) - ($.definition /.monad) - ($.definition /.comonad) +(def .public documentation + (List $.Documentation) + (list ($.module /._ + "") - ($.definition (/.Identity it) - "A value, as is, without any extra structure super-imposed on it.")] - [])) + ($.definition /.functor) + ($.definition /.apply) + ($.definition /.monad) + ($.definition /.comonad) + + ($.definition (/.Identity it) + "A value, as is, without any extra structure super-imposed on it.") + )) diff --git a/stdlib/source/documentation/lux/data/product.lux b/stdlib/source/documentation/lux/data/product.lux index 05cb39ca8..a589fdd9c 100644 --- a/stdlib/source/documentation/lux/data/product.lux +++ b/stdlib/source/documentation/lux/data/product.lux @@ -1,6 +1,6 @@ (.require [library - [lux (.except left right) + [lux (.except) ["$" documentation] [data [text @@ -8,36 +8,37 @@ [\\library ["[0]" /]]) -(.def .public documentation - (.List $.Module) - ($.module /._ - "Functionality for working with tuples (particularly 2-tuples/pairs)." - [($.definition /.equivalence) - ($.definition /.hash) +(def .public documentation + (List $.Documentation) + (list ($.module /._ + "Functionality for working with tuples (particularly 2-tuples/pairs).") - ($.definition /.left - "The left side of a pair.") + ($.definition /.equivalence) + ($.definition /.hash) - ($.definition /.right - "The right side of a pair.") + ($.definition /.left + "The left side of a pair.") - ($.definition /.curried - "Converts a 2-argument function into nested single-argument functions." - [(curried f)]) + ($.definition /.right + "The right side of a pair.") - ($.definition /.uncurried - "Converts nested single-argument functions into a 2-argument function." - [(uncurried f)]) + ($.definition /.curried + "Converts a 2-argument function into nested single-argument functions." + [(curried f)]) - ($.definition /.swapped - "" - [(swapped [left right])]) + ($.definition /.uncurried + "Converts nested single-argument functions into a 2-argument function." + [(uncurried f)]) - ($.definition /.then - "Apply functions to both sides of a pair." - [(then f g)]) + ($.definition /.swapped + "" + [(swapped [left right])]) - ($.definition /.forked - "Yields a pair by applying both functions to a single value." - [(forked f g)])] - [])) + ($.definition /.then + "Apply functions to both sides of a pair." + [(then f g)]) + + ($.definition /.forked + "Yields a pair by applying both functions to a single value." + [(forked f g)]) + )) diff --git a/stdlib/source/documentation/lux/data/sum.lux b/stdlib/source/documentation/lux/data/sum.lux index b7a41851d..973522394 100644 --- a/stdlib/source/documentation/lux/data/sum.lux +++ b/stdlib/source/documentation/lux/data/sum.lux @@ -1,6 +1,6 @@ (.require [library - [lux (.except left right) + [lux (.except) ["$" documentation] [data [text (.only \n) @@ -8,27 +8,28 @@ [\\library ["[0]" /]]) -(.def .public documentation - (.List $.Module) - ($.module /._ - "Functionality for working with variants (particularly 2-variants)." - [($.definition /.lefts) - ($.definition /.rights) - ($.definition /.partition) - ($.definition /.equivalence) - ($.definition /.hash) +(def .public documentation + (List $.Documentation) + (list ($.module /._ + "Functionality for working with variants (particularly 2-variants).") - ($.definition /.left - "Lifts value to the left side of a 2-variant.") + ($.definition /.lefts) + ($.definition /.rights) + ($.definition /.partition) + ($.definition /.equivalence) + ($.definition /.hash) - ($.definition /.right - "Lifts value to the right side of a 2-variant.") + ($.definition /.left + "Lifts value to the left side of a 2-variant.") - ($.definition /.either - "Applies a function to either side of a 2-variant." - [(either on_left on_right)]) + ($.definition /.right + "Lifts value to the right side of a 2-variant.") - ($.definition /.then - "Applies functions to both sides of a 2-variant." - [(then on_left on_right)])] - [])) + ($.definition /.either + "Applies a function to either side of a 2-variant." + [(either on_left on_right)]) + + ($.definition /.then + "Applies functions to both sides of a 2-variant." + [(then on_left on_right)]) + )) diff --git a/stdlib/source/documentation/lux/data/text.lux b/stdlib/source/documentation/lux/data/text.lux index f5271ed99..10b2616a7 100644 --- a/stdlib/source/documentation/lux/data/text.lux +++ b/stdlib/source/documentation/lux/data/text.lux @@ -2,6 +2,9 @@ [library [lux (.except) ["$" documentation] + [data + [collection + ["[0]" list (.use "[1]#[0]" monoid)]]] [meta [macro ["[0]" template]]]]] @@ -16,352 +19,359 @@ [\\library ["[0]" / (.only \n)]]) -(.def \\format - (.List $.Module) - ($.module \\format._ - "" - [($.definition \\format.functor) - - ($.definition \\format.bit) - ($.definition \\format.nat) - ($.definition \\format.int) - ($.definition \\format.rev) - ($.definition \\format.frac) - ($.definition \\format.text) - - ($.definition \\format.ratio) - ($.definition \\format.symbol) - ($.definition \\format.location) - ($.definition \\format.code) - ($.definition \\format.type) - - ($.definition \\format.instant) - ($.definition \\format.duration) - ($.definition \\format.date) - ($.definition \\format.time) - ($.definition \\format.day) - ($.definition \\format.month) - - ($.definition \\format.xml) - ($.definition \\format.json) - - ($.definition \\format.nat_2) - ($.definition \\format.nat_8) - ($.definition \\format.nat_10) - ($.definition \\format.nat_16) - ($.definition \\format.int_2) - ($.definition \\format.int_8) - ($.definition \\format.int_10) - ($.definition \\format.int_16) - ($.definition \\format.rev_2) - ($.definition \\format.rev_8) - ($.definition \\format.rev_10) - ($.definition \\format.rev_16) - ($.definition \\format.frac_2) - ($.definition \\format.frac_8) - ($.definition \\format.frac_10) - ($.definition \\format.frac_16) - - ($.definition \\format.mod) - ($.definition \\format.list) - ($.definition \\format.maybe) - - ($.definition (\\format.Format it) - "A way to produce readable text from values.") - - ($.definition \\format.format - "Text interpolation." - [(format "Static part " (text static) " does not match URI: " uri)])] - [])) - -(`` (.def \\parser - (.List $.Module) - ($.module \\parser._ - "" - [($.definition \\parser.unconsumed_input) - ($.definition \\parser.expected_to_fail) - ($.definition \\parser.cannot_parse) - ($.definition \\parser.cannot_slice) - ($.definition \\parser.cannot_match) - ($.definition \\parser.character_should_be) - ($.definition \\parser.character_should_not_be) - ($.definition \\parser.character_does_not_satisfy_predicate) - - ($.definition \\parser.Offset - "An offset into a block of text.") - - ($.definition (\\parser.Parser it) - "A parser for text.") - - ($.definition \\parser.Slice - "A slice of a block of text.") - - ($.definition \\parser.result - (format "Executes a parser against a block of text." - \n "Verifies that the entire input has been processed.") - [(result parser input)]) - - ($.definition \\parser.offset - "Yields the current offset into the input.") - - ($.definition \\parser.any - "Yields the next character without applying any logic.") - - ($.definition \\parser.any! - "Yields the next character (as a slice) without applying any logic.") - - (,, (with_template [<name> <caveat>] - [(`` ($.definition <name> - (format "Produce a character" (,, (template.text [<caveat>])) " if the parser fails.")))] - - [\\parser.not ""] - [\\parser.not! " (as a slice)"] - )) - - ($.definition \\parser.this - "Checks that a specific text shows up in the input." - [(this reference)]) - - ($.definition \\parser.end - "Ensure the parser's input is empty.") - - ($.definition \\parser.next - "Yields the next character (without consuming it from the input).") - - ($.definition \\parser.remaining - "Get all of the remaining input (without consuming it).") - - ($.definition \\parser.range - "Only yields characters within a range." - [(range bottom top)]) - - (,, (with_template [<name> <desc>] - [($.definition <name> - (format "Only yields " <desc> " characters."))] - - [\\parser.upper "uppercase"] - [\\parser.lower "lowercase"] - [\\parser.decimal "decimal"] - [\\parser.octal "octal"] - )) - - ($.definition \\parser.alpha - "Yields alphabetic characters.") - - ($.definition \\parser.alpha_num - "Yields alphanumeric characters.") - - ($.definition \\parser.hexadecimal - "Yields hexadecimal digits.") - - (,, (with_template [<name> <description_modifier>] - [($.definition <name> - (format "Yields characters that are" <description_modifier> " part of a piece of text."))] - - [\\parser.one_of ""] - [\\parser.none_of " not"] - )) - - (,, (with_template [<name> <description_modifier>] - [($.definition <name> - (format "Yields characters (as a slice) that are" <description_modifier> " part of a piece of text."))] - - [\\parser.one_of! ""] - [\\parser.none_of! " not"] - )) - - ($.definition \\parser.satisfies - "Yields characters that satisfy a predicate." - [(satisfies parser)]) - - ($.definition \\parser.space - "Yields white-space.") - - ($.definition \\parser.and - "Yields the outputs of both parsers composed together." - [(and left right)]) - - ($.definition \\parser.and! - "Yields the outputs of both parsers composed together (as a slice)." - [(and! left right)]) - - (,, (with_template [<text> <slice>] - [(`` ($.definition <text> - (format "Yields " (,, (template.text [<name>])) " characters as a single continuous text."))) - (`` ($.definition <slice> - (format "Yields " (,, (template.text [<name>])) " characters as a single continuous text (as a slice).")))] - - [\\parser.some \\parser.some!] - [\\parser.many \\parser.many!] - )) - - (,, (with_template [<text> <slice> <doc_modifier>] - [(`` ($.definition <text> - (format "Yields " <doc_modifier> " N characters."))) - (`` ($.definition <slice> - (format "Yields " <doc_modifier> " N characters (as a slice).")))] - - [\\parser.exactly \\parser.exactly! "exactly"] - [\\parser.at_most \\parser.at_most! "at most"] - [\\parser.at_least \\parser.at_least! "at least"] - )) - - ($.definition \\parser.between - "" - [(between minimum additional parser)]) - - ($.definition \\parser.between! - "" - [(between! minimum additional parser)]) - - ($.definition \\parser.enclosed - "" - [(enclosed [start end] parser)]) - - ($.definition \\parser.local - "Applies a parser against the given input." - [(local local_input parser)]) - - ($.definition \\parser.slice - "Converts a slice to a block of text." - [(slice parser)]) - - ($.definition \\parser.then - "Embeds a text parser into an arbitrary parser that yields text." - [(then structured text)])] - []))) - -(.def .public documentation - (.List $.Module) - ($.module /._ - "" - [($.definition /.of_char) - - ($.definition /.\0) - ($.definition /.null) - ($.definition /.\a) - ($.definition /.alarm) - ($.definition /.\b) - ($.definition /.back_space) - ($.definition /.\t) - ($.definition /.tab) - ($.definition /.\n) - ($.definition /.new_line) - ($.definition /.\v) - ($.definition /.vertical_tab) - ($.definition /.\f) - ($.definition /.form_feed) - ($.definition /.\r) - ($.definition /.carriage_return) - ($.definition /.\'') - ($.definition /.double_quote) - - ($.definition /.size) - ($.definition /.format) - ($.definition /.equivalence) - ($.definition /.order) - ($.definition /.monoid) - ($.definition /.hash) - ($.definition /.together) - ($.definition /.empty?) - ($.definition /.space) - ($.definition /.lower_cased) - ($.definition /.upper_cased) - - ($.definition /.Char - "A character code number.") - - ($.definition /.line_feed - "Same as 'new_line'.") - - ($.definition /.char - "Yields the character at the specified index." - [(char index input)]) - - ($.definition /.index_since - "" - [(index_since from pattern input)]) - - ($.definition /.index - "" - [(index pattern input)]) - - ($.definition /.last_index - "" - [(last_index part text)]) - - ($.definition /.starts_with? - "" - [(starts_with? prefix x)]) - - ($.definition /.ends_with? - "" - [(ends_with? postfix x)]) - - ($.definition /.enclosed_by? - "" - [(enclosed_by? boundary value)]) - - ($.definition /.contains? - "" - [(contains? sub text)]) - - ($.definition /.prefix - "" - [(prefix param subject)]) - - ($.definition /.suffix - "" - [(suffix param subject)]) - - ($.definition /.enclosed - "Surrounds the given content text with left and right side additions." - [(enclosed [left right] content)]) - - ($.definition /.enclosed' - "Surrounds the given content text with the same boundary text." - [(enclosed' boundary content)]) - - ($.definition /.clip - "Clips a chunk of text from the input at the specified offset and of the specified size." - [(clip offset size input)]) - - ($.definition /.clip_since - "Clips the remaining text from the input at the specified offset." - [(clip_since offset input)]) - - ($.definition /.split_at - "" - [(split_at at x)]) - - ($.definition /.split_by - "" - [(split_by token sample)]) - - ($.definition /.all_split_by - "" - [(all_split_by token sample)]) - - ($.definition /.replaced_once - "" - [(replaced_once pattern replacement template)]) - - ($.definition /.replaced - "" - [(replaced pattern replacement template)]) - - ($.definition /.interposed - "" - [(interposed separator texts)]) - - ($.definition /.space? - "Checks whether the character is white-space." - [(space? char)])] - [..\\format - ..\\parser - - /buffer.documentation - /encoding.documentation - /escape.documentation - /regex.documentation - /unicode.documentation])) +(def \\format + (List $.Documentation) + (list ($.module \\format._ + "") + + ($.definition \\format.functor) + + ($.definition \\format.bit) + ($.definition \\format.nat) + ($.definition \\format.int) + ($.definition \\format.rev) + ($.definition \\format.frac) + ($.definition \\format.text) + + ($.definition \\format.ratio) + ($.definition \\format.symbol) + ($.definition \\format.location) + ($.definition \\format.code) + ($.definition \\format.type) + + ($.definition \\format.instant) + ($.definition \\format.duration) + ($.definition \\format.date) + ($.definition \\format.time) + ($.definition \\format.day) + ($.definition \\format.month) + + ($.definition \\format.xml) + ($.definition \\format.json) + + ($.definition \\format.nat_2) + ($.definition \\format.nat_8) + ($.definition \\format.nat_10) + ($.definition \\format.nat_16) + ($.definition \\format.int_2) + ($.definition \\format.int_8) + ($.definition \\format.int_10) + ($.definition \\format.int_16) + ($.definition \\format.rev_2) + ($.definition \\format.rev_8) + ($.definition \\format.rev_10) + ($.definition \\format.rev_16) + ($.definition \\format.frac_2) + ($.definition \\format.frac_8) + ($.definition \\format.frac_10) + ($.definition \\format.frac_16) + + ($.definition \\format.mod) + ($.definition \\format.list) + ($.definition \\format.maybe) + + ($.definition (\\format.Format it) + "A way to produce readable text from values.") + + ($.definition \\format.format + "Text interpolation." + [(format "Static part " (text static) " does not match URI: " uri)]) + )) + +(`` (def \\parser + (List $.Documentation) + (list ($.module \\parser._ + "") + + ($.definition \\parser.unconsumed_input) + ($.definition \\parser.expected_to_fail) + ($.definition \\parser.cannot_parse) + ($.definition \\parser.cannot_slice) + ($.definition \\parser.cannot_match) + ($.definition \\parser.character_should_be) + ($.definition \\parser.character_should_not_be) + ($.definition \\parser.character_does_not_satisfy_predicate) + + ($.definition \\parser.Offset + "An offset into a block of text.") + + ($.definition (\\parser.Parser it) + "A parser for text.") + + ($.definition \\parser.Slice + "A slice of a block of text.") + + ($.definition \\parser.result + (format "Executes a parser against a block of text." + \n "Verifies that the entire input has been processed.") + [(result parser input)]) + + ($.definition \\parser.offset + "Yields the current offset into the input.") + + ($.definition \\parser.any + "Yields the next character without applying any logic.") + + ($.definition \\parser.any! + "Yields the next character (as a slice) without applying any logic.") + + (,, (with_template [<name> <caveat>] + [(`` ($.definition <name> + (format "Produce a character" (,, (template.text [<caveat>])) " if the parser fails.")))] + + [\\parser.not ""] + [\\parser.not! " (as a slice)"] + )) + + ($.definition \\parser.this + "Checks that a specific text shows up in the input." + [(this reference)]) + + ($.definition \\parser.end + "Ensure the parser's input is empty.") + + ($.definition \\parser.next + "Yields the next character (without consuming it from the input).") + + ($.definition \\parser.remaining + "Get all of the remaining input (without consuming it).") + + ($.definition \\parser.range + "Only yields characters within a range." + [(range bottom top)]) + + (,, (with_template [<name> <desc>] + [($.definition <name> + (format "Only yields " <desc> " characters."))] + + [\\parser.upper "uppercase"] + [\\parser.lower "lowercase"] + [\\parser.decimal "decimal"] + [\\parser.octal "octal"] + )) + + ($.definition \\parser.alpha + "Yields alphabetic characters.") + + ($.definition \\parser.alpha_num + "Yields alphanumeric characters.") + + ($.definition \\parser.hexadecimal + "Yields hexadecimal digits.") + + (,, (with_template [<name> <description_modifier>] + [($.definition <name> + (format "Yields characters that are" <description_modifier> " part of a piece of text."))] + + [\\parser.one_of ""] + [\\parser.none_of " not"] + )) + + (,, (with_template [<name> <description_modifier>] + [($.definition <name> + (format "Yields characters (as a slice) that are" <description_modifier> " part of a piece of text."))] + + [\\parser.one_of! ""] + [\\parser.none_of! " not"] + )) + + ($.definition \\parser.satisfies + "Yields characters that satisfy a predicate." + [(satisfies parser)]) + + ($.definition \\parser.space + "Yields white-space.") + + ($.definition \\parser.and + "Yields the outputs of both parsers composed together." + [(and left right)]) + + ($.definition \\parser.and! + "Yields the outputs of both parsers composed together (as a slice)." + [(and! left right)]) + + (,, (with_template [<text> <slice>] + [(`` ($.definition <text> + (format "Yields " (,, (template.text [<name>])) " characters as a single continuous text."))) + (`` ($.definition <slice> + (format "Yields " (,, (template.text [<name>])) " characters as a single continuous text (as a slice).")))] + + [\\parser.some \\parser.some!] + [\\parser.many \\parser.many!] + )) + + (,, (with_template [<text> <slice> <doc_modifier>] + [(`` ($.definition <text> + (format "Yields " <doc_modifier> " N characters."))) + (`` ($.definition <slice> + (format "Yields " <doc_modifier> " N characters (as a slice).")))] + + [\\parser.exactly \\parser.exactly! "exactly"] + [\\parser.at_most \\parser.at_most! "at most"] + [\\parser.at_least \\parser.at_least! "at least"] + )) + + ($.definition \\parser.between + "" + [(between minimum additional parser)]) + + ($.definition \\parser.between! + "" + [(between! minimum additional parser)]) + + ($.definition \\parser.enclosed + "" + [(enclosed [start end] parser)]) + + ($.definition \\parser.local + "Applies a parser against the given input." + [(local local_input parser)]) + + ($.definition \\parser.slice + "Converts a slice to a block of text." + [(slice parser)]) + + ($.definition \\parser.then + "Embeds a text parser into an arbitrary parser that yields text." + [(then structured text)]) + ))) + +(def .public documentation + (List $.Documentation) + (list.partial ($.module /._ + "") + + ($.definition /.of_char) + + ($.definition /.\0) + ($.definition /.null) + ($.definition /.\a) + ($.definition /.alarm) + ($.definition /.\b) + ($.definition /.back_space) + ($.definition /.\t) + ($.definition /.tab) + ($.definition /.\n) + ($.definition /.new_line) + ($.definition /.\v) + ($.definition /.vertical_tab) + ($.definition /.\f) + ($.definition /.form_feed) + ($.definition /.\r) + ($.definition /.carriage_return) + ($.definition /.\'') + ($.definition /.double_quote) + + ($.definition /.size) + ($.definition /.format) + ($.definition /.equivalence) + ($.definition /.order) + ($.definition /.monoid) + ($.definition /.hash) + ($.definition /.together) + ($.definition /.empty?) + ($.definition /.space) + ($.definition /.lower_cased) + ($.definition /.upper_cased) + + ($.definition /.Char + "A character code number.") + + ($.definition /.line_feed + "Same as 'new_line'.") + + ($.definition /.char + "Yields the character at the specified index." + [(char index input)]) + + ($.definition /.index_since + "" + [(index_since from pattern input)]) + + ($.definition /.index + "" + [(index pattern input)]) + + ($.definition /.last_index + "" + [(last_index part text)]) + + ($.definition /.starts_with? + "" + [(starts_with? prefix x)]) + + ($.definition /.ends_with? + "" + [(ends_with? postfix x)]) + + ($.definition /.enclosed_by? + "" + [(enclosed_by? boundary value)]) + + ($.definition /.contains? + "" + [(contains? sub text)]) + + ($.definition /.prefix + "" + [(prefix param subject)]) + + ($.definition /.suffix + "" + [(suffix param subject)]) + + ($.definition /.enclosed + "Surrounds the given content text with left and right side additions." + [(enclosed [left right] content)]) + + ($.definition /.enclosed' + "Surrounds the given content text with the same boundary text." + [(enclosed' boundary content)]) + + ($.definition /.clip + "Clips a chunk of text from the input at the specified offset and of the specified size." + [(clip offset size input)]) + + ($.definition /.clip_since + "Clips the remaining text from the input at the specified offset." + [(clip_since offset input)]) + + ($.definition /.split_at + "" + [(split_at at x)]) + + ($.definition /.split_by + "" + [(split_by token sample)]) + + ($.definition /.all_split_by + "" + [(all_split_by token sample)]) + + ($.definition /.replaced_once + "" + [(replaced_once pattern replacement template)]) + + ($.definition /.replaced + "" + [(replaced pattern replacement template)]) + + ($.definition /.interposed + "" + [(interposed separator texts)]) + + ($.definition /.space? + "Checks whether the character is white-space." + [(space? char)]) + + (all list#composite + ..\\format + ..\\parser + + /buffer.documentation + /encoding.documentation + /escape.documentation + /regex.documentation + /unicode.documentation + ) + )) diff --git a/stdlib/source/documentation/lux/data/text/buffer.lux b/stdlib/source/documentation/lux/data/text/buffer.lux index 6c8fc5c5f..be0eff147 100644 --- a/stdlib/source/documentation/lux/data/text/buffer.lux +++ b/stdlib/source/documentation/lux/data/text/buffer.lux @@ -8,15 +8,16 @@ [\\library ["[0]" /]]) -(.def .public documentation - (.List $.Module) - ($.module /._ - "" - [($.definition /.empty) - ($.definition /.then) - ($.definition /.size) - ($.definition /.text) +(def .public documentation + (List $.Documentation) + (list ($.module /._ + "") - ($.definition /.Buffer - "Immutable text buffer for efficient text concatenation.")] - [])) + ($.definition /.empty) + ($.definition /.then) + ($.definition /.size) + ($.definition /.text) + + ($.definition /.Buffer + "Immutable text buffer for efficient text concatenation.") + )) diff --git a/stdlib/source/documentation/lux/data/text/encoding.lux b/stdlib/source/documentation/lux/data/text/encoding.lux index 2acadb26e..e5e324f22 100644 --- a/stdlib/source/documentation/lux/data/text/encoding.lux +++ b/stdlib/source/documentation/lux/data/text/encoding.lux @@ -4,167 +4,172 @@ ["$" documentation] [data [text (.only \n) - ["%" \\format (.only format)]]]]] + ["%" \\format (.only format)]] + [collection + ["[0]" list]]]]] [\\library ["[0]" /]] ["[0]" / ["[1][0]" utf8]]) -(`` (.def .public documentation - (.List $.Module) - ($.module /._ - "" - [($.definition /.name) +(`` (def .public documentation + (List $.Documentation) + (list.partial ($.module /._ + "") - ($.definition /.Encoding - "Encoding formats for text.") + ($.definition /.name) - (,, (with_template [<name>] - [($.definition <name> - (format "'" (/.name <name>) "' text encoding. "))] + ($.definition /.Encoding + "Encoding formats for text.") - [/.ascii] + (,, (with_template [<name>] + [($.definition <name> + (format "'" (/.name <name>) "' text encoding. "))] - [/.ibm_037] - [/.ibm_273] - [/.ibm_277] - [/.ibm_278] - [/.ibm_280] - [/.ibm_284] - [/.ibm_285] - [/.ibm_290] - [/.ibm_297] - [/.ibm_300] - [/.ibm_420] - [/.ibm_424] - [/.ibm_437] - [/.ibm_500] - [/.ibm_737] - [/.ibm_775] - [/.ibm_833] - [/.ibm_834] - [/.ibm_838] - [/.ibm_850] - [/.ibm_852] - [/.ibm_855] - [/.ibm_856] - [/.ibm_857] - [/.ibm_858] - [/.ibm_860] - [/.ibm_861] - [/.ibm_862] - [/.ibm_863] - [/.ibm_864] - [/.ibm_865] - [/.ibm_866] - [/.ibm_868] - [/.ibm_869] - [/.ibm_870] - [/.ibm_871] - [/.ibm_874] - [/.ibm_875] - [/.ibm_918] - [/.ibm_921] - [/.ibm_922] - [/.ibm_930] - [/.ibm_933] - [/.ibm_935] - [/.ibm_937] - [/.ibm_939] - [/.ibm_942] - [/.ibm_942c] - [/.ibm_943] - [/.ibm_943c] - [/.ibm_948] - [/.ibm_949] - [/.ibm_949c] - [/.ibm_950] - [/.ibm_964] - [/.ibm_970] - [/.ibm_1006] - [/.ibm_1025] - [/.ibm_1026] - [/.ibm_1046] - [/.ibm_1047] - [/.ibm_1097] - [/.ibm_1098] - [/.ibm_1112] - [/.ibm_1122] - [/.ibm_1123] - [/.ibm_1124] - [/.ibm_1140] - [/.ibm_1141] - [/.ibm_1142] - [/.ibm_1143] - [/.ibm_1144] - [/.ibm_1145] - [/.ibm_1146] - [/.ibm_1147] - [/.ibm_1148] - [/.ibm_1149] - [/.ibm_1166] - [/.ibm_1364] - [/.ibm_1381] - [/.ibm_1383] - [/.ibm_33722] - - [/.iso_2022_cn] - [/.iso2022_cn_cns] - [/.iso2022_cn_gb] - [/.iso_2022_jp] - [/.iso_2022_jp_2] - [/.iso_2022_kr] - [/.iso_8859_1] - [/.iso_8859_2] - [/.iso_8859_3] - [/.iso_8859_4] - [/.iso_8859_5] - [/.iso_8859_6] - [/.iso_8859_7] - [/.iso_8859_8] - [/.iso_8859_9] - [/.iso_8859_11] - [/.iso_8859_13] - [/.iso_8859_15] + [/.ascii] - [/.mac_arabic] - [/.mac_central_europe] - [/.mac_croatian] - [/.mac_cyrillic] - [/.mac_dingbat] - [/.mac_greek] - [/.mac_hebrew] - [/.mac_iceland] - [/.mac_roman] - [/.mac_romania] - [/.mac_symbol] - [/.mac_thai] - [/.mac_turkish] - [/.mac_ukraine] - - [/.utf_8] - [/.utf_16] - [/.utf_32] + [/.ibm_037] + [/.ibm_273] + [/.ibm_277] + [/.ibm_278] + [/.ibm_280] + [/.ibm_284] + [/.ibm_285] + [/.ibm_290] + [/.ibm_297] + [/.ibm_300] + [/.ibm_420] + [/.ibm_424] + [/.ibm_437] + [/.ibm_500] + [/.ibm_737] + [/.ibm_775] + [/.ibm_833] + [/.ibm_834] + [/.ibm_838] + [/.ibm_850] + [/.ibm_852] + [/.ibm_855] + [/.ibm_856] + [/.ibm_857] + [/.ibm_858] + [/.ibm_860] + [/.ibm_861] + [/.ibm_862] + [/.ibm_863] + [/.ibm_864] + [/.ibm_865] + [/.ibm_866] + [/.ibm_868] + [/.ibm_869] + [/.ibm_870] + [/.ibm_871] + [/.ibm_874] + [/.ibm_875] + [/.ibm_918] + [/.ibm_921] + [/.ibm_922] + [/.ibm_930] + [/.ibm_933] + [/.ibm_935] + [/.ibm_937] + [/.ibm_939] + [/.ibm_942] + [/.ibm_942c] + [/.ibm_943] + [/.ibm_943c] + [/.ibm_948] + [/.ibm_949] + [/.ibm_949c] + [/.ibm_950] + [/.ibm_964] + [/.ibm_970] + [/.ibm_1006] + [/.ibm_1025] + [/.ibm_1026] + [/.ibm_1046] + [/.ibm_1047] + [/.ibm_1097] + [/.ibm_1098] + [/.ibm_1112] + [/.ibm_1122] + [/.ibm_1123] + [/.ibm_1124] + [/.ibm_1140] + [/.ibm_1141] + [/.ibm_1142] + [/.ibm_1143] + [/.ibm_1144] + [/.ibm_1145] + [/.ibm_1146] + [/.ibm_1147] + [/.ibm_1148] + [/.ibm_1149] + [/.ibm_1166] + [/.ibm_1364] + [/.ibm_1381] + [/.ibm_1383] + [/.ibm_33722] + + [/.iso_2022_cn] + [/.iso2022_cn_cns] + [/.iso2022_cn_gb] + [/.iso_2022_jp] + [/.iso_2022_jp_2] + [/.iso_2022_kr] + [/.iso_8859_1] + [/.iso_8859_2] + [/.iso_8859_3] + [/.iso_8859_4] + [/.iso_8859_5] + [/.iso_8859_6] + [/.iso_8859_7] + [/.iso_8859_8] + [/.iso_8859_9] + [/.iso_8859_11] + [/.iso_8859_13] + [/.iso_8859_15] - [/.windows_31j] - [/.windows_874] - [/.windows_949] - [/.windows_950] - [/.windows_1250] - [/.windows_1252] - [/.windows_1251] - [/.windows_1253] - [/.windows_1254] - [/.windows_1255] - [/.windows_1256] - [/.windows_1257] - [/.windows_1258] - [/.windows_iso2022jp] - [/.windows_50220] - [/.windows_50221] - - [/.cesu_8] - [/.koi8_r] - [/.koi8_u] - ))] - [/utf8.documentation]))) + [/.mac_arabic] + [/.mac_central_europe] + [/.mac_croatian] + [/.mac_cyrillic] + [/.mac_dingbat] + [/.mac_greek] + [/.mac_hebrew] + [/.mac_iceland] + [/.mac_roman] + [/.mac_romania] + [/.mac_symbol] + [/.mac_thai] + [/.mac_turkish] + [/.mac_ukraine] + + [/.utf_8] + [/.utf_16] + [/.utf_32] + + [/.windows_31j] + [/.windows_874] + [/.windows_949] + [/.windows_950] + [/.windows_1250] + [/.windows_1252] + [/.windows_1251] + [/.windows_1253] + [/.windows_1254] + [/.windows_1255] + [/.windows_1256] + [/.windows_1257] + [/.windows_1258] + [/.windows_iso2022jp] + [/.windows_50220] + [/.windows_50221] + + [/.cesu_8] + [/.koi8_r] + [/.koi8_u] + )) + + /utf8.documentation + ))) diff --git a/stdlib/source/documentation/lux/data/text/encoding/utf8.lux b/stdlib/source/documentation/lux/data/text/encoding/utf8.lux index afe5d2b41..7a22b7cf5 100644 --- a/stdlib/source/documentation/lux/data/text/encoding/utf8.lux +++ b/stdlib/source/documentation/lux/data/text/encoding/utf8.lux @@ -8,10 +8,11 @@ [\\library ["[0]" /]]) -(.def .public documentation - (.List $.Module) - ($.module /._ - "" - [($.definition /.codec - "A codec for binary encoding of text as UTF-8.")] - [])) +(def .public documentation + (List $.Documentation) + (list ($.module /._ + "") + + ($.definition /.codec + "A codec for binary encoding of text as UTF-8.") + )) diff --git a/stdlib/source/documentation/lux/data/text/escape.lux b/stdlib/source/documentation/lux/data/text/escape.lux index 91c23806d..5b85c8359 100644 --- a/stdlib/source/documentation/lux/data/text/escape.lux +++ b/stdlib/source/documentation/lux/data/text/escape.lux @@ -8,28 +8,29 @@ [\\library ["[0]" /]]) -(.def .public documentation - (.List $.Module) - ($.module /._ - "" - [($.definition /.escapable?) - ($.definition /.dangling_escape) - ($.definition /.invalid_escape) - ($.definition /.invalid_unicode_escape) +(def .public documentation + (List $.Documentation) + (list ($.module /._ + "") - ($.definition /.escaped - "Yields a escaped version of the text." - [(escaped text)]) + ($.definition /.escapable?) + ($.definition /.dangling_escape) + ($.definition /.invalid_escape) + ($.definition /.invalid_unicode_escape) - ($.definition /.un_escaped - (format "Yields an un-escaped text." - \n "Fails if it was improperly escaped.") - [(un_escaped text)]) + ($.definition /.escaped + "Yields a escaped version of the text." + [(escaped text)]) - ($.definition /.literal - "If given a escaped text literal, expands to an un-escaped version." - [(/.literal "Line 1\nLine 2") - "=>" - (format "Line 1" \n - "Line 2")])] - [])) + ($.definition /.un_escaped + (format "Yields an un-escaped text." + \n "Fails if it was improperly escaped.") + [(un_escaped text)]) + + ($.definition /.literal + "If given a escaped text literal, expands to an un-escaped version." + [(/.literal "Line 1\nLine 2") + "=>" + (format "Line 1" \n + "Line 2")]) + )) diff --git a/stdlib/source/documentation/lux/data/text/regex.lux b/stdlib/source/documentation/lux/data/text/regex.lux index cd8511743..090b88c41 100644 --- a/stdlib/source/documentation/lux/data/text/regex.lux +++ b/stdlib/source/documentation/lux/data/text/regex.lux @@ -1,6 +1,6 @@ (.require [library - [lux (.except pattern) + [lux (.except) ["$" documentation] [data [text (.only \n) @@ -8,68 +8,69 @@ [\\library ["[0]" /]]) -(.def .public documentation - (.List $.Module) - ($.module /._ - "" - [($.definition /.incorrect_quantification) +(def .public documentation + (List $.Documentation) + (list ($.module /._ + "") - ($.definition /.regex - "Create lexers using regular-expression syntax." - ["Literals" - (regex "a")] - ["Wildcards" - (regex ".")] - ["Escaping" - (regex "\.")] - ["Character classes" - (regex "\d") - (regex "\p{Lower}") - (regex "[abc]") - (regex "[a-z]") - (regex "[a-zA-Z]") - (regex "[a-z&&[def]]")] - ["Negation" - (regex "[^abc]") - (regex "[^a-z]") - (regex "[^a-zA-Z]") - (regex "[a-z&&[^bc]]") - (regex "[a-z&&[^m-p]]")] - ["Combinations" - (regex "aa") - (regex "a?") - (regex "a*") - (regex "a+")] - ["Specific amounts" - (regex "a{2}")] - ["At least" - (regex "a{1,}")] - ["At most" - (regex "a{,1}")] - ["Between" - (regex "a{1,2}")] - ["Groups" - (regex "a(.)c") - (regex "a(b+)c") - (regex "(\d{3})-(\d{3})-(\d{4})") - (regex "(\d{3})-(?:\d{3})-(\d{4})") - (regex "(?<code>\d{3})-\k<code>-(\d{4})") - (regex "(?<code>\d{3})-\k<code>-(\d{4})-\0") - (regex "(\d{3})-((\d{3})-(\d{4}))")] - ["Alternation" - (regex "a|b") - (regex "a(.)(.)|b(.)(.)")]) + ($.definition /.incorrect_quantification) - ($.definition /.pattern - "Allows you to test text against regular expressions." - [(case some_text - (pattern "(\d{3})-(\d{3})-(\d{4})" - [_ country_code area_code place_code]) - do_some_thing_when_number + ($.definition /.regex + "Create lexers using regular-expression syntax." + ["Literals" + (regex "a")] + ["Wildcards" + (regex ".")] + ["Escaping" + (regex "\.")] + ["Character classes" + (regex "\d") + (regex "\p{Lower}") + (regex "[abc]") + (regex "[a-z]") + (regex "[a-zA-Z]") + (regex "[a-z&&[def]]")] + ["Negation" + (regex "[^abc]") + (regex "[^a-z]") + (regex "[^a-zA-Z]") + (regex "[a-z&&[^bc]]") + (regex "[a-z&&[^m-p]]")] + ["Combinations" + (regex "aa") + (regex "a?") + (regex "a*") + (regex "a+")] + ["Specific amounts" + (regex "a{2}")] + ["At least" + (regex "a{1,}")] + ["At most" + (regex "a{,1}")] + ["Between" + (regex "a{1,2}")] + ["Groups" + (regex "a(.)c") + (regex "a(b+)c") + (regex "(\d{3})-(\d{3})-(\d{4})") + (regex "(\d{3})-(?:\d{3})-(\d{4})") + (regex "(?<code>\d{3})-\k<code>-(\d{4})") + (regex "(?<code>\d{3})-\k<code>-(\d{4})-\0") + (regex "(\d{3})-((\d{3})-(\d{4}))")] + ["Alternation" + (regex "a|b") + (regex "a(.)(.)|b(.)(.)")]) - (pattern "\w+") - do_some_thing_when_word + ($.definition /.pattern + "Allows you to test text against regular expressions." + [(case some_text + (pattern "(\d{3})-(\d{3})-(\d{4})" + [_ country_code area_code place_code]) + do_some_thing_when_number - _ - do_something_else)])] - [])) + (pattern "\w+") + do_some_thing_when_word + + _ + do_something_else)]) + )) diff --git a/stdlib/source/documentation/lux/data/text/unicode.lux b/stdlib/source/documentation/lux/data/text/unicode.lux index 6248d9bb9..df6b2a4d9 100644 --- a/stdlib/source/documentation/lux/data/text/unicode.lux +++ b/stdlib/source/documentation/lux/data/text/unicode.lux @@ -11,8 +11,8 @@ ["[1][0]" block] ["[1][0]" set]]) -(.def .public documentation - (.List $.Module) +(def .public documentation + (List $.Documentation) (list.together (list /block.documentation /set.documentation diff --git a/stdlib/source/documentation/lux/data/text/unicode/block.lux b/stdlib/source/documentation/lux/data/text/unicode/block.lux index 3c5ea5c8f..7aa0355ab 100644 --- a/stdlib/source/documentation/lux/data/text/unicode/block.lux +++ b/stdlib/source/documentation/lux/data/text/unicode/block.lux @@ -11,142 +11,143 @@ [\\library ["[0]" /]]) -(`` (.def .public documentation - (.List $.Module) - ($.module /._ - "" - [($.definition /.monoid) - ($.definition /.start) - ($.definition /.end) - ($.definition /.size) - ($.definition /.equivalence) - ($.definition /.hash) +(`` (def .public documentation + (List $.Documentation) + (list ($.module /._ + "") - ($.definition /.Block - "A block of valid unicode characters.") + ($.definition /.monoid) + ($.definition /.start) + ($.definition /.end) + ($.definition /.size) + ($.definition /.equivalence) + ($.definition /.hash) - ($.definition /.block - "" - [(block start additional)]) + ($.definition /.Block + "A block of valid unicode characters.") - ($.definition /.within? - "" - [(within? block char)]) + ($.definition /.block + "" + [(block start additional)]) - (,, (with_template [<name>] - [($.definition <name> - (let [[_ name] (symbol <name>)] - (format (hex#encoded (/.start <name>)) - "-" (hex#encoded (/.end <name>)) - " | " (text.replaced "_" " " name))))] + ($.definition /.within? + "" + [(within? block char)]) - [/.basic_latin] - [/.latin_1_supplement] - [/.latin_extended_a] - [/.latin_extended_b] - [/.ipa_extensions] - [/.spacing_modifier_letters] - [/.combining_diacritical_marks] - [/.greek_and_coptic] - [/.cyrillic] - [/.cyrillic_supplementary] - [/.armenian] - [/.hebrew] - [/.arabic] - [/.syriac] - [/.thaana] - [/.devanagari] - [/.bengali] - [/.gurmukhi] - [/.gujarati] - [/.oriya] - [/.tamil] - [/.telugu] - [/.kannada] - [/.malayalam] - [/.sinhala] - [/.thai] - [/.lao] - [/.tibetan] - [/.myanmar] - [/.georgian] - [/.hangul_jamo] - [/.ethiopic] - [/.cherokee] - [/.unified_canadian_aboriginal_syllabics] - [/.ogham] - [/.runic] - [/.tagalog] - [/.hanunoo] - [/.buhid] - [/.tagbanwa] - [/.khmer] - [/.mongolian] - [/.limbu] - [/.tai_le] - [/.khmer_symbols] - [/.phonetic_extensions] - [/.latin_extended_additional] - [/.greek_extended] - [/.general_punctuation] - [/.superscripts_and_subscripts] - [/.currency_symbols] - [/.combining_diacritical_marks_for_symbols] - [/.letterlike_symbols] - [/.number_forms] - [/.arrows] - [/.mathematical_operators] - [/.miscellaneous_technical] - [/.control_pictures] - [/.optical_character_recognition] - [/.enclosed_alphanumerics] - [/.box_drawing] - [/.block_elements] - [/.geometric_shapes] - [/.miscellaneous_symbols] - [/.dingbats] - [/.miscellaneous_mathematical_symbols_a] - [/.supplemental_arrows_a] - [/.braille_patterns] - [/.supplemental_arrows_b] - [/.miscellaneous_mathematical_symbols_b] - [/.supplemental_mathematical_operators] - [/.miscellaneous_symbols_and_arrows] - [/.cjk_radicals_supplement] - [/.kangxi_radicals] - [/.ideographic_description_characters] - [/.cjk_symbols_and_punctuation] - [/.hiragana] - [/.katakana] - [/.bopomofo] - [/.hangul_compatibility_jamo] - [/.kanbun] - [/.bopomofo_extended] - [/.katakana_phonetic_extensions] - [/.enclosed_cjk_letters_and_months] - [/.cjk_compatibility] - [/.cjk_unified_ideographs_extension_a] - [/.yijing_hexagram_symbols] - [/.cjk_unified_ideographs] - [/.yi_syllables] - [/.yi_radicals] - [/.hangul_syllables] - [/.high_surrogates] - [/.high_private_use_surrogates] - [/.low_surrogates] - [/.private_use_area] - [/.cjk_compatibility_ideographs] - [/.alphabetic_presentation_forms] - [/.arabic_presentation_forms_a] - [/.variation_selectors] - [/.combining_half_marks] - [/.cjk_compatibility_forms] - [/.small_form_variants] - [/.arabic_presentation_forms_b] - [/.halfwidth_and_fullwidth_forms] - [/.specials] - [/.numeric] - [/.upper_case] - [/.lower_case] - ))] - []))) + (,, (with_template [<name>] + [($.definition <name> + (let [[_ name] (symbol <name>)] + (format (hex#encoded (/.start <name>)) + "-" (hex#encoded (/.end <name>)) + " | " (text.replaced "_" " " name))))] + + [/.basic_latin] + [/.latin_1_supplement] + [/.latin_extended_a] + [/.latin_extended_b] + [/.ipa_extensions] + [/.spacing_modifier_letters] + [/.combining_diacritical_marks] + [/.greek_and_coptic] + [/.cyrillic] + [/.cyrillic_supplementary] + [/.armenian] + [/.hebrew] + [/.arabic] + [/.syriac] + [/.thaana] + [/.devanagari] + [/.bengali] + [/.gurmukhi] + [/.gujarati] + [/.oriya] + [/.tamil] + [/.telugu] + [/.kannada] + [/.malayalam] + [/.sinhala] + [/.thai] + [/.lao] + [/.tibetan] + [/.myanmar] + [/.georgian] + [/.hangul_jamo] + [/.ethiopic] + [/.cherokee] + [/.unified_canadian_aboriginal_syllabics] + [/.ogham] + [/.runic] + [/.tagalog] + [/.hanunoo] + [/.buhid] + [/.tagbanwa] + [/.khmer] + [/.mongolian] + [/.limbu] + [/.tai_le] + [/.khmer_symbols] + [/.phonetic_extensions] + [/.latin_extended_additional] + [/.greek_extended] + [/.general_punctuation] + [/.superscripts_and_subscripts] + [/.currency_symbols] + [/.combining_diacritical_marks_for_symbols] + [/.letterlike_symbols] + [/.number_forms] + [/.arrows] + [/.mathematical_operators] + [/.miscellaneous_technical] + [/.control_pictures] + [/.optical_character_recognition] + [/.enclosed_alphanumerics] + [/.box_drawing] + [/.block_elements] + [/.geometric_shapes] + [/.miscellaneous_symbols] + [/.dingbats] + [/.miscellaneous_mathematical_symbols_a] + [/.supplemental_arrows_a] + [/.braille_patterns] + [/.supplemental_arrows_b] + [/.miscellaneous_mathematical_symbols_b] + [/.supplemental_mathematical_operators] + [/.miscellaneous_symbols_and_arrows] + [/.cjk_radicals_supplement] + [/.kangxi_radicals] + [/.ideographic_description_characters] + [/.cjk_symbols_and_punctuation] + [/.hiragana] + [/.katakana] + [/.bopomofo] + [/.hangul_compatibility_jamo] + [/.kanbun] + [/.bopomofo_extended] + [/.katakana_phonetic_extensions] + [/.enclosed_cjk_letters_and_months] + [/.cjk_compatibility] + [/.cjk_unified_ideographs_extension_a] + [/.yijing_hexagram_symbols] + [/.cjk_unified_ideographs] + [/.yi_syllables] + [/.yi_radicals] + [/.hangul_syllables] + [/.high_surrogates] + [/.high_private_use_surrogates] + [/.low_surrogates] + [/.private_use_area] + [/.cjk_compatibility_ideographs] + [/.alphabetic_presentation_forms] + [/.arabic_presentation_forms_a] + [/.variation_selectors] + [/.combining_half_marks] + [/.cjk_compatibility_forms] + [/.small_form_variants] + [/.arabic_presentation_forms_b] + [/.halfwidth_and_fullwidth_forms] + [/.specials] + [/.numeric] + [/.upper_case] + [/.lower_case] + )) + ))) diff --git a/stdlib/source/documentation/lux/data/text/unicode/set.lux b/stdlib/source/documentation/lux/data/text/unicode/set.lux index 268affa1b..68fbb3446 100644 --- a/stdlib/source/documentation/lux/data/text/unicode/set.lux +++ b/stdlib/source/documentation/lux/data/text/unicode/set.lux @@ -8,31 +8,32 @@ [\\library ["[0]" /]]) -(.def .public documentation - (.List $.Module) - ($.module /._ - "" - [($.definition /.Set) - ($.definition /.composite) - ($.definition /.character) - ($.definition /.non_character) - ($.definition /.full) - ($.definition /.start) - ($.definition /.end) - ($.definition /.equivalence) +(def .public documentation + (List $.Documentation) + (list ($.module /._ + "") - ($.definition /.ascii) - ($.definition /.alphabetic) - ($.definition /.alpha_numeric) - ($.definition /.numeric) - ($.definition /.upper_case) - ($.definition /.lower_case) + ($.definition /.Set) + ($.definition /.composite) + ($.definition /.character) + ($.definition /.non_character) + ($.definition /.full) + ($.definition /.start) + ($.definition /.end) + ($.definition /.equivalence) - ($.definition /.set - "" - [(set [head tail])]) + ($.definition /.ascii) + ($.definition /.alphabetic) + ($.definition /.alpha_numeric) + ($.definition /.numeric) + ($.definition /.upper_case) + ($.definition /.lower_case) - ($.definition /.member? - "" - [(member? set character)])] - [])) + ($.definition /.set + "" + [(set [head tail])]) + + ($.definition /.member? + "" + [(member? set character)]) + )) diff --git a/stdlib/source/library/lux/test.lux b/stdlib/source/library/lux/test.lux index a29acfefe..eafb394a5 100644 --- a/stdlib/source/library/lux/test.lux +++ b/stdlib/source/library/lux/test.lux @@ -33,116 +33,51 @@ ["[0]" symbol] ["[0]" code (.only) ["<[1]>" \\parser]] - [macro + [macro (.only with_symbols) [syntax (.only syntax)]]] [world ["[0]" environment] ["[0]" console] [time ["[0]" instant] - ["[0]" duration (.only Duration)]]]]]) - -(type .public Coverage - (Set Symbol)) - -(type .public Tally - (Record - [#successes Nat - #failures Nat - #expected Coverage - #actual Coverage])) - -(def (total parameter subject) - (-> Tally Tally Tally) - [#successes (n.+ (the #successes parameter) (the #successes subject)) - #failures (n.+ (the #failures parameter) (the #failures subject)) - #expected (set.union (the #expected parameter) - (the #expected subject)) - #actual (set.union (the #actual parameter) - (the #actual subject))]) - -(def start - Tally - [#successes 0 - #failures 0 - #expected (set.empty symbol.hash) - #actual (set.empty symbol.hash)]) - -(with_template [<name> <category>] - [(def <name> - Tally - (revised <category> .++ ..start))] - - [success_tally #successes] - [failure_tally #failures] - ) - -(type .public Assertion - (Async [Tally Text])) + ["[0]" duration (.only Duration)]]]]] + [/ + ["//" unit]]) (type .public Test - (Random Assertion)) - -(def separator - text.new_line) - -(def .public (and' left right) - (-> Assertion Assertion Assertion) - (let [[read! write!] (is [(Async [Tally Text]) - (async.Resolver [Tally Text])] - (async.async [])) - _ (|> left - (async.upon! (function (_ [l_tally l_documentation]) - (async.upon! (function (_ [r_tally r_documentation]) - (write! [(..total l_tally r_tally) - (format l_documentation ..separator r_documentation)])) - right))) - io.run!)] - read!)) + (Random //.Test)) (def .public (and left right) (-> Test Test Test) (do [! random.monad] [left left] - (at ! each (..and' left) right))) - -(def (context' description) - (-> Text Test Test) - (random#each (async#each (function (_ [tally documentation]) - [tally (|> documentation - (text.all_split_by ..separator) - (list#each (|>> (format text.tab))) - (text.interposed ..separator) - (format description ..separator))])))) + (at ! each (//.and left) right))) (def .public context (-> Text Test Test) - (|>> %.text context')) - -(def failure_prefix "[Failure] ") -(def success_prefix "[Success] ") + (|>> %.text + //.context + random#each)) (def .public failure (-> Text Test) - (|>> (format ..failure_prefix) - [..failure_tally] - async#in + (|>> //.failure random#in)) -(def .public (assertion message condition) - (-> Text Bit Assertion) - (<| async#in - (if condition - [..success_tally (format ..success_prefix message)] - [..failure_tally (format ..failure_prefix message)]))) +(def .public success + (-> Text Test) + (|>> //.success + random#in)) -(def .public (property message condition) +(def .public (test message condition) (-> Text Bit Test) - (random#in (..assertion (%.text message) condition))) + (random#in (//.test message condition))) (def .public (lifted message random) (-> Text (Random Bit) Test) - (random#each (..assertion (%.text message)) random)) + (do random.monad + [it random] + (test message it))) (def pcg_32_magic_inc Nat @@ -159,8 +94,11 @@ [prng result]))) (def failed? - (-> Tally Bit) - (|>> (the #failures) (n.> 0))) + (-> //.Tally Bit) + (|>> (the //.#failures) (n.> 0))) + +(def separator + text.new_line) (def (times_failure seed documentation) (-> Seed Text Text) @@ -189,21 +127,21 @@ product.right))))]))))) (def (description duration tally) - (-> Duration Tally Text) - (let [successes (the #successes tally) - failures (the #failures tally) - missing (set.difference (the #actual tally) - (the #expected tally)) - unexpected (set.difference (the #expected tally) - (the #actual tally)) - report (is (-> Coverage Text) + (-> Duration //.Tally Text) + (let [successes (the //.#successes tally) + failures (the //.#failures tally) + missing (set.difference (the //.#actual tally) + (the //.#expected tally)) + unexpected (set.difference (the //.#expected tally) + (the //.#actual tally)) + report (is (-> //.Coverage Text) (|>> set.list (list.sorted (at symbol.order <)) (exception.listing %.symbol))) - expected_coverage (set.size (the #expected tally)) + expected_coverage (set.size (the //.#expected tally)) unexpected_coverage (set.size unexpected) actual_coverage (n.- unexpected_coverage - (set.size (the #actual tally))) + (set.size (the //.#actual tally))) coverage (case expected_coverage 0 "N/A" expected (let [missing_ratio (f./ (n.frac expected) @@ -266,128 +204,30 @@ (console.write_line report console)) <else>))] (async.future (at environment.default exit - (case (the #failures tally) + (case (the //.#failures tally) 0 ..success_exit_code _ ..failure_exit_code))))) -(def definition_separator " & ") - -(def clean_up_marker (text.of_char (hex "05"))) - -(def coverage_format - (%.Format Symbol) - (|>> %.symbol (format ..clean_up_marker))) - -(def .public (with_coverage' coverage condition) - (-> (List Symbol) Bit Assertion) - (let [message (|> coverage - (list#each ..coverage_format) - (text.interposed ..definition_separator)) - coverage (set.of_list symbol.hash coverage)] - (|> (..assertion message condition) - (async#each (function (_ [tally documentation]) - [(revised #actual (set.union coverage) tally) - documentation]))))) - -(def .public (with_coverage coverage condition) - (-> (List Symbol) Bit Test) - (|> (..with_coverage' coverage condition) - random#in)) - -(def .public (for' coverage test) - (-> (List Symbol) Test Test) - (let [context (|> coverage - (list#each ..coverage_format) - (text.interposed ..definition_separator)) - coverage (set.of_list symbol.hash coverage)] - (random#each (async#each (function (_ [tally documentation]) - [(revised #actual (set.union coverage) tally) - documentation])) - (..context' context test)))) - -(def (symbol_code symbol) - (-> Symbol Code) - (code.tuple (list (code.text (symbol.module symbol)) - (code.text (symbol.short symbol))))) - -(def .public reference - (syntax (_ [name <code>.symbol]) - (do meta.monad - [_ (meta.export name)] - (in (list (symbol_code name)))))) - -(def coverage_separator - Text - (text.of_char 31)) - -(def encoded_coverage - (-> (List Text) Text) - (list#mix (function (_ short aggregate) - (case aggregate - "" short - _ (format aggregate ..coverage_separator short))) - "")) - -(def (coverage_definitions module encoding) - (-> Text Text Coverage) - (loop (again [remaining encoding - output (set.of_list symbol.hash (list))]) - (case (text.split_by ..coverage_separator remaining) - {.#Some [head tail]} - (again tail (set.has [module head] output)) - - {.#None} - (set.has [module remaining] output)))) - -(with_template [<macro> <function>] - [(def .public <macro> - (syntax (_ [coverage (<code>.tuple (<>.many <code>.any)) - condition <code>.any]) - (let [coverage (list#each (function (_ definition) - (` (..reference (, definition)))) - coverage)] - (in (list (` (<function> (is (.List .Symbol) - (.list (,* coverage))) - (, condition))))))))] - - [coverage' ..with_coverage'] - [coverage ..with_coverage] - ) +(def .public coverage + (syntax (_ [coverage <code>.any + condition <code>.any]) + (in (list (` (at random.monad (,' in) (//.coverage (, coverage) (, condition)))))))) (def .public for - (syntax (_ [coverage (<code>.tuple (<>.many <code>.any)) + (syntax (_ [coverage <code>.any test <code>.any]) - (let [coverage (list#each (function (_ definition) - (` (..reference (, definition)))) - coverage)] - (in (list (` (..for' (is (.List .Symbol) - (.list (,* coverage))) - (, test)))))))) - -(def .public (covering' module coverage test) - (-> Text Text Test Test) - (let [coverage (..coverage_definitions module coverage)] - (|> (..context' module test) - (random#each (async#each (function (_ [tally documentation]) - [(revised #expected (set.union coverage) tally) - (|> documentation - (text.replaced (format ..clean_up_marker module symbol.separator) "") - (text.replaced ..clean_up_marker ""))])))))) + (in (list (` (at random.functor + (,' each) + (|>> (//.for (, coverage))) + (, test))))))) (def .public covering - (syntax (_ [module <code>.symbol + (syntax (_ [module <code>.any test <code>.any]) - (do meta.monad - [.let [module (symbol.module module)] - definitions (meta.definitions module) - .let [coverage (|> definitions - (list#mix (function (_ [short [exported? _]] aggregate) - (if exported? - {.#Item short aggregate} - aggregate)) - {.#End}) - ..encoded_coverage)]] - (in (list (` (..covering' (, (code.text module)) (, (code.text coverage)) (, test)))))))) + (in (list (` (at random.functor + (,' each) + (|>> (//.covering (, module))) + (, test))))))) (exception .public (error_during_execution [error Text]) (exception.report @@ -397,13 +237,13 @@ (-> (List Test) Test) (case (list.size tests) 0 - (random#in (async#in [..start ""])) + (random#in (async#in [//.start ""])) expected_tests (do random.monad [seed random.nat .let [prng (random.pcg_32 [..pcg_32_magic_inc seed]) - run! (is (-> Test Assertion) + run! (is (-> Test //.Test) (|>> (random.result prng) product.right (function (_ _)) @@ -413,11 +253,11 @@ output {try.#Failure error} - (..assertion (exception.error ..error_during_execution [error]) false)))) - state (is (Atom (Dictionary Nat [Tally Text])) + (//.test (exception.error ..error_during_execution [error]) false)))) + state (is (Atom (Dictionary Nat [//.Tally Text])) (atom.atom (dictionary.empty n.order))) - [read! write!] (is [Assertion - (async.Resolver [Tally Text])] + [read! write!] (is [//.Test + (async.Resolver [//.Tally Text])] (async.async [])) _ (list#mix (function (_ test index) (exec @@ -431,7 +271,7 @@ (list#each product.right))] (write! [(|> assertions (list#each product.left) - (list#mix ..total ..start)) + (list#mix //.total //.start)) (|> assertions (list#each product.right) (text.interposed ..separator))])) diff --git a/stdlib/source/library/lux/test/unit.lux b/stdlib/source/library/lux/test/unit.lux new file mode 100644 index 000000000..0077c18a9 --- /dev/null +++ b/stdlib/source/library/lux/test/unit.lux @@ -0,0 +1,223 @@ +(.require + [library + [lux (.except and for) + [abstract + [monad (.only do)]] + [control + ["<>" parser] + ["[0]" io] + [concurrency + ["[0]" async (.only Async) (.use "[1]#[0]" monad)]]] + [data + ["[0]" text (.only) + ["%" \\format (.only format)]] + [collection + ["[0]" list (.use "[1]#[0]" functor mix)] + ["[0]" set (.only Set)]]] + [math + [number (.only hex) + ["n" nat]]] + ["[0]" meta (.only) + ["[0]" symbol] + ["[0]" code (.only) + ["<[1]>" \\parser]] + [macro + [syntax (.only syntax)]]]]]) + +(type .public Coverage + (Set Symbol)) + +(type .public Tally + (Record + [#successes Nat + #failures Nat + #expected Coverage + #actual Coverage])) + +(def .public (total parameter subject) + (-> Tally Tally Tally) + [#successes (n.+ (the #successes parameter) (the #successes subject)) + #failures (n.+ (the #failures parameter) (the #failures subject)) + #expected (set.union (the #expected parameter) + (the #expected subject)) + #actual (set.union (the #actual parameter) + (the #actual subject))]) + +(def .public start + Tally + [#successes 0 + #failures 0 + #expected (set.empty symbol.hash) + #actual (set.empty symbol.hash)]) + +(with_template [<name> <category>] + [(def <name> + Tally + (revised <category> .++ ..start))] + + [success_tally #successes] + [failure_tally #failures] + ) + +(type .public Test + (Async [Tally Text])) + +(def separator + text.new_line) + +(def .public (and left right) + (-> Test Test Test) + (let [[read! write!] (is [(Async [Tally Text]) + (async.Resolver [Tally Text])] + (async.async [])) + _ (|> left + (async.upon! (function (_ [l_tally l_documentation]) + (async.upon! (function (_ [r_tally r_documentation]) + (write! [(..total l_tally r_tally) + (format l_documentation ..separator r_documentation)])) + right))) + io.run!)] + read!)) + +(def (context' description) + (-> Text Test Test) + (async#each (function (_ [tally documentation]) + [tally (|> documentation + (text.all_split_by ..separator) + (list#each (|>> (format text.tab))) + (text.interposed ..separator) + (format description ..separator))]))) + +(def .public context + (-> Text Test Test) + (|>> %.text context')) + +(def failure_prefix "[Failure] ") +(def success_prefix "[Success] ") + +(def .public failure + (-> Text Test) + (|>> (format ..failure_prefix) + [..failure_tally] + async#in)) + +(def .public success + (-> Text Test) + (|>> (format ..success_prefix) + [..success_tally] + async#in)) + +(def .public (test message condition) + (-> Text Bit Test) + (if condition + (success message) + (failure message))) + +(def definition_separator " & ") + +(def clean_up_marker (text.of_char (hex "05"))) + +(def coverage_format + (%.Format Symbol) + (|>> %.symbol (format ..clean_up_marker))) + +(def .public reference + (let [symbol (is (-> Symbol Code) + (function (_ symbol) + (` (is Symbol + [(, (code.text (symbol.module symbol))) + (, (code.text (symbol.short symbol)))]))))] + (syntax (_ [name <code>.symbol]) + (do meta.monad + [_ (meta.export name)] + (in (list (symbol name))))))) + +(def coverage_separator + Text + (text.of_char 31)) + +(def encoded_coverage + (-> (List Text) Text) + (list#mix (function (_ short aggregate) + (case aggregate + "" short + _ (format aggregate ..coverage_separator short))) + "")) + +(def (coverage_definitions module encoding) + (-> Text Text Coverage) + (loop (again [remaining encoding + output (set.of_list symbol.hash (list))]) + (case (text.split_by ..coverage_separator remaining) + {.#Some [head tail]} + (again tail (set.has [module head] output)) + + {.#None} + (set.has [module remaining] output)))) + +(def .public (with_coverage coverage condition) + (-> (List Symbol) Bit Test) + (let [message (|> coverage + (list#each ..coverage_format) + (text.interposed ..definition_separator)) + coverage (set.of_list symbol.hash coverage)] + (|> (..test message condition) + (async#each (function (_ [tally documentation]) + [(revised #actual (set.union coverage) tally) + documentation]))))) + +(def .public coverage + (syntax (_ [coverage (<code>.tuple (<>.many <code>.any)) + condition <code>.any]) + (let [coverage (list#each (function (_ definition) + (` (..reference (, definition)))) + coverage)] + (in (list (` (..with_coverage (is (.List .Symbol) + (.list (,* coverage))) + (, condition)))))))) + +(def .public (for' coverage test) + (-> (List Symbol) Test Test) + (let [context (|> coverage + (list#each ..coverage_format) + (text.interposed ..definition_separator)) + coverage (set.of_list symbol.hash coverage)] + (async#each (function (_ [tally documentation]) + [(revised #actual (set.union coverage) tally) + documentation]) + (..context' context test)))) + +(def .public for + (syntax (_ [coverage (<code>.tuple (<>.many <code>.any)) + test <code>.any]) + (let [coverage (list#each (function (_ definition) + (` (..reference (, definition)))) + coverage)] + (in (list (` (..for' (is (.List .Symbol) + (.list (,* coverage))) + (, test)))))))) + +(def .public (covering' module coverage test) + (-> Text Text Test Test) + (let [coverage (..coverage_definitions module coverage)] + (|> (..context' module test) + (async#each (function (_ [tally documentation]) + [(revised #expected (set.union coverage) tally) + (|> documentation + (text.replaced (format ..clean_up_marker module symbol.separator) "") + (text.replaced ..clean_up_marker ""))]))))) + +(def .public covering + (syntax (_ [module <code>.symbol + test <code>.any]) + (do meta.monad + [.let [module (symbol.module module)] + definitions (meta.definitions module) + .let [coverage (|> definitions + (list#mix (function (_ [short [exported? _]] aggregate) + (if exported? + {.#Item short aggregate} + aggregate)) + {.#End}) + ..encoded_coverage)]] + (in (list (` (..covering' (, (code.text module)) (, (code.text coverage)) (, test)))))))) diff --git a/stdlib/source/specification/aedifex/repository.lux b/stdlib/source/specification/aedifex/repository.lux index 9cc2e0f2d..a0812b443 100644 --- a/stdlib/source/specification/aedifex/repository.lux +++ b/stdlib/source/specification/aedifex/repository.lux @@ -1,7 +1,6 @@ (.require [library [lux (.except) - ["_" test (.only Test)] [abstract [monad (.only do)]] [control @@ -12,7 +11,9 @@ ["[0]" binary (.only) ["_[1]" \\test]]] [math - ["[0]" random]]]] + ["[0]" random]] + ["_" test (.only Test) + ["[0]" unit]]]] [\\program ["[0]" / (.only) ["[1][0]" remote] @@ -27,7 +28,7 @@ (-> Artifact Artifact (/.Repository Async) Test) (do random.monad [expected (_binary.random 100)] - (in (all _.and' + (in (all unit.and (do async.monad [.let [good_uri (/remote.uri (the //artifact.#version valid_artifact) valid_artifact //artifact/extension.lux_library)] good_upload! (at subject upload good_uri expected) @@ -36,7 +37,7 @@ .let [bad_uri (/remote.uri (the //artifact.#version invalid_artifact) invalid_artifact //artifact/extension.lux_library)] bad_upload! (at subject upload bad_uri expected) bad_download! (at subject download bad_uri)] - (_.coverage' [/.Repository] + (unit.coverage [/.Repository] (let [successfull_flow! (case [good_upload! good_download!] [{try.#Success _} {try.#Success actual}] diff --git a/stdlib/source/specification/compositor/analysis/type.lux b/stdlib/source/specification/compositor/analysis/type.lux index 6675fad09..89ee8646f 100644 --- a/stdlib/source/specification/compositor/analysis/type.lux +++ b/stdlib/source/specification/compositor/analysis/type.lux @@ -56,8 +56,8 @@ [[typeC exprT exprC] ..check [other_typeC other_exprT other_exprC] ..check] (all _.and - (_.property "lux check" + (_.test "lux check" (check_success+ expander state "lux check" (list typeC exprC) exprT)) - (_.property "lux coerce" + (_.test "lux coerce" (check_success+ expander state "lux coerce" (list typeC other_exprC) exprT)) ))) diff --git a/stdlib/source/specification/compositor/generation/case.lux b/stdlib/source/specification/compositor/generation/case.lux index 5e00820b2..6ac785a12 100644 --- a/stdlib/source/specification/compositor/generation/case.lux +++ b/stdlib/source/specification/compositor/generation/case.lux @@ -101,7 +101,7 @@ (-> Runner Test) (do r.monad [value r.safe_frac] - (_.property (%.symbol (symbol synthesis.branch/let)) + (_.test (%.symbol (symbol synthesis.branch/let)) (|> (synthesis.branch/let [(synthesis.f64 value) 0 (synthesis.variable/local 0)]) @@ -114,7 +114,7 @@ [on_true r.safe_frac on_false (|> r.safe_frac (r.only (|>> (f.= on_true) not))) verdict r.bit] - (_.property (%.symbol (symbol synthesis.branch/if)) + (_.test (%.symbol (symbol synthesis.branch/if)) (|> (synthesis.branch/if [(synthesis.bit verdict) (synthesis.f64 on_true) (synthesis.f64 on_false)]) @@ -127,7 +127,7 @@ [[inputS pathS] ..case on_success r.safe_frac on_failure (|> r.safe_frac (r.only (|>> (f.= on_success) not)))] - (_.property (%.symbol (symbol synthesis.branch/case)) + (_.test (%.symbol (symbol synthesis.branch/case)) (|> (synthesis.branch/case [inputS (all synthesis.path/alt @@ -243,11 +243,11 @@ (def (special_spec run) (-> Runner Test) (all _.and - (_.property "===" + (_.test "===" (and (text#= (synthesis.%path special_path) (synthesis.%path special_pattern_path)) (at synthesis.path_equivalence = special_path special_pattern_path))) - (_.property "CODE" + (_.test "CODE" (|> special_input (run "special_input") (pipe.case @@ -256,7 +256,7 @@ {try.#Failure _} false))) - (_.property "PATTERN_MATCHING 0" + (_.test "PATTERN_MATCHING 0" (|> (synthesis.branch/case [special_input special_path]) (run "special_path") @@ -266,7 +266,7 @@ {try.#Failure _} false))) - (_.property "PATTERN_MATCHING 1" + (_.test "PATTERN_MATCHING 1" (|> (synthesis.branch/case [special_input special_pattern_path]) (run "special_pattern_path") diff --git a/stdlib/source/specification/compositor/generation/common.lux b/stdlib/source/specification/compositor/generation/common.lux index eb1a1ac70..ba691bde7 100644 --- a/stdlib/source/specification/compositor/generation/common.lux +++ b/stdlib/source/specification/compositor/generation/common.lux @@ -40,7 +40,7 @@ [param r.i64 subject r.i64] (with_expansions [<binary> (with_template [<extension> <reference> <param_expr>] - [(_.property <extension> + [(_.test <extension> (|> {synthesis.#Extension <extension> (list (synthesis.i64 param) (synthesis.i64 subject))} (run (..safe <extension>)) @@ -60,7 +60,7 @@ )] (all _.and <binary> - (_.property "lux i64 arithmetic-right-shift" + (_.test "lux i64 arithmetic-right-shift" (|> {synthesis.#Extension "lux i64 arithmetic-right-shift" (list (synthesis.i64 subject) (synthesis.i64 param))} @@ -83,7 +83,7 @@ subject r.i64] (`` (all _.and (,, (with_template [<extension> <type> <prepare> <comp> <subject_expr>] - [(_.property <extension> + [(_.test <extension> (|> {synthesis.#Extension <extension> (list (synthesis.i64 subject))} (run (..safe <extension>)) (pipe.case @@ -101,7 +101,7 @@ (as Int))] )) (,, (with_template [<extension> <reference> <outputT> <comp>] - [(_.property <extension> + [(_.test <extension> (|> {synthesis.#Extension <extension> (list (synthesis.i64 param) (synthesis.i64 subject))} (run (..safe <extension>)) @@ -133,7 +133,7 @@ subject ..simple_frac] (`` (all _.and (,, (with_template [<extension> <reference> <comp>] - [(_.property <extension> + [(_.test <extension> (|> {synthesis.#Extension <extension> (list (synthesis.f64 param) (synthesis.f64 subject))} (run (..safe <extension>)) @@ -146,7 +146,7 @@ ["lux f64 %" f.% f.=] )) (,, (with_template [<extension> <text>] - [(_.property <extension> + [(_.test <extension> (|> {synthesis.#Extension <extension> (list (synthesis.f64 param) (synthesis.f64 subject))} (run (..safe <extension>)) @@ -162,7 +162,7 @@ ["lux f64 <" f.<] )) (,, (with_template [<extension> <reference>] - [(_.property <extension> + [(_.test <extension> (|> {synthesis.#Extension <extension> (list)} (run (..safe <extension>)) (//case.verify <reference>)))] @@ -171,7 +171,7 @@ ["lux f64 max" ("lux f64 max")] ["lux f64 smallest" ("lux f64 smallest")] )) - (_.property "'lux f64 i64 && 'lux i64 f64'" + (_.test "'lux f64 i64 && 'lux i64 f64'" (|> (run (..safe "lux f64 i64") (|> subject synthesis.f64 (list) {synthesis.#Extension "lux f64 i64"} @@ -197,7 +197,7 @@ pre_rep_all (|> sample_lower (list.repeated sample_size) (text.interposed sample_upper)) post_rep_all (|> sample_lower (list.repeated sample_size) (text.interposed sample_alpha))]] (all _.and - (_.property "Can compare texts for equality." + (_.test "Can compare texts for equality." (and (|> {synthesis.#Extension "lux text =" (list sample_lowerS sample_lowerS)} (run (..safe "lux text =")) (pipe.case @@ -214,7 +214,7 @@ _ false)))) - (_.property "Can compare texts for order." + (_.test "Can compare texts for order." (|> {synthesis.#Extension "lux text <" (list sample_lowerS sample_upperS)} (run (..safe "lux text <")) (pipe.case @@ -223,7 +223,7 @@ {try.#Failure _} false))) - (_.property "Can get length of text." + (_.test "Can get length of text." (|> {synthesis.#Extension "lux text size" (list sample_lowerS)} (run (..safe "lux text size")) (pipe.case @@ -232,7 +232,7 @@ _ false))) - (_.property "Can concatenate text." + (_.test "Can concatenate text." (|> {synthesis.#Extension "lux text size" (list concatenatedS)} (run (..safe "lux text size")) (pipe.case @@ -241,7 +241,7 @@ _ false))) - (_.property "Can find index of sub-text." + (_.test "Can find index of sub-text." (and (|> {synthesis.#Extension "lux text index" (list concatenatedS sample_lowerS (synthesis.i64 +0))} @@ -281,10 +281,10 @@ _ false))))] - (_.property "Can clip text to extract sub-text." + (_.test "Can clip text to extract sub-text." (and (test_clip 0 sample_size sample_lower) (test_clip sample_size sample_size sample_upper)))) - (_.property "Can extract individual characters from text." + (_.test "Can extract individual characters from text." (|> {synthesis.#Extension "lux text char" (list sample_lowerS (synthesis.i64 char_idx))} @@ -305,7 +305,7 @@ (do r.monad [message (r.alphabetic 5)] (all _.and - (_.property "Can log messages." + (_.test "Can log messages." (|> {synthesis.#Extension "lux io log" (list (synthesis.text (format "LOG: " message)))} (run (..safe "lux io log")) @@ -315,7 +315,7 @@ {try.#Failure _} false))) - (_.property "Can throw runtime errors." + (_.test "Can throw runtime errors." (and (|> {synthesis.#Extension "lux try" (list (synthesis.function/abstraction [synthesis.#environment (list) diff --git a/stdlib/source/specification/compositor/generation/function.lux b/stdlib/source/specification/compositor/generation/function.lux index 7fc24cfb8..2fb9714e0 100644 --- a/stdlib/source/specification/compositor/generation/function.lux +++ b/stdlib/source/specification/compositor/generation/function.lux @@ -55,12 +55,12 @@ .let [expectation (maybe.trusted (list.item (-- local) inputs)) inputsS (list#each (|>> synthesis.f64) inputs)]] (all _.and - (_.property "Can read arguments." + (_.test "Can read arguments." (|> (synthesis.function/apply [synthesis.#function functionS synthesis.#arguments inputsS]) (run "with_local") (//case.verify expectation))) - (_.property "Can partially apply functions." + (_.test "Can partially apply functions." (or (n.= 1 arity) (let [preS (list.first partial_arity inputsS) postS (list.after partial_arity inputsS) @@ -70,7 +70,7 @@ synthesis.#arguments postS]) (run "partial_application") (//case.verify expectation))))) - (_.property "Can read environment." + (_.test "Can read environment." (or (n.= 1 arity) (let [environment (|> partial_arity (enum.range n.enum 1) diff --git a/stdlib/source/specification/compositor/generation/primitive.lux b/stdlib/source/specification/compositor/generation/primitive.lux index 9e6ea2e02..fcb6bd050 100644 --- a/stdlib/source/specification/compositor/generation/primitive.lux +++ b/stdlib/source/specification/compositor/generation/primitive.lux @@ -32,7 +32,7 @@ (,, (with_template [<evaluation_name> <synthesis> <gen> <test>] [(do r.monad [expected <gen>] - (_.property (%.symbol (symbol <synthesis>)) + (_.test (%.symbol (symbol <synthesis>)) (|> (run <evaluation_name> (<synthesis> expected)) (pipe.case {try.#Success actual} diff --git a/stdlib/source/specification/compositor/generation/reference.lux b/stdlib/source/specification/compositor/generation/reference.lux index 7159afe1b..27441f349 100644 --- a/stdlib/source/specification/compositor/generation/reference.lux +++ b/stdlib/source/specification/compositor/generation/reference.lux @@ -29,7 +29,7 @@ (do r.monad [name ..symbol expected r.safe_frac] - (_.property "Definitions." + (_.test "Definitions." (|> (define name (synthesis.f64 expected)) (pipe.case {try.#Success actual} @@ -43,7 +43,7 @@ (do [! r.monad] [register (|> r.nat (at ! each (n.% 100))) expected r.safe_frac] - (_.property "Local variables." + (_.test "Local variables." (|> (synthesis.branch/let [(synthesis.f64 expected) register (synthesis.variable/local register)]) diff --git a/stdlib/source/specification/compositor/generation/structure.lux b/stdlib/source/specification/compositor/generation/structure.lux index 523ad990e..5521c6303 100644 --- a/stdlib/source/specification/compositor/generation/structure.lux +++ b/stdlib/source/specification/compositor/generation/structure.lux @@ -35,7 +35,7 @@ tag_in (|> r.nat (at ! each (n.% num_tags))) .let [last?_in (|> num_tags -- (n.= tag_in))] value_in r.i64] - (_.property (%.symbol (symbol synthesis.variant)) + (_.test (%.symbol (symbol synthesis.variant)) (|> (synthesis.variant [analysis.#lefts (if last?_in (-- tag_in) tag_in) @@ -69,7 +69,7 @@ (do [! r.monad] [size (|> r.nat (at ! each (|>> (n.% 10) (n.max 2)))) tuple_in (r.list size r.i64)] - (_.property (%.symbol (symbol synthesis.tuple)) + (_.test (%.symbol (symbol synthesis.tuple)) (|> (synthesis.tuple (list#each (|>> synthesis.i64) tuple_in)) (run "tuple") (pipe.case diff --git a/stdlib/source/specification/lux/abstract/apply.lux b/stdlib/source/specification/lux/abstract/apply.lux index 9c29ed974..460469078 100644 --- a/stdlib/source/specification/lux/abstract/apply.lux +++ b/stdlib/source/specification/lux/abstract/apply.lux @@ -21,7 +21,7 @@ (All (_ f) (-> (Injection f) (Comparison f) (Apply f) Test)) (do [! random.monad] [sample (at ! each injection random.nat)] - (_.property "Identity." + (_.test "Identity." ((comparison n.=) (/#on sample (injection function.identity)) sample)))) @@ -31,7 +31,7 @@ (do [! random.monad] [sample random.nat increase (at ! each n.+ random.nat)] - (_.property "Homomorphism." + (_.test "Homomorphism." ((comparison n.=) (/#on (injection sample) (injection increase)) (injection (increase sample)))))) @@ -41,7 +41,7 @@ (do [! random.monad] [sample random.nat increase (at ! each n.+ random.nat)] - (_.property "Interchange." + (_.test "Interchange." ((comparison n.=) (/#on (injection sample) (injection increase)) (/#on (injection increase) (injection (is (-> (-> Nat Nat) Nat) @@ -56,7 +56,7 @@ (at ! each n.+ random.nat)) decrease (is (Random :$/1:) (at ! each n.- random.nat))] - (_.property "Composition." + (_.test "Composition." ((comparison n.=) (|> (injection (is (-> :$/1: :$/1: :$/1:) function.composite)) diff --git a/stdlib/source/specification/lux/abstract/codec.lux b/stdlib/source/specification/lux/abstract/codec.lux index acbc07647..7ed8612b1 100644 --- a/stdlib/source/specification/lux/abstract/codec.lux +++ b/stdlib/source/specification/lux/abstract/codec.lux @@ -18,7 +18,7 @@ (do random.monad [expected generator] (_.for [/.Codec] - (_.property "Isomorphism." + (_.test "Isomorphism." (case (|> expected @//encoded @//decoded) {try.#Success actual} (@//= expected actual) diff --git a/stdlib/source/specification/lux/abstract/comonad.lux b/stdlib/source/specification/lux/abstract/comonad.lux index 897c29f06..9bd0ec336 100644 --- a/stdlib/source/specification/lux/abstract/comonad.lux +++ b/stdlib/source/specification/lux/abstract/comonad.lux @@ -21,7 +21,7 @@ (|>> _//out (n.+ diff))) random.nat) .let [start (injection sample)]] - (_.property "Left identity." + (_.test "Left identity." (n.= (morphism start) (|> start _//disjoint (_//each morphism) _//out))))) @@ -31,7 +31,7 @@ [sample random.nat .let [start (injection sample) == (comparison n.=)]] - (_.property "Right identity." + (_.test "Right identity." (== start (|> start _//disjoint (_//each _//out)))))) @@ -47,7 +47,7 @@ random.nat) .let [start (injection sample) == (comparison n.=)]] - (_.property "Associativity." + (_.test "Associativity." (== (|> start _//disjoint (_//each (|>> _//disjoint (_//each increase) decrease))) (|> start _//disjoint (_//each increase) _//disjoint (_//each decrease)))))) diff --git a/stdlib/source/specification/lux/abstract/enum.lux b/stdlib/source/specification/lux/abstract/enum.lux index a1cf2820e..84cd03321 100644 --- a/stdlib/source/specification/lux/abstract/enum.lux +++ b/stdlib/source/specification/lux/abstract/enum.lux @@ -15,7 +15,7 @@ [sample gen_sample] (<| (_.for [/.Enum]) (all _.and - (_.property "Successor and predecessor are inverse functions." + (_.test "Successor and predecessor are inverse functions." (and (_#= (|> sample _#succ _#pred) sample) (_#= (|> sample _#pred _#succ) diff --git a/stdlib/source/specification/lux/abstract/equivalence.lux b/stdlib/source/specification/lux/abstract/equivalence.lux index b2b643d4f..215a015fe 100644 --- a/stdlib/source/specification/lux/abstract/equivalence.lux +++ b/stdlib/source/specification/lux/abstract/equivalence.lux @@ -18,7 +18,7 @@ right random] (<| (_.for [/.Equivalence]) (all _.and - (_.property "Reflexivity" + (_.test "Reflexivity" (/#= left left)) - (_.property "Symmetry" + (_.test "Symmetry" (bit#= (/#= left right) (/#= right left))))))) diff --git a/stdlib/source/specification/lux/abstract/functor.lux b/stdlib/source/specification/lux/abstract/functor.lux index e1be8eba2..383037e9e 100644 --- a/stdlib/source/specification/lux/abstract/functor.lux +++ b/stdlib/source/specification/lux/abstract/functor.lux @@ -26,20 +26,20 @@ (All (_ f) (-> (Injection f) (Comparison f) (Functor f) Test)) (do [! random.monad] [sample (at ! each injection random.nat)] - (_.property "Identity." - ((comparison n.=) - (@//each function.identity sample) - sample)))) + (_.test "Identity." + ((comparison n.=) + (@//each function.identity sample) + sample)))) (def (homomorphism injection comparison (open "@//[0]")) (All (_ f) (-> (Injection f) (Comparison f) (Functor f) Test)) (do [! random.monad] [sample random.nat increase (at ! each n.+ random.nat)] - (_.property "Homomorphism." - ((comparison n.=) - (@//each increase (injection sample)) - (injection (increase sample)))))) + (_.test "Homomorphism." + ((comparison n.=) + (@//each increase (injection sample)) + (injection (increase sample)))))) (def (composition injection comparison (open "@//[0]")) (All (_ f) (-> (Injection f) (Comparison f) (Functor f) Test)) @@ -47,10 +47,10 @@ [sample (at ! each injection random.nat) increase (at ! each n.+ random.nat) decrease (at ! each n.- random.nat)] - (_.property "Composition." - ((comparison n.=) - (|> sample (@//each increase) (@//each decrease)) - (|> sample (@//each (|>> increase decrease))))))) + (_.test "Composition." + ((comparison n.=) + (|> sample (@//each increase) (@//each decrease)) + (|> sample (@//each (|>> increase decrease))))))) (def .public (spec injection comparison functor) (All (_ f) (-> (Injection f) (Comparison f) (Functor f) Test)) diff --git a/stdlib/source/specification/lux/abstract/functor/contravariant.lux b/stdlib/source/specification/lux/abstract/functor/contravariant.lux index 6099ce42a..3f02e35c8 100644 --- a/stdlib/source/specification/lux/abstract/functor/contravariant.lux +++ b/stdlib/source/specification/lux/abstract/functor/contravariant.lux @@ -16,7 +16,7 @@ (def (identity equivalence value (open "@//[0]")) (All (_ f a) (-> (Equivalence (f a)) (f a) (Functor f) Test)) - (_.property "Law of identity." + (_.test "Law of identity." (equivalence (@//each function.identity value) value))) diff --git a/stdlib/source/specification/lux/abstract/interval.lux b/stdlib/source/specification/lux/abstract/interval.lux index e0a012e9b..51688e4ce 100644 --- a/stdlib/source/specification/lux/abstract/interval.lux +++ b/stdlib/source/specification/lux/abstract/interval.lux @@ -16,8 +16,8 @@ (do random.monad [sample gen_sample] (all _.and - (_.property "No value is bigger than the top." + (_.test "No value is bigger than the top." (@//< @//top sample)) - (_.property "No value is smaller than the bottom." + (_.test "No value is smaller than the bottom." (order.> @//order @//bottom sample)) )))) diff --git a/stdlib/source/specification/lux/abstract/monad.lux b/stdlib/source/specification/lux/abstract/monad.lux index e95ddf67d..3613a3214 100644 --- a/stdlib/source/specification/lux/abstract/monad.lux +++ b/stdlib/source/specification/lux/abstract/monad.lux @@ -18,7 +18,7 @@ morphism (at ! each (function (_ diff) (|>> (n.+ diff) _//in)) random.nat)] - (_.property "Left identity." + (_.test "Left identity." ((comparison n.=) (|> (injection sample) (_//each morphism) _//conjoint) (morphism sample))))) @@ -27,7 +27,7 @@ (All (_ f) (-> (Injection f) (Comparison f) (/.Monad f) Test)) (do random.monad [sample random.nat] - (_.property "Right identity." + (_.test "Right identity." ((comparison n.=) (|> (injection sample) (_//each _//in) _//conjoint) (injection sample))))) @@ -42,7 +42,7 @@ decrease (at ! each (function (_ diff) (|>> (n.- diff) _//in)) random.nat)] - (_.property "Associativity." + (_.test "Associativity." ((comparison n.=) (|> (injection sample) (_//each increase) _//conjoint (_//each decrease) _//conjoint) (|> (injection sample) (_//each (|>> increase (_//each decrease) _//conjoint)) _//conjoint))))) diff --git a/stdlib/source/specification/lux/abstract/monoid.lux b/stdlib/source/specification/lux/abstract/monoid.lux index dedaca77b..78f387f5f 100644 --- a/stdlib/source/specification/lux/abstract/monoid.lux +++ b/stdlib/source/specification/lux/abstract/monoid.lux @@ -20,13 +20,13 @@ right gen_sample] (<| (_.for [/.Monoid]) (all _.and - (_.property "Left identity." + (_.test "Left identity." (_#= sample (_#composite _#identity sample))) - (_.property "Right identity." + (_.test "Right identity." (_#= sample (_#composite sample _#identity))) - (_.property "Associativity." + (_.test "Associativity." (_#= (_#composite left (_#composite mid right)) (_#composite (_#composite left mid) right))) )))) diff --git a/stdlib/source/specification/lux/abstract/order.lux b/stdlib/source/specification/lux/abstract/order.lux index 4d448c958..3ec435fb8 100644 --- a/stdlib/source/specification/lux/abstract/order.lux +++ b/stdlib/source/specification/lux/abstract/order.lux @@ -16,7 +16,7 @@ (do random.monad [parameter generator subject generator] - (_.property "Values are either ordered, or they are equal. All options(_ are mutually exclusive." + (_.test "Values are either ordered, or they are equal. All options(_ are mutually exclusive." (cond (@//< parameter subject) (not (or (@//< subject parameter) (@//= parameter subject))) @@ -34,7 +34,7 @@ (not (or (@//= parameter value) (@//= subject value)))) generator)] - (_.property "Transitive property." + (_.test "Transitive property." (if (@//< parameter subject) (let [greater? (and (@//< subject extra) (@//< parameter extra)) diff --git a/stdlib/source/specification/lux/world/console.lux b/stdlib/source/specification/lux/world/console.lux index 78953c351..cb17b4338 100644 --- a/stdlib/source/specification/lux/world/console.lux +++ b/stdlib/source/specification/lux/world/console.lux @@ -1,7 +1,6 @@ (.require [library [lux (.except) - ["_" test (.only Test)] [abstract [monad (.only do)]] [control @@ -13,7 +12,9 @@ ["[0]" text (.only) ["%" \\format (.only format)]]] [math - ["[0]" random]]]] + ["[0]" random]] + ["_" test (.only Test) + ["[0]" unit]]]] [\\library ["[0]" /]]) @@ -52,7 +53,7 @@ _ false)]] - (_.coverage' [/.Console] + (unit.coverage [/.Console] (and can_write! can_read! can_close!)))))) diff --git a/stdlib/source/specification/lux/world/environment.lux b/stdlib/source/specification/lux/world/environment.lux index 2163fc2e1..fb6600bfe 100644 --- a/stdlib/source/specification/lux/world/environment.lux +++ b/stdlib/source/specification/lux/world/environment.lux @@ -1,7 +1,6 @@ (.require [library [lux (.except) - ["_" test (.only Test)] [abstract [monad (.only do)]] [control @@ -14,7 +13,9 @@ ["[0]" dictionary] ["[0]" list]]] [math - ["[0]" random]]]] + ["[0]" random]] + ["_" test (.only Test) + ["[0]" unit]]]] [\\library ["[0]" /]]) @@ -24,7 +25,7 @@ [exit random.int] (in (do [! async.monad] [environment (/.environment ! subject)] - (_.coverage' [/.Environment] + (unit.coverage [/.Environment] (and (not (dictionary.empty? environment)) (list.every? (|>> text.empty? not) (dictionary.keys environment)) diff --git a/stdlib/source/specification/lux/world/file.lux b/stdlib/source/specification/lux/world/file.lux index dc6cb6528..0f642d2aa 100644 --- a/stdlib/source/specification/lux/world/file.lux +++ b/stdlib/source/specification/lux/world/file.lux @@ -1,7 +1,6 @@ (.require [library [lux (.except) - ["_" test (.only Test)] [abstract [monad (.only do)]] [control @@ -28,7 +27,9 @@ ["n" nat]]] [world [time - ["[0]" instant (.only Instant) (.use "[1]#[0]" equivalence)]]]]] + ["[0]" instant (.only Instant) (.use "[1]#[0]" equivalence)]]] + ["_" test (.only Test) + ["[0]" unit]]]] [\\library ["[0]" /]]) @@ -41,17 +42,17 @@ in (do async.monad [fs (async.future fs)] - (all _.and' - (_.coverage' [/.rooted] + (all unit.and + (unit.coverage [/.rooted] (let [path (/.rooted fs parent child)] (and (text.starts_with? parent path) (text.ends_with? child path)))) - (_.coverage' [/.parent] + (unit.coverage [/.parent] (|> (/.rooted fs parent child) (/.parent fs) (maybe#each (text#= parent)) (maybe.else false))) - (_.coverage' [/.name] + (unit.coverage [/.name] (|> (/.rooted fs parent child) (/.name fs) (text#= child))) @@ -198,7 +199,7 @@ move&delete (..move&delete fs parent child alternate_child)]) - (_.coverage' [/.System] + (unit.coverage [/.System] (and directory?&make_directory file?&write file_size&read&append @@ -228,8 +229,8 @@ cannot_make_directory!/0 (/.make_directories ! fs "") cannot_make_directory!/1 (/.make_directories ! fs (at fs separator))]) - (all _.and' - (_.coverage' [/.make_directories] + (all unit.and + (unit.coverage [/.make_directories] (and (not pre_dir/0) (not pre_dir/1) (not pre_dir/2) @@ -239,7 +240,7 @@ post_dir/0 post_dir/1 post_dir/2)) - (_.coverage' [/.cannot_make_directory] + (unit.coverage [/.cannot_make_directory] (and (case cannot_make_directory!/0 {try.#Success _} false @@ -263,12 +264,12 @@ [fs (async.future fs) make_file!/0 (/.make_file ! fs (utf8#encoded file/0) file/0) make_file!/1 (/.make_file ! fs (utf8#encoded file/0) file/0)]) - (all _.and' - (_.coverage' [/.make_file] + (all unit.and + (unit.coverage [/.make_file] (case make_file!/0 {try.#Success _} true {try.#Failure error} false)) - (_.coverage' [/.cannot_make_file] + (unit.coverage [/.cannot_make_file] (case make_file!/1 {try.#Success _} false @@ -306,7 +307,7 @@ post_file/1 (/.exists? ! fs file) post_dir/0 (at fs directory? dir) post_dir/1 (/.exists? ! fs dir)]) - (_.coverage' [/.exists?] + (unit.coverage [/.exists?] (and (not pre_file/0) (not pre_file/1) (not pre_dir/0) diff --git a/stdlib/source/specification/lux/world/shell.lux b/stdlib/source/specification/lux/world/shell.lux index ddf544c55..bf507b536 100644 --- a/stdlib/source/specification/lux/world/shell.lux +++ b/stdlib/source/specification/lux/world/shell.lux @@ -1,7 +1,6 @@ (.require [library [lux (.except) - ["_" test (.only Test)] [abstract [monad (.only do)]] [control @@ -16,7 +15,9 @@ ["[0]" random] [number ["n" nat] - ["i" int]]]]] + ["i" int]]] + ["_" test (.only Test) + ["[0]" unit]]]] [\\library ["[0]" / (.only) [// @@ -34,11 +35,11 @@ ) (def (can_wait! process) - (-> (/.Process Async) _.Assertion) + (-> (/.Process Async) unit.Test) (|> (at process await []) (async#each (|>> (try#each (i.= /.normal)) (try.else false) - (_.coverage' [/.Exit /.normal]))) + (unit.coverage [/.Exit /.normal]))) async#conjoint)) (def (can_read! expected process) @@ -80,13 +81,13 @@ (do ! [can_read! (..can_read! message echo) can_destroy! (..can_destroy! sleep)] - (all _.and' - (_.coverage' <shell_coverage> + (all unit.and + (unit.coverage <shell_coverage> (and can_read! can_destroy!)) (..can_wait! echo) )) _ - (_.coverage' <shell_coverage> + (unit.coverage <shell_coverage> false)))))))) diff --git a/stdlib/source/test/aedifex/cache.lux b/stdlib/source/test/aedifex/cache.lux index 515ca42b7..9dbb8405b 100644 --- a/stdlib/source/test/aedifex/cache.lux +++ b/stdlib/source/test/aedifex/cache.lux @@ -1,7 +1,6 @@ (.require [library [lux (.except Type) - ["_" test (.only Test)] [abstract ["[0]" monad (.only do)]] [control @@ -25,7 +24,9 @@ ["n" nat]]] [world ["[0]" file] - ["[0]" program]]]] + ["[0]" program]] + ["_" test (.only Test) + ["[0]" unit]]]] [// ["@[0]" profile] ["@[0]" artifact] @@ -111,7 +112,7 @@ (in (do async.monad [wrote! (/.write_one program fs dependency expected_package) read! (/.read_one program fs dependency)] - (_.coverage' [/.write_one /.read_one] + (unit.coverage [/.write_one /.read_one] (<| (try.else false) (do try.monad [_ wrote! @@ -132,7 +133,7 @@ (in (do async.monad [wrote! (/.write_all program fs expected) read! (/.read_all program fs (dictionary.keys expected) //dependency/resolution.empty)] - (_.coverage' [/.write_all /.read_all] + (unit.coverage [/.write_all /.read_all] (<| (try.else false) (do try.monad [_ wrote! diff --git a/stdlib/source/test/aedifex/cli.lux b/stdlib/source/test/aedifex/cli.lux index d0aef0468..b83d643b8 100644 --- a/stdlib/source/test/aedifex/cli.lux +++ b/stdlib/source/test/aedifex/cli.lux @@ -72,7 +72,7 @@ Test (do random.monad [expected ..command] - (_.property "Without profile." + (_.test "Without profile." (|> expected ..format (cli.result /.command) @@ -89,7 +89,7 @@ (do random.monad [expected_profile (random.alphabetic 1) expected_command ..command] - (_.property "With profile." + (_.test "With profile." (|> expected_command ..format (list.partial "with" expected_profile) diff --git a/stdlib/source/test/aedifex/command/auto.lux b/stdlib/source/test/aedifex/command/auto.lux index 8cc8177a1..10c249e3e 100644 --- a/stdlib/source/test/aedifex/command/auto.lux +++ b/stdlib/source/test/aedifex/command/auto.lux @@ -1,7 +1,6 @@ (.require [library [lux (.except) - ["_" test (.only Test)] [abstract [monad (.only do)]] [control @@ -31,7 +30,9 @@ ["[0]" file ["[0]" watch]] [time - ["[0]" instant]]]]] + ["[0]" instant]]] + ["_" test (.only Test) + ["[0]" unit]]]] ["[0]" // ["$[0]" version] ["$[0]" build]] @@ -120,6 +121,6 @@ (at ! each (n.= expected_runs)))] (in {try.#Success (and correct_number_of_runs! no_dangling_process!)})))] - (_.coverage' [/.do!] + (unit.coverage [/.do!] (try.else false verdict)))) )))) diff --git a/stdlib/source/test/aedifex/command/build.lux b/stdlib/source/test/aedifex/command/build.lux index 7ae2a8c72..81907a9ad 100644 --- a/stdlib/source/test/aedifex/command/build.lux +++ b/stdlib/source/test/aedifex/command/build.lux @@ -1,7 +1,6 @@ (.require [library [lux (.except) - ["_" test (.only Test)] [abstract [monad (.only do)]] [control @@ -22,7 +21,9 @@ [world ["[0]" file] ["[0]" shell (.only Shell)] - ["[0]" program]]]] + ["[0]" program]] + ["_" test (.only Test) + ["[0]" unit]]]] ["[0]" // ["@[0]" version] ["$/[1]" // @@ -162,7 +163,7 @@ (in (do async.monad [outcome (/.do! (@version.echo "") (program.async (program.mock environment.empty home working_directory)) fs shell ///dependency/resolution.empty (with_target empty_profile))] - (_.coverage' [/.no_specified_program] + (unit.coverage [/.no_specified_program] (case outcome {try.#Success _} false @@ -171,7 +172,7 @@ (exception.match? /.no_specified_program error))))) (in (do async.monad [outcome (/.do! (@version.echo "") (program.async (program.mock environment.empty home working_directory)) fs shell ///dependency/resolution.empty profile)] - (_.coverage' [/.Lux /.no_available_lux] + (unit.coverage [/.Lux /.no_available_lux] (case outcome {try.#Success _} false @@ -190,15 +191,15 @@ end (at console read_line [])] (in (and (text#= /.start start) (text#= /.success end))))] - (_.coverage' [/.do! - /.lux_group - /.jvm_lux_name - /.js_lux_name - /.python_lux_name - /.lua_lux_name - /.ruby_lux_name - /.start - /.success] + (unit.coverage [/.do! + /.lux_group + /.jvm_lux_name + /.js_lux_name + /.python_lux_name + /.lua_lux_name + /.ruby_lux_name + /.start + /.success] (try.else false verdict))))) (do ! [.let [console (@version.echo "")] @@ -212,7 +213,7 @@ end (at console read_line [])] (in (and (text#= /.start start) (text#= /.failure end))))] - (_.coverage' [/.failure] + (unit.coverage [/.failure] (try.else false verdict))))) (do ! [expected/0 (random.alphabetic 5) @@ -243,7 +244,7 @@ (text#= expected/1 actual/1) (text#= expected/2 actual/2) end!)))] - (_.coverage' [<log!>] + (unit.coverage [<log!>] (try.else false verdict)))))] [#0 /.log_output!] diff --git a/stdlib/source/test/aedifex/command/clean.lux b/stdlib/source/test/aedifex/command/clean.lux index f4e220aa1..bbc47ccfe 100644 --- a/stdlib/source/test/aedifex/command/clean.lux +++ b/stdlib/source/test/aedifex/command/clean.lux @@ -1,7 +1,6 @@ (.require [library [lux (.except) - ["_" test (.only Test)] [abstract ["[0]" monad (.only do)]] [control @@ -21,7 +20,9 @@ [number ["n" nat]]] [world - ["[0]" file (.only Path)]]]] + ["[0]" file (.only Path)]] + ["_" test (.only Test) + ["[0]" unit]]]] [// ["@[0]" version] [// @@ -115,5 +116,5 @@ (and sub_exists!/pre (not sub_exists!/post)) (text#= (/.success target_path) logging))))] - (_.coverage' [/.do! /.success] + (unit.coverage [/.do! /.success] (try.else false verdict))))))) diff --git a/stdlib/source/test/aedifex/command/deploy.lux b/stdlib/source/test/aedifex/command/deploy.lux index 6a146cc44..dfa352553 100644 --- a/stdlib/source/test/aedifex/command/deploy.lux +++ b/stdlib/source/test/aedifex/command/deploy.lux @@ -1,7 +1,6 @@ (.require [library [lux (.except) - ["_" test (.only Test)] [abstract [monad (.only do)]] [control @@ -32,7 +31,9 @@ [world ["[0]" file] ["[0]" program (.only Program)] - ["[0]" shell]]]] + ["[0]" shell]] + ["_" test (.only Test) + ["[0]" unit]]]] [// ["$[0]" build] ["$[0]" install] @@ -130,5 +131,5 @@ deployed_pom! deployed_sha-1! deployed_md5!)))] - (_.coverage' [/.do! /.success] + (unit.coverage [/.do! /.success] (try.else false verdict))))))) diff --git a/stdlib/source/test/aedifex/command/deps.lux b/stdlib/source/test/aedifex/command/deps.lux index 4d08505b0..905afb575 100644 --- a/stdlib/source/test/aedifex/command/deps.lux +++ b/stdlib/source/test/aedifex/command/deps.lux @@ -1,7 +1,6 @@ (.require [library [lux (.except) - ["_" test (.only Test)] [abstract [monad (.only do)] ["[0]" predicate]] @@ -25,7 +24,9 @@ ["[0]" random (.only Random)]] [world ["[0]" program] - ["[0]" file]]]] + ["[0]" file]] + ["_" test (.only Test) + ["[0]" unit]]]] ["[0]" // ["@[0]" version] ["$/[1]" // @@ -126,5 +127,5 @@ had_dependee_after! had_depender_after!)))] - (_.coverage' [/.do!] + (unit.coverage [/.do!] (try.else false verdict))))))) diff --git a/stdlib/source/test/aedifex/command/install.lux b/stdlib/source/test/aedifex/command/install.lux index 3221f640a..930cc17f4 100644 --- a/stdlib/source/test/aedifex/command/install.lux +++ b/stdlib/source/test/aedifex/command/install.lux @@ -1,7 +1,6 @@ (.require [library [lux (.except) - ["_" test (.only Test)] [abstract ["[0]" monad (.only do)]] [control @@ -21,7 +20,9 @@ ["[0]" random]] [world ["[0]" file] - ["[0]" program (.only Program)]]]] + ["[0]" program (.only Program)]] + ["_" test (.only Test) + ["[0]" unit]]]] [// ["$[0]" version] [// @@ -91,13 +92,13 @@ (in (and succeeded! library_exists! pom_exists!)))] - (_.coverage' [/.do! /.success] + (unit.coverage [/.do! /.success] (try.else false verdict)))) (in (do [! async.monad] [.let [fs (file.mock /) program (program.async (program.mock environment.empty home working_directory))] logging (..execute! program fs (has ///.#identity {.#None} sample))] - (_.coverage' [/.failure] + (unit.coverage [/.failure] (|> logging (try#each (text#= /.failure)) (try.else false))))) diff --git a/stdlib/source/test/aedifex/command/pom.lux b/stdlib/source/test/aedifex/command/pom.lux index 9390cb51b..21deefa0f 100644 --- a/stdlib/source/test/aedifex/command/pom.lux +++ b/stdlib/source/test/aedifex/command/pom.lux @@ -1,7 +1,6 @@ (.require [library [lux (.except) - ["_" test (.only Test)] [abstract [monad (.only do)]] [control @@ -18,7 +17,9 @@ [math ["[0]" random]] [world - ["[0]" file]]]] + ["[0]" file]] + ["_" test (.only Test) + ["[0]" unit]]]] [// ["@[0]" version] [// @@ -57,11 +58,11 @@ (binary#= expected actual)]] (in (and logging! expected_content!)))] - (_.coverage' [/.do! /.success] + (unit.coverage [/.do! /.success] (try.else false verdict))) {try.#Failure error} - (_.coverage' [/.do!] + (unit.coverage [/.do!] (case (the ///.#identity sample) {.#Some _} false diff --git a/stdlib/source/test/aedifex/command/test.lux b/stdlib/source/test/aedifex/command/test.lux index d65fbd491..440123f65 100644 --- a/stdlib/source/test/aedifex/command/test.lux +++ b/stdlib/source/test/aedifex/command/test.lux @@ -1,7 +1,6 @@ (.require [library [lux (.except) - ["_" test (.only Test)] [abstract [monad (.only do)]] [control @@ -21,7 +20,9 @@ [world ["[0]" file] ["[0]" shell] - ["[0]" program]]]] + ["[0]" program]] + ["_" test (.only Test) + ["[0]" unit]]]] ["[0]" // ["@[0]" version] ["@[0]" build] @@ -74,8 +75,8 @@ (text#= //build.success build_end)) (and (text#= /.start test_start) (text#= /.success test_end)))))] - (_.coverage' [/.do! - /.start /.success] + (unit.coverage [/.do! + /.start /.success] (try.else false verdict))))) (let [fs (file.mock (at file.default separator)) console (@version.echo "")] @@ -110,6 +111,6 @@ (text#= //build.success build_end)) (and (text#= /.start test_start) (text#= /.failure test_end)))))] - (_.coverage' [/.failure] + (unit.coverage [/.failure] (try.else false verdict))))) )))) diff --git a/stdlib/source/test/aedifex/command/version.lux b/stdlib/source/test/aedifex/command/version.lux index fa22f379b..1becba8d2 100644 --- a/stdlib/source/test/aedifex/command/version.lux +++ b/stdlib/source/test/aedifex/command/version.lux @@ -1,7 +1,6 @@ (.require [library [lux (.except) - ["_" test (.only Test)] [abstract [monad (.only do)]] [control @@ -20,7 +19,9 @@ [compiler ["[0]" version]]] [world - ["[0]" console (.only Console Mock)]]]] + ["[0]" console (.only Console Mock)]] + ["_" test (.only Test) + ["[0]" unit]]]] [/// ["@[0]" profile]] [\\program @@ -73,5 +74,5 @@ logging (at console read_line [])] (in (text#= (version.format lux_version.latest) logging)))] - (_.coverage' [/.do!] + (unit.coverage [/.do!] (try.else false verdict))))))) diff --git a/stdlib/source/test/aedifex/dependency/deployment.lux b/stdlib/source/test/aedifex/dependency/deployment.lux index fee8caf9d..2eeb0abb8 100644 --- a/stdlib/source/test/aedifex/dependency/deployment.lux +++ b/stdlib/source/test/aedifex/dependency/deployment.lux @@ -1,7 +1,6 @@ (.require [library [lux (.except) - ["_" test (.only Test)] [abstract [monad (.only do)] ["[0]" hash (.only Hash)]] @@ -31,7 +30,9 @@ ["[0]" http ["[1]" client] ["[1]/[0]" status] - ["@[1]" /]]]]]] + ["@[1]" /]]]] + ["_" test (.only Test) + ["[0]" unit]]]] ["$[0]" // (.only) ["[1]/" // ["[1][0]" package]]] @@ -159,7 +160,7 @@ (in (do async.monad [?outcome (/.one repository dependency package) cache (async.future (atom.read! cache))] - (_.coverage' [/.one] + (unit.coverage [/.one] (|> ?outcome (try#each (verify_one 1 address package cache expected_artifact)) (try.else false)))))) @@ -182,7 +183,7 @@ (in (do async.monad [?outcome (/.all repository resolution) cache (async.future (atom.read! cache))] - (_.coverage' [/.all] + (unit.coverage [/.all] (|> ?outcome (try#each (function (_ actual_artifacts) (let [expected_deployments! diff --git a/stdlib/source/test/aedifex/dependency/resolution.lux b/stdlib/source/test/aedifex/dependency/resolution.lux index e724392a5..153d4b4ac 100644 --- a/stdlib/source/test/aedifex/dependency/resolution.lux +++ b/stdlib/source/test/aedifex/dependency/resolution.lux @@ -1,7 +1,6 @@ (.require [library [lux (.except all) - ["_" test (.only Test)] [abstract [monad (.only do)] ["[0]" predicate] @@ -26,7 +25,9 @@ ["[0]" set] ["[0]" list]]] [math - ["[0]" random (.only Random)]]]] + ["[0]" random (.only Random)]] + ["_" test (.only Test) + ["[0]" unit]]]] ["$[0]" /// ["[1][0]" package] ["[1][0]" repository] @@ -262,7 +263,7 @@ [actual_package (/.one (///repository.mock good []) [///dependency.#artifact expected_artifact ///dependency.#type ///artifact/type.lux_library])] - (_.coverage' [/.one] + (unit.coverage [/.one] (case actual_package {try.#Success actual_package} (at ///package.equivalence = @@ -276,7 +277,7 @@ [actual_package (/.one (///repository.mock <bad> []) [///dependency.#artifact expected_artifact ///dependency.#type ///artifact/type.lux_library])] - (_.coverage' [<exception>] + (unit.coverage [<exception>] (case actual_package {try.#Failure error} (exception.match? <exception> error) @@ -311,7 +312,7 @@ (///repository.mock good [])) [///dependency.#artifact expected_artifact ///dependency.#type ///artifact/type.lux_library])] - (_.coverage' [/.any] + (unit.coverage [/.any] (case actual_package {try.#Success actual_package} (at ///package.equivalence = @@ -327,7 +328,7 @@ (///repository.mock bad_md5 [])) [///dependency.#artifact expected_artifact ///dependency.#type ///artifact/type.lux_library])] - (_.coverage' [/.cannot_resolve] + (unit.coverage [/.cannot_resolve] (case actual_package {try.#Failure error} (exception.match? /.cannot_resolve error) @@ -416,7 +417,7 @@ (///repository.mock ..nope [])) (list depender) /.empty)] - (_.coverage' [/.all] + (unit.coverage [/.all] (and (dictionary.key? resolution depender) (list.any? (///dependency#= depender) successes) diff --git a/stdlib/source/test/aedifex/input.lux b/stdlib/source/test/aedifex/input.lux index 23192f590..b9f8195f6 100644 --- a/stdlib/source/test/aedifex/input.lux +++ b/stdlib/source/test/aedifex/input.lux @@ -1,7 +1,6 @@ (.require [library [lux (.except) - ["_" test (.only Test)] [abstract [monad (.only do)]] [control @@ -18,7 +17,9 @@ [math ["[0]" random]] [world - ["[0]" file]]]] + ["[0]" file]] + ["_" test (.only Test) + ["[0]" unit]]]] [// ["$[0]" profile]] [\\program @@ -63,5 +64,5 @@ (revised //.#sources ..with_default_source) (revised //.#repositories ..with_default_repository)) actual)))] - (_.coverage' [/.read] + (unit.coverage [/.read] (try.else false verdict))))))) diff --git a/stdlib/source/test/aedifex/metadata/artifact.lux b/stdlib/source/test/aedifex/metadata/artifact.lux index ed5b95b3b..1e05fbc3a 100644 --- a/stdlib/source/test/aedifex/metadata/artifact.lux +++ b/stdlib/source/test/aedifex/metadata/artifact.lux @@ -1,7 +1,6 @@ (.require [library [lux (.except) - ["_" test (.only Test)] [abstract [monad (.only do)] [\\specification @@ -34,7 +33,9 @@ ["[0]" year] ["[0]" month] ["[0]" instant] - ["[0]" duration]]]]] + ["[0]" duration]]] + ["_" test (.only Test) + ["[0]" unit]]]] [\\program ["[0]" / (.only) ["/[1]" // (.only) @@ -105,7 +106,7 @@ (in (do async.monad [wrote? (/.write repository artifact expected) actual (/.read repository artifact)] - (_.coverage' [/.write /.read] + (unit.coverage [/.write /.read] (and (case wrote? {try.#Success _} true {try.#Failure _} false) diff --git a/stdlib/source/test/aedifex/metadata/snapshot.lux b/stdlib/source/test/aedifex/metadata/snapshot.lux index 773dd262b..983b78d6d 100644 --- a/stdlib/source/test/aedifex/metadata/snapshot.lux +++ b/stdlib/source/test/aedifex/metadata/snapshot.lux @@ -1,7 +1,6 @@ (.require [library [lux (.except) - ["_" test (.only Test)] [abstract [monad (.only do)] [\\specification @@ -34,7 +33,9 @@ ["[0]" year] ["[0]" month] ["[0]" instant (.only Instant)] - ["[0]" duration]]]]] + ["[0]" duration]]] + ["_" test (.only Test) + ["[0]" unit]]]] ["$[0]" /// ["[1][0]" artifact ["[1]/[0]" type] @@ -117,7 +118,7 @@ (in (do async.monad [wrote? (/.write repository artifact expected) actual (/.read repository artifact)] - (_.coverage' [/.write /.read] + (unit.coverage [/.write /.read] (and (case wrote? {try.#Success _} true {try.#Failure _} false) diff --git a/stdlib/source/test/aedifex/repository/local.lux b/stdlib/source/test/aedifex/repository/local.lux index 8eadfd24c..811a8e4e9 100644 --- a/stdlib/source/test/aedifex/repository/local.lux +++ b/stdlib/source/test/aedifex/repository/local.lux @@ -1,7 +1,6 @@ (.require [library [lux (.except) - ["_" test (.only Test)] [abstract [monad (.only do)]] [control @@ -19,7 +18,9 @@ ["[0]" random]] [world ["[0]" file] - ["[0]" program]]]] + ["[0]" program]] + ["_" test (.only Test) + ["[0]" unit]]]] [\\program ["[0]" /]]) @@ -42,7 +43,7 @@ [before_upload (at repo download uri) _ (at repo upload uri expected) actual (at repo download uri)] - (_.coverage' [/.repository] + (unit.coverage [/.repository] (and (case before_upload {try.#Success _} false {try.#Failure _} true) diff --git a/stdlib/source/test/lux/abstract/equivalence.lux b/stdlib/source/test/lux/abstract/equivalence.lux index 0ea65a1ca..4a747951f 100644 --- a/stdlib/source/test/lux/abstract/equivalence.lux +++ b/stdlib/source/test/lux/abstract/equivalence.lux @@ -88,7 +88,7 @@ Test (<| (_.covering \\polytypic._) (_.for [\\polytypic.equivalence] - (for @.old (_.property "PLACEHOLDER" true) + (for @.old (_.test "PLACEHOLDER" true) (\\specification.spec ..equivalence ..random))))) (def .public test diff --git a/stdlib/source/test/lux/abstract/interval.lux b/stdlib/source/test/lux/abstract/interval.lux index 438a02394..8953e1d80 100644 --- a/stdlib/source/test/lux/abstract/interval.lux +++ b/stdlib/source/test/lux/abstract/interval.lux @@ -93,11 +93,11 @@ left_outer ..outer right_outer ..outer] (all _.and - (_.property "The union of an interval to itself yields the same interval." + (_.test "The union of an interval to itself yields the same interval." (/#= some_interval (/.union some_interval some_interval))) - (_.property "The union of 2 inner intervals is another inner interval." + (_.test "The union of 2 inner intervals is another inner interval." (/.inner? (/.union left_inner right_inner))) - (_.property "The union of 2 outer intervals yields an inner interval when their complements don't overlap, and an outer when they do." + (_.test "The union of 2 outer intervals yields an inner interval when their complements don't overlap, and an outer when they do." (if (/.overlaps? (/.complement left_outer) (/.complement right_outer)) (/.outer? (/.union left_outer right_outer)) (/.inner? (/.union left_outer right_outer)))) @@ -114,13 +114,13 @@ left_outer ..outer right_outer ..outer] (all _.and - (_.property "The intersection of an interval to itself yields the same interval." + (_.test "The intersection of an interval to itself yields the same interval." (/#= some_interval (/.intersection some_interval some_interval))) - (_.property "The intersection of 2 inner intervals yields an inner interval when they overlap, and an outer when they don't." + (_.test "The intersection of 2 inner intervals yields an inner interval when they overlap, and an outer when they don't." (if (/.overlaps? left_inner right_inner) (/.inner? (/.intersection left_inner right_inner)) (/.outer? (/.intersection left_inner right_inner)))) - (_.property "The intersection of 2 outer intervals is another outer interval." + (_.test "The intersection of 2 outer intervals is another outer interval." (/.outer? (/.intersection left_outer right_outer))) ))) @@ -129,9 +129,9 @@ (do random.monad [some_interval ..interval] (all _.and - (_.property "The complement of a complement is the same as the original." + (_.test "The complement of a complement is the same as the original." (/#= some_interval (|> some_interval /.complement /.complement))) - (_.property "The complement of an interval does not overlap it." + (_.test "The complement of an interval does not overlap it." (not (/.overlaps? some_interval (/.complement some_interval)))) ))) @@ -199,22 +199,22 @@ _ (undefined)))))] (all _.and - (_.property "Every interval is nested into itself." + (_.test "Every interval is nested into itself." (/.nested? some_interval some_interval)) (let [small_inner (/.between n.enum x1 x2) large_inner (/.between n.enum x0 x3)] - (_.property "Inner intervals can be nested inside one another." + (_.test "Inner intervals can be nested inside one another." (and (/.nested? large_inner small_inner) (not (/.nested? small_inner large_inner))))) (let [small_outer (/.between n.enum x2 x1) large_outer (/.between n.enum x3 x0)] - (_.property "Outer intervals can be nested inside one another." + (_.test "Outer intervals can be nested inside one another." (and (/.nested? small_outer large_outer) (not (/.nested? large_outer small_outer))))) (let [left_inner (/.between n.enum x0 x1) right_inner (/.between n.enum x2 x3) outer (/.between n.enum x0 x3)] - (_.property "Inners can be nested inside outers." + (_.test "Inners can be nested inside outers." (and (/.nested? outer left_inner) (/.nested? outer right_inner)))) ))) @@ -233,17 +233,17 @@ _ (undefined)))))] (all _.and - (_.property "No interval overlaps with itself." + (_.test "No interval overlaps with itself." (not (/.overlaps? some_interval some_interval))) (let [left_inner (/.between n.enum x0 x2) right_inner (/.between n.enum x1 x3)] - (_.property "Inner intervals can overlap one another." + (_.test "Inner intervals can overlap one another." (and (/.overlaps? left_inner right_inner) (/.overlaps? right_inner left_inner)))) (let [left_inner (/.between n.enum x0 x2) right_inner (/.between n.enum x1 x3) outer (/.between n.enum x1 x2)] - (_.property "Inners can overlap outers." + (_.test "Inners can overlap outers." (and (/.overlaps? outer left_inner) (/.overlaps? outer right_inner)))) ))) diff --git a/stdlib/source/test/lux/control/concurrency/actor.lux b/stdlib/source/test/lux/control/concurrency/actor.lux index d3ecb4887..e4f3755c2 100644 --- a/stdlib/source/test/lux/control/concurrency/actor.lux +++ b/stdlib/source/test/lux/control/concurrency/actor.lux @@ -1,7 +1,6 @@ (.require [library [lux (.except) - ["_" test (.only Test)] [abstract [monad (.only do)]] [control @@ -17,7 +16,9 @@ [math ["[0]" random] [number - ["n" nat]]]]] + ["n" nat]]] + ["_" test (.only Test) + ["[0]" unit]]]] [\\library ["[0]" / (.only) [// @@ -101,7 +102,7 @@ (/.poison! actor))) _ (async.delay 100) result (async.future (async.value read))] - (_.coverage' [/.poisoned] + (unit.coverage [/.poisoned] (case result {.#Some error} (exception.match? /.poisoned error) @@ -114,8 +115,8 @@ [actor (/.spawn! /.default 0) sent? (/.mail! ++! actor)] (in (..mailed? sent?))))] - (_.coverage' [/.Behavior /.Mail - /.default /.spawn! /.mail!] + (unit.coverage [/.Behavior /.Mail + /.default /.spawn! /.mail!] sent?))) (in (do async.monad @@ -123,7 +124,7 @@ [counter (/.spawn! /.default 0) _ (/.poison! counter)] (/.mail! ++! counter)))] - (_.coverage' [/.dead] + (unit.coverage [/.dead] (case result {try.#Success outcome} false @@ -141,7 +142,7 @@ alive? (/.alive? actor) obituary (/.obituary' actor)] (in {try.#Success [actor sent? alive? obituary]})))] - (_.coverage' [/.Obituary /.obituary'] + (unit.coverage [/.Obituary /.obituary'] (case result {try.#Success [actor sent? alive? {.#Some [error state (list single_pending_message)]}]} (and (..mailed? sent?) @@ -162,7 +163,7 @@ (in (and (n.= 1 output_1) (n.= 2 output_2) (n.= 3 output_3))))] - (_.coverage' [/.Message /.tell!] + (unit.coverage [/.Message /.tell!] (case result {try.#Success outcome} outcome @@ -196,6 +197,6 @@ (in agent))) _ (/.obituary agent) actual (async.future (atom.read! sink))] - (_.coverage' [/.Stop /.observe! /.obituary] + (unit.coverage [/.Stop /.observe! /.obituary] (at (list.equivalence n.equivalence) = expected (sequence.list actual)))))) )))) diff --git a/stdlib/source/test/lux/control/concurrency/async.lux b/stdlib/source/test/lux/control/concurrency/async.lux index 42d938ddd..3cdaf2da4 100644 --- a/stdlib/source/test/lux/control/concurrency/async.lux +++ b/stdlib/source/test/lux/control/concurrency/async.lux @@ -1,7 +1,6 @@ (.require [library [lux (.except) - ["_" test (.only Test)] [abstract [monad (.only do)] [\\specification @@ -21,7 +20,9 @@ [world [time ["[0]" instant] - ["[0]" duration]]]]] + ["[0]" duration]]] + ["_" test (.only Test) + ["[0]" unit]]]] [\\library ["[0]" / (.only) [// @@ -73,22 +74,22 @@ (/.async []))] resolved? (/.future (resolver expected)) actual async] - (_.coverage' [/.Async /.Resolver /.async] + (unit.coverage [/.Async /.Resolver /.async] (and resolved? (n.= expected actual))))) (in (do /.monad [actual (/.resolved expected)] - (_.coverage' [/.resolved] + (unit.coverage [/.resolved] (n.= expected actual)))) (in (do /.monad [actual (/.future (io.io expected))] - (_.coverage' [/.future] + (unit.coverage [/.future] (n.= expected actual)))) (in (do /.monad [pre (/.future instant.now) actual (/.schedule! waiting_time (io.io expected)) post (/.future instant.now)] - (_.coverage' [/.schedule!] + (unit.coverage [/.schedule!] (and (n.= expected actual) (i.>= (.int waiting_time) (duration.millis (instant.span pre post))))))) @@ -96,20 +97,20 @@ [pre (/.future instant.now) _ (/.delay waiting_time) post (/.future instant.now)] - (_.coverage' [/.delay] + (unit.coverage [/.delay] (i.>= (.int waiting_time) (duration.millis (instant.span pre post)))))) (in (do /.monad [[leftA rightA] (/.and (/.future (io.io leftE)) (/.future (io.io rightE)))] - (_.coverage' [/.and] + (unit.coverage [/.and] (n.= (n.+ leftE rightE) (n.+ leftA rightA))))) (in (do /.monad [pre (/.future instant.now) actual (/.after waiting_time expected) post (/.future instant.now)] - (_.coverage' [/.after] + (unit.coverage [/.after] (and (n.= expected actual) (i.>= (.int waiting_time) (duration.millis (instant.span pre post))))))) @@ -118,7 +119,7 @@ (/.after waiting_time dummy)) ?right (/.or (/.after waiting_time dummy) (in rightE))] - (_.coverage' [/.or] + (unit.coverage [/.or] (case [?left ?right] [{.#Left leftA} {.#Right rightA}] (n.= (n.+ leftE rightE) @@ -131,7 +132,7 @@ (/.after waiting_time dummy)) rightA (/.either (/.after waiting_time dummy) (in rightE))] - (_.coverage' [/.either] + (unit.coverage [/.either] (n.= (n.+ leftE rightE) (n.+ leftA rightA))))) (in (do /.monad @@ -139,7 +140,7 @@ .let [[async resolver] (is [(/.Async Nat) (/.Resolver Nat)] (/.async []))] ?never (/.future (/.value async))] - (_.coverage' [/.value] + (unit.coverage [/.value] (case [?actual ?never] [{.#Some actual} {.#None}] (n.= expected actual) @@ -151,13 +152,13 @@ .let [[async resolver] (is [(/.Async Nat) (/.Resolver Nat)] (/.async []))] nope (/.future (/.resolved? async))] - (_.coverage' [/.resolved?] + (unit.coverage [/.resolved?] (and yep (not nope))))) (in (do /.monad [?none (/.within 0 (/.after waiting_time dummy)) ?actual (/.within waiting_time (in expected))] - (_.coverage' [/.within] + (unit.coverage [/.within] (case [?none ?actual] [{.#None} {.#Some actual}] (n.= expected actual) @@ -171,6 +172,6 @@ (atom.write! value box)) (/.resolved expected))) actual (/.future (atom.read! box))] - (_.coverage' [/.upon!] + (unit.coverage [/.upon!] (n.= expected actual)))) )))) diff --git a/stdlib/source/test/lux/control/concurrency/frp.lux b/stdlib/source/test/lux/control/concurrency/frp.lux index 05fd6360c..147b8d2cb 100644 --- a/stdlib/source/test/lux/control/concurrency/frp.lux +++ b/stdlib/source/test/lux/control/concurrency/frp.lux @@ -1,7 +1,6 @@ (.require [library [lux (.except) - ["_" test (.only Test)] [abstract [monad (.only do)] [\\specification @@ -19,7 +18,9 @@ [math ["[0]" random] [number - ["n" nat]]]]] + ["n" nat]]] + ["_" test (.only Test) + ["[0]" unit]]]] [\\library ["[0]" / (.only) [// @@ -121,14 +122,14 @@ async.resolved /.of_async /.list)] - (_.coverage' [/.of_async /.list] + (unit.coverage [/.of_async /.list] (list#= (list sample) output)))) (in (do async.monad [output (|> inputs (/.sequential 0) /.list)] - (_.coverage' [/.sequential] + (unit.coverage [/.sequential] (list#= inputs output)))) (in (do async.monad @@ -136,7 +137,7 @@ (/.sequential 0) (/.only n.even?) /.list)] - (_.coverage' [/.only] + (unit.coverage [/.only] (list#= (list.only n.even? inputs) output)))) (in (do [! async.monad] @@ -160,14 +161,14 @@ atom.read! async.future (at ! each sequence.list))] - (_.coverage' [/.Subscriber /.subscribe!] + (unit.coverage [/.Subscriber /.subscribe!] (list#= inputs listened)))) (in (do async.monad [actual (/.mix (function (_ input total) (async.resolved (n.+ input total))) 0 (/.sequential 0 inputs))] - (_.coverage' [/.mix] + (unit.coverage [/.mix] (n.= (list#mix n.+ 0 inputs) actual)))) (in (do async.monad @@ -177,7 +178,7 @@ (async.resolved (n.+ input total))) 0) /.list)] - (_.coverage' [/.mixes] + (unit.coverage [/.mixes] (list#= (list.mixes n.+ 0 inputs) actual)))) (in (do async.monad @@ -187,7 +188,7 @@ (/.sequential 0) (/.distinct n.equivalence) /.list)] - (_.coverage' [/.distinct] + (unit.coverage [/.distinct] (list#= (list distinct/0 distinct/1 distinct/2) actual)))) (do ! @@ -201,12 +202,12 @@ enough_polls! (n.= amount_of_polls (list.size actual))]] - (_.coverage' [/.poll] + (unit.coverage [/.poll] (and correct_values! enough_polls!)))) (in (do [! async.monad] [actual (..take_amount amount_of_polls (/.periodic polling_delay))] - (_.coverage' [/.periodic] + (unit.coverage [/.periodic] (n.= amount_of_polls (list.size actual))))))) (in (do async.monad [.let [max_iterations 10] @@ -218,7 +219,7 @@ current]} {.#None})))) /.list)] - (_.coverage' [/.iterations] + (unit.coverage [/.iterations] (and (n.= max_iterations (list.size actual)) (list#= (list.mixes n.+ sample (list.repeated (-- max_iterations) shift)) actual))))) diff --git a/stdlib/source/test/lux/control/concurrency/semaphore.lux b/stdlib/source/test/lux/control/concurrency/semaphore.lux index ac4bd63b3..5254ce02f 100644 --- a/stdlib/source/test/lux/control/concurrency/semaphore.lux +++ b/stdlib/source/test/lux/control/concurrency/semaphore.lux @@ -1,7 +1,6 @@ (.require [library [lux (.except) - ["_" test (.only Test)] [abstract ["[0]" monad (.only do)] ["[0]" enum]] @@ -26,7 +25,9 @@ [meta ["@" target] [type - ["[0]" refinement]]]]] + ["[0]" refinement]]] + ["_" test (.only Test) + ["[0]" unit]]]] [\\library ["[0]" /]]) @@ -43,7 +44,7 @@ .let [semaphore (/.semaphore initial_open_positions)]] (in (do async.monad [result (async.within ..delay (/.wait! semaphore))] - (_.coverage' [/.semaphore] + (unit.coverage [/.semaphore] (case result {.#Some _} true @@ -56,7 +57,7 @@ (in (do [! async.monad] [_ (monad.each ! /.wait! (list.repeated initial_open_positions semaphore)) result (async.within ..delay (/.wait! semaphore))] - (_.coverage' [/.wait!] + (unit.coverage [/.wait!] (case result {.#Some _} false @@ -72,7 +73,7 @@ result/0 (async.within ..delay block) open_positions (/.signal! semaphore) result/1 (async.within ..delay block)] - (_.coverage' [/.signal!] + (unit.coverage [/.signal!] (case [result/0 result/1 open_positions] [{.#None} {.#Some _} {try.#Success +0}] true @@ -84,7 +85,7 @@ .let [semaphore (/.semaphore initial_open_positions)]] (in (do async.monad [outcome (/.signal! semaphore)] - (_.coverage' [/.semaphore_is_maxed_out] + (unit.coverage [/.semaphore_is_maxed_out] (case outcome {try.#Failure error} (exception.match? /.semaphore_is_maxed_out error) @@ -123,7 +124,7 @@ [_ processA _ processB .let [outcome (io.run! (atom.read! resource))]] - (_.coverage' [/.mutex /.synchronize!] + (unit.coverage [/.mutex /.synchronize!] (or (text#= (format expected_As expected_Bs) outcome) (text#= (format expected_Bs expected_As) @@ -171,7 +172,7 @@ (waiter resource barrier id)))) (monad.all !)) .let [outcome (io.run! (atom.read! resource))]] - (_.coverage' [/.barrier /.block!] + (unit.coverage [/.barrier /.block!] (and (text.ends_with? expected_ending outcome) (list.every? (function (_ id) (text.contains? (%.nat id) outcome)) diff --git a/stdlib/source/test/lux/control/concurrency/stm.lux b/stdlib/source/test/lux/control/concurrency/stm.lux index c5f5ce325..cb6fc3e81 100644 --- a/stdlib/source/test/lux/control/concurrency/stm.lux +++ b/stdlib/source/test/lux/control/concurrency/stm.lux @@ -1,7 +1,6 @@ (.require [library [lux (.except) - ["_" test (.only Test)] [abstract ["[0]" monad (.only Monad do)] [\\specification @@ -17,7 +16,9 @@ [math ["[0]" random] [number - ["n" nat]]]]] + ["n" nat]]] + ["_" test (.only Test) + ["[0]" unit]]]] [\\library ["[0]" / (.only) [// @@ -52,11 +53,11 @@ (in (do async.monad [actual (/.commit! (at /.monad in expected))] - (_.coverage' [/.commit!] + (unit.coverage [/.commit!] (n.= expected actual)))) (in (do async.monad [actual (/.commit! (/.read (/.var expected)))] - (_.coverage' [/.Var /.var /.read] + (unit.coverage [/.Var /.var /.read] (n.= expected actual)))) (in (do async.monad [actual (let [box (/.var dummy)] @@ -68,7 +69,7 @@ [_ (/.write expected box) actual (/.read box)] (in (n.= expected actual)))))] - (_.coverage' [/.write] + (unit.coverage [/.write] (and (n.= expected actual) verdict)))) (in (do async.monad @@ -76,7 +77,7 @@ output (/.commit! (do /.monad [_ (/.update (n.+ expected) box)] (/.read box)))] - (_.coverage' [/.update] + (unit.coverage [/.update] (n.= (n.+ expected dummy) output)))) (in (do async.monad @@ -87,7 +88,7 @@ _ (async.future (at sink close)) _ (/.commit! (/.update (n.* 3) box)) changes (frp.list follower)] - (_.coverage' [/.changes] + (unit.coverage [/.changes] (at (list.equivalence n.equivalence) = (list expected (n.* 2 expected)) changes)))) @@ -97,7 +98,7 @@ (list#each (function (_ _) (/.commit! (/.update ++ var)))) (monad.all !)) cummulative (/.commit! (/.read var))] - (_.coverage' [/.STM] + (unit.coverage [/.STM] (n.= iterations_per_process cummulative))))) )))) diff --git a/stdlib/source/test/lux/control/concurrency/thread.lux b/stdlib/source/test/lux/control/concurrency/thread.lux index da2a9ea37..83a626c4f 100644 --- a/stdlib/source/test/lux/control/concurrency/thread.lux +++ b/stdlib/source/test/lux/control/concurrency/thread.lux @@ -1,7 +1,6 @@ (.require [library [lux (.except) - ["_" test (.only Test)] [abstract [monad (.only do)]] [control @@ -14,7 +13,9 @@ [world [time ["[0]" instant (.only Instant)] - ["[0]" duration]]]]] + ["[0]" duration]]] + ["_" test (.only Test) + ["[0]" unit]]]] [\\library ["[0]" / (.only) [// @@ -41,7 +42,7 @@ (atom.write! [execution_time expected] box)))) _ (async.delay (n.* 2 delay)) [execution_time actual] (async.future (atom.read! box))] - (_.coverage' [/.schedule!] + (unit.coverage [/.schedule!] (let [expected_delay! (i.>= (.int delay) (duration.millis (instant.span reference_time execution_time))) diff --git a/stdlib/source/test/lux/control/security/capability.lux b/stdlib/source/test/lux/control/security/capability.lux index ecc9d22ba..d02572381 100644 --- a/stdlib/source/test/lux/control/security/capability.lux +++ b/stdlib/source/test/lux/control/security/capability.lux @@ -1,7 +1,6 @@ (.require [library [lux (.except) - ["_" test (.only Test)] [abstract [monad (.only do)]] [control @@ -11,7 +10,9 @@ [math ["[0]" random] [number - ["n" nat]]]]] + ["n" nat]]] + ["_" test (.only Test) + ["[0]" unit]]]] [\\library ["[0]" /]]) @@ -40,6 +41,6 @@ (in (let [capability (..can_io (function (_ _) (io.io expected)))] (do async.monad [actual (/.use (/.async capability) [])] - (_.coverage' [/.async] + (unit.coverage [/.async] (n.= expected actual))))) ))))) diff --git a/stdlib/source/test/lux/data/format/json.lux b/stdlib/source/test/lux/data/format/json.lux index 3fffb74a1..b64a685a2 100644 --- a/stdlib/source/test/lux/data/format/json.lux +++ b/stdlib/source/test/lux/data/format/json.lux @@ -260,7 +260,7 @@ Test (<| (_.covering \\polytypic._) (_.for [\\polytypic.codec] - (for @.old (_.property "PLACEHOLDER" true) + (for @.old (_.test "PLACEHOLDER" true) ($codec.spec ..equivalence ..codec ..gen_record))))) (def .public random diff --git a/stdlib/source/test/lux/data/text/regex.lux b/stdlib/source/test/lux/data/text/regex.lux index 661222696..7485c1d05 100644 --- a/stdlib/source/test/lux/data/text/regex.lux +++ b/stdlib/source/test/lux/data/text/regex.lux @@ -72,7 +72,7 @@ (def basics Test - (_.property "Can parse character literals." + (_.test "Can parse character literals." (and (should_pass (/.regex "a") "a") (should_fail (/.regex "a") ".") (should_pass (/.regex "\.") ".") @@ -81,30 +81,30 @@ (def system_character_classes Test (all _.and - (_.property "Can parse anything." + (_.test "Can parse anything." (should_pass (/.regex ".") "a")) - (_.property "Can parse digits." + (_.test "Can parse digits." (and (should_pass (/.regex "\d") "0") (should_fail (/.regex "\d") "m"))) - (_.property "Can parse non digits." + (_.test "Can parse non digits." (and (should_pass (/.regex "\D") "m") (should_fail (/.regex "\D") "0"))) - (_.property "Can parse white-space." + (_.test "Can parse white-space." (and (should_pass (/.regex "\s") " ") (should_fail (/.regex "\s") "m"))) - (_.property "Can parse non white-space." + (_.test "Can parse non white-space." (and (should_pass (/.regex "\S") "m") (should_fail (/.regex "\S") " "))) - (_.property "Can parse word characters." + (_.test "Can parse word characters." (and (should_pass (/.regex "\w") "_") (should_fail (/.regex "\w") "^"))) - (_.property "Can parse non word characters." + (_.test "Can parse non word characters." (and (should_pass (/.regex "\W") ".") (should_fail (/.regex "\W") "a"))) )) @@ -112,46 +112,46 @@ (def special_system_character_classes Test (all _.and - (_.property "Lower-case." + (_.test "Lower-case." (and (should_pass (/.regex "\p{Lower}") "m") (should_fail (/.regex "\p{Lower}") "M"))) - (_.property "Upper-case." + (_.test "Upper-case." (and (should_pass (/.regex "\p{Upper}") "M") (should_fail (/.regex "\p{Upper}") "m"))) - (_.property "Alphabetic." + (_.test "Alphabetic." (and (should_pass (/.regex "\p{Alpha}") "M") (should_fail (/.regex "\p{Alpha}") "0"))) - (_.property "Numeric digits." + (_.test "Numeric digits." (and (should_pass (/.regex "\p{Digit}") "1") (should_fail (/.regex "\p{Digit}") "n"))) - (_.property "Alphanumeric." + (_.test "Alphanumeric." (and (should_pass (/.regex "\p{Alnum}") "1") (should_fail (/.regex "\p{Alnum}") "."))) - (_.property "Whitespace." + (_.test "Whitespace." (and (should_pass (/.regex "\p{Space}") " ") (should_fail (/.regex "\p{Space}") "."))) - (_.property "Hexadecimal." + (_.test "Hexadecimal." (and (should_pass (/.regex "\p{HexDigit}") "a") (should_fail (/.regex "\p{HexDigit}") "."))) - (_.property "Octal." + (_.test "Octal." (and (should_pass (/.regex "\p{OctDigit}") "6") (should_fail (/.regex "\p{OctDigit}") "."))) - (_.property "Blank." + (_.test "Blank." (and (should_pass (/.regex "\p{Blank}") text.tab) (should_fail (/.regex "\p{Blank}") "."))) - (_.property "ASCII." + (_.test "ASCII." (and (should_pass (/.regex "\p{ASCII}") text.tab) (should_fail (/.regex "\p{ASCII}") (text.of_char (hex "1234"))))) - (_.property "Control characters." + (_.test "Control characters." (and (should_pass (/.regex "\p{Contrl}") (text.of_char (hex "12"))) (should_fail (/.regex "\p{Contrl}") "a"))) - (_.property "Punctuation." + (_.test "Punctuation." (and (should_pass (/.regex "\p{Punct}") "@") (should_fail (/.regex "\p{Punct}") "a"))) - (_.property "Graph." + (_.test "Graph." (and (should_pass (/.regex "\p{Graph}") "@") (should_fail (/.regex "\p{Graph}") " "))) - (_.property "Print." + (_.test "Print." (and (should_pass (/.regex "\p{Print}") (text.of_char (hex "20"))) (should_fail (/.regex "\p{Print}") (text.of_char (hex "1234"))))) )) @@ -159,30 +159,30 @@ (def custom_character_classes Test (all _.and - (_.property "Can parse using custom character classes." + (_.test "Can parse using custom character classes." (and (should_pass (/.regex "[abc]") "a") (should_fail (/.regex "[abc]") "m"))) - (_.property "Can parse using character ranges." + (_.test "Can parse using character ranges." (and (should_pass (/.regex "[a-z]") "a") (should_pass (/.regex "[a-z]") "m") (should_pass (/.regex "[a-z]") "z"))) - (_.property "Can combine character ranges." + (_.test "Can combine character ranges." (and (should_pass (/.regex "[a-zA-Z]") "a") (should_pass (/.regex "[a-zA-Z]") "m") (should_pass (/.regex "[a-zA-Z]") "z") (should_pass (/.regex "[a-zA-Z]") "A") (should_pass (/.regex "[a-zA-Z]") "M") (should_pass (/.regex "[a-zA-Z]") "Z"))) - (_.property "Can negate custom character classes." + (_.test "Can negate custom character classes." (and (should_fail (/.regex "[^abc]") "a") (should_pass (/.regex "[^abc]") "m"))) - (_.property "Can negate character ranges.." + (_.test "Can negate character ranges.." (and (should_fail (/.regex "[^a-z]") "a") (should_pass (/.regex "[^a-z]") "0"))) - (_.property "Can parse negate combinations of character ranges." + (_.test "Can parse negate combinations of character ranges." (and (should_fail (/.regex "[^a-zA-Z]") "a") (should_pass (/.regex "[^a-zA-Z]") "0"))) - (_.property "Can make custom character classes more specific." + (_.test "Can make custom character classes more specific." (and (let [RE (/.regex "[a-z&&[def]]")] (and (should_fail RE "a") (should_pass RE "d"))) @@ -198,7 +198,7 @@ (def references Test (let [number (/.regex "\d+")] - (_.property "Can build complex regexs by combining simpler ones." + (_.test "Can build complex regexs by combining simpler ones." (should_check ["809-345-6789" "809" "345" "6789"] (/.regex "(\@<number>)-(\@<number>)-(\@<number>)") "809-345-6789")))) @@ -206,18 +206,18 @@ (def fuzzy_quantifiers Test (all _.and - (_.property "Can sequentially combine patterns." + (_.test "Can sequentially combine patterns." (text_should_pass "aa" (/.regex "aa") "aa")) - (_.property "Can match patterns optionally." + (_.test "Can match patterns optionally." (and (text_should_pass "a" (/.regex "a?") "a") (text_should_pass "" (/.regex "a?") ""))) - (_.property "Can match a pattern 0 or more times." + (_.test "Can match a pattern 0 or more times." (and (text_should_pass "aaa" (/.regex "a*") "aaa") (text_should_pass "" (/.regex "a*") ""))) - (_.property "Can match a pattern 1 or more times." + (_.test "Can match a pattern 1 or more times." (and (text_should_pass "aaa" (/.regex "a+") "aaa") (text_should_pass "a" (/.regex "a+") "a") (should_fail (/.regex "a+") ""))) @@ -226,21 +226,21 @@ (def crisp_quantifiers Test (all _.and - (_.property "Can match a pattern N times." + (_.test "Can match a pattern N times." (and (text_should_pass "aa" (/.regex "a{2}") "aa") (text_should_pass "a" (/.regex "a{1}") "a") (should_fail (/.regex "a{3}") "aa"))) - (_.property "Can match a pattern at-least N times." + (_.test "Can match a pattern at-least N times." (and (text_should_pass "aa" (/.regex "a{1,}") "aa") (text_should_pass "aa" (/.regex "a{2,}") "aa") (should_fail (/.regex "a{3,}") "aa"))) - (_.property "Can match a pattern at-most N times." + (_.test "Can match a pattern at-most N times." (and (text_should_pass "aa" (/.regex "a{,2}") "aa") (text_should_pass "aa" (/.regex "a{,3}") "aa"))) - (_.property "Can match a pattern between N and M times." + (_.test "Can match a pattern between N and M times." (and (text_should_pass "a" (/.regex "a{1,2}") "a") (text_should_pass "aa" (/.regex "a{1,2}") "aa"))) )) @@ -248,7 +248,7 @@ (def groups Test (all _.and - (_.property "Can extract groups of sub-matches specified in a pattern." + (_.test "Can extract groups of sub-matches specified in a pattern." (and (should_check ["abc" "b"] (/.regex "a(.)c") "abc") (should_check ["abbbbbc" "bbbbb"] (/.regex "a(b+)c") "abbbbbc") (should_check ["809-345-6789" "809" "345" "6789"] (/.regex "(\d{3})-(\d{3})-(\d{4})") "809-345-6789") @@ -257,18 +257,18 @@ (should_check ["809-809-6789" "809" "6789"] (/.regex "(?<code>\d{3})-\k<code>-(\d{4})") "809-809-6789") (should_check ["809-809-6789-6789" "809" "6789"] (/.regex "(?<code>\d{3})-\k<code>-(\d{4})-\0") "809-809-6789-6789"))) - (_.property "Can specify groups within groups." + (_.test "Can specify groups within groups." (should_check ["809-345-6789" "809" ["345-6789" "345" "6789"]] (/.regex "(\d{3})-((\d{3})-(\d{4}))") "809-345-6789")) )) (def alternation Test (all _.and - (_.property "Can specify alternative patterns." + (_.test "Can specify alternative patterns." (and (should_check ["a" {0 #0 []}] (/.regex "a|b") "a") (should_check ["b" {0 #1 []}] (/.regex "a|b") "b") (should_fail (/.regex "a|b") "c"))) - (_.property "Can have groups within alternations." + (_.test "Can have groups within alternations." (and (should_check ["abc" {0 #0 ["b" "c"]}] (/.regex "a(.)(.)|b(.)(.)") "abc") (should_check ["bcd" {0 #1 ["c" "d"]}] (/.regex "a(.)(.)|b(.)(.)") "bcd") (should_fail (/.regex "a(.)(.)|b(.)(.)") "cde") diff --git a/stdlib/source/test/lux/ffi.php.lux b/stdlib/source/test/lux/ffi.php.lux index b047e35fa..324bd7b81 100644 --- a/stdlib/source/test/lux/ffi.php.lux +++ b/stdlib/source/test/lux/ffi.php.lux @@ -21,5 +21,5 @@ (do [! random.monad] [] (<| (_.covering /._) - (_.property "TBD" + (_.test "TBD" true)))) diff --git a/stdlib/source/test/lux/ffi.scm.lux b/stdlib/source/test/lux/ffi.scm.lux index b047e35fa..324bd7b81 100644 --- a/stdlib/source/test/lux/ffi.scm.lux +++ b/stdlib/source/test/lux/ffi.scm.lux @@ -21,5 +21,5 @@ (do [! random.monad] [] (<| (_.covering /._) - (_.property "TBD" + (_.test "TBD" true)))) diff --git a/stdlib/source/test/lux/meta/compiler/language/lux/phase/extension/analysis/lux.lux b/stdlib/source/test/lux/meta/compiler/language/lux/phase/extension/analysis/lux.lux index ac89471ba..5de7ad7d3 100644 --- a/stdlib/source/test/lux/meta/compiler/language/lux/phase/extension/analysis/lux.lux +++ b/stdlib/source/test/lux/meta/compiler/language/lux/phase/extension/analysis/lux.lux @@ -61,11 +61,11 @@ [antiT antiC] (|> ..primitive (r.only (|>> product.left (type#= primT) not)))] (all _.and - (_.property "Can test for reference equality." + (_.test "Can test for reference equality." (check_success+ "lux is" (list primC primC) Bit)) - (_.property "Reference equality must be done with elements of the same type." + (_.test "Reference equality must be done with elements of the same type." (check_failure+ "lux is" (list primC antiC) Bit)) - (_.property "Can 'try' risky IO computations." + (_.test "Can 'try' risky IO computations." (check_success+ "lux try" (list (` ("lux io error" "YOLO"))) (type_literal (Either Text primT)))) @@ -78,23 +78,23 @@ signedC (|> r.int (at ! each code.int)) paramC (|> r.nat (at ! each code.nat))] (all _.and - (_.property "i64 'and'." + (_.test "i64 'and'." (check_success+ "lux i64 and" (list paramC subjectC) Nat)) - (_.property "i64 'or'." + (_.test "i64 'or'." (check_success+ "lux i64 or" (list paramC subjectC) Nat)) - (_.property "i64 'xor'." + (_.test "i64 'xor'." (check_success+ "lux i64 xor" (list paramC subjectC) Nat)) - (_.property "i64 left-shift." + (_.test "i64 left-shift." (check_success+ "lux i64 left-shift" (list paramC subjectC) Nat)) - (_.property "i64 logical-right-shift." + (_.test "i64 logical-right-shift." (check_success+ "lux i64 logical-right-shift" (list paramC subjectC) Nat)) - (_.property "i64 arithmetic-right-shift." + (_.test "i64 arithmetic-right-shift." (check_success+ "lux i64 arithmetic-right-shift" (list paramC signedC) Int)) - (_.property "i64 equivalence." + (_.test "i64 equivalence." (check_success+ "lux i64 =" (list paramC subjectC) Bit)) - (_.property "i64 addition." + (_.test "i64 addition." (check_success+ "lux i64 +" (list paramC subjectC) Int)) - (_.property "i64 subtraction." + (_.test "i64 subtraction." (check_success+ "lux i64 -" (list paramC subjectC) Int)) ))) @@ -104,17 +104,17 @@ [subjectC (|> r.int (at ! each code.int)) paramC (|> r.int (at ! each code.int))] (all _.and - (_.property "Can multiply integers." + (_.test "Can multiply integers." (check_success+ "lux i64 *" (list paramC subjectC) Int)) - (_.property "Can divide integers." + (_.test "Can divide integers." (check_success+ "lux i64 /" (list paramC subjectC) Int)) - (_.property "Can calculate remainder of integers." + (_.test "Can calculate remainder of integers." (check_success+ "lux i64 %" (list paramC subjectC) Int)) - (_.property "Can compare integers." + (_.test "Can compare integers." (check_success+ "lux i64 <" (list paramC subjectC) Bit)) - (_.property "Can convert integer to text." + (_.test "Can convert integer to text." (check_success+ "lux i64 char" (list subjectC) Text)) - (_.property "Can convert integer to fraction." + (_.test "Can convert integer to fraction." (check_success+ "lux i64 f64" (list subjectC) Frac)) ))) @@ -125,31 +125,31 @@ paramC (|> r.safe_frac (at ! each code.frac)) encodedC (|> r.safe_frac (at ! each (|>> %.frac code.text)))] (all _.and - (_.property "Can add frac numbers." + (_.test "Can add frac numbers." (check_success+ "lux f64 +" (list paramC subjectC) Frac)) - (_.property "Can subtract frac numbers." + (_.test "Can subtract frac numbers." (check_success+ "lux f64 -" (list paramC subjectC) Frac)) - (_.property "Can multiply frac numbers." + (_.test "Can multiply frac numbers." (check_success+ "lux f64 *" (list paramC subjectC) Frac)) - (_.property "Can divide frac numbers." + (_.test "Can divide frac numbers." (check_success+ "lux f64 /" (list paramC subjectC) Frac)) - (_.property "Can calculate remainder of frac numbers." + (_.test "Can calculate remainder of frac numbers." (check_success+ "lux f64 %" (list paramC subjectC) Frac)) - (_.property "Can test equivalence of frac numbers." + (_.test "Can test equivalence of frac numbers." (check_success+ "lux f64 =" (list paramC subjectC) Bit)) - (_.property "Can compare frac numbers." + (_.test "Can compare frac numbers." (check_success+ "lux f64 <" (list paramC subjectC) Bit)) - (_.property "Can obtain minimum frac number." + (_.test "Can obtain minimum frac number." (check_success+ "lux f64 min" (list) Frac)) - (_.property "Can obtain maximum frac number." + (_.test "Can obtain maximum frac number." (check_success+ "lux f64 max" (list) Frac)) - (_.property "Can obtain smallest frac number." + (_.test "Can obtain smallest frac number." (check_success+ "lux f64 smallest" (list) Frac)) - (_.property "Can convert frac number to integer." + (_.test "Can convert frac number to integer." (check_success+ "lux f64 i64" (list subjectC) Int)) - (_.property "Can convert frac number to text." + (_.test "Can convert frac number to text." (check_success+ "lux f64 encode" (list subjectC) Text)) - (_.property "Can convert text to frac number." + (_.test "Can convert text to frac number." (check_success+ "lux f64 decode" (list encodedC) (type_literal (Maybe Frac)))) ))) @@ -162,19 +162,19 @@ fromC (|> r.nat (at ! each code.nat)) toC (|> r.nat (at ! each code.nat))] (all _.and - (_.property "Can test text equivalence." + (_.test "Can test text equivalence." (check_success+ "lux text =" (list paramC subjectC) Bit)) - (_.property "Compare texts in lexicographical order." + (_.test "Compare texts in lexicographical order." (check_success+ "lux text <" (list paramC subjectC) Bit)) - (_.property "Can concatenate one text to another." + (_.test "Can concatenate one text to another." (check_success+ "lux text concat" (list subjectC paramC) Text)) - (_.property "Can find the index of a piece of text inside a larger one that (may) contain it." + (_.test "Can find the index of a piece of text inside a larger one that (may) contain it." (check_success+ "lux text index" (list fromC paramC subjectC) (type_literal (Maybe Nat)))) - (_.property "Can query the size/length of a text." + (_.test "Can query the size/length of a text." (check_success+ "lux text size" (list subjectC) Nat)) - (_.property "Can obtain the character code of a text at a given index." + (_.test "Can obtain the character code of a text at a given index." (check_success+ "lux text char" (list fromC subjectC) Nat)) - (_.property "Can clip a piece of text between 2 indices." + (_.test "Can clip a piece of text between 2 indices." (check_success+ "lux text clip" (list fromC toC subjectC) Text)) ))) @@ -184,9 +184,9 @@ [logC (|> (r.unicode 5) (at ! each code.text)) exitC (|> r.int (at ! each code.int))] (all _.and - (_.property "Can log messages to standard output." + (_.test "Can log messages to standard output." (check_success+ "lux io log" (list logC) Any)) - (_.property "Can throw a run-time error." + (_.test "Can throw a run-time error." (check_success+ "lux io error" (list logC) Nothing)) ))) diff --git a/stdlib/source/test/lux/meta/compiler/language/lux/phase/synthesis/primitive.lux b/stdlib/source/test/lux/meta/compiler/language/lux/phase/synthesis/primitive.lux index 07414ac90..62d7d5db2 100644 --- a/stdlib/source/test/lux/meta/compiler/language/lux/phase/synthesis/primitive.lux +++ b/stdlib/source/test/lux/meta/compiler/language/lux/phase/synthesis/primitive.lux @@ -78,7 +78,7 @@ (,, (with_template [<analysis> <synthesis> <generator>] [(do r.monad [expected <generator>] - (_.property (%.symbol (symbol <synthesis>)) + (_.test (%.symbol (symbol <synthesis>)) (|> {////analysis.#Primitive {<analysis> expected}} (//.phase archive.empty) (phase.result [///bundle.empty ////synthesis.init]) diff --git a/stdlib/source/test/lux/meta/compiler/language/lux/phase/synthesis/structure.lux b/stdlib/source/test/lux/meta/compiler/language/lux/phase/synthesis/structure.lux index d17044f40..8da9fae17 100644 --- a/stdlib/source/test/lux/meta/compiler/language/lux/phase/synthesis/structure.lux +++ b/stdlib/source/test/lux/meta/compiler/language/lux/phase/synthesis/structure.lux @@ -44,7 +44,7 @@ (-- tagA) tagA)] memberA //primitive.primitive] - (_.property "Can synthesize variants." + (_.test "Can synthesize variants." (|> (////analysis.variant [lefts right? memberA]) (//.phase archive.empty) (phase.result [///bundle.empty ////synthesis.init]) @@ -63,7 +63,7 @@ (do [! r.monad] [size (|> r.nat (at ! each (|>> (n.% 10) (n.max 2)))) membersA (r.list size //primitive.primitive)] - (_.property "Can synthesize tuple." + (_.test "Can synthesize tuple." (|> (////analysis.tuple membersA) (//.phase archive.empty) (phase.result [///bundle.empty ////synthesis.init]) diff --git a/stdlib/source/test/lux/meta/compiler/language/lux/syntax.lux b/stdlib/source/test/lux/meta/compiler/language/lux/syntax.lux index a87bcbd66..fa6f6fade 100644 --- a/stdlib/source/test/lux/meta/compiler/language/lux/syntax.lux +++ b/stdlib/source/test/lux/meta/compiler/language/lux/syntax.lux @@ -75,7 +75,7 @@ (do [! r.monad] [sample code^] (all _.and - (_.property "Can parse Lux code." + (_.test "Can parse Lux code." (case (let [source_code (%.code sample)] (/.parse "" (dictionary.empty text.hash) (text.size source_code) [location.dummy 0 source_code])) @@ -86,7 +86,7 @@ (at code.equivalence = parsed sample))) (do ! [other code^] - (_.property "Can parse multiple Lux code nodes." + (_.test "Can parse multiple Lux code nodes." (let [source_code (format (%.code sample) " " (%.code other)) source_code//size (text.size source_code)] (case (/.parse "" (dictionary.empty text.hash) source_code//size @@ -124,7 +124,7 @@ [sample code^ comment comment^] (all _.and - (_.property "Can handle comments." + (_.test "Can handle comments." (case (let [source_code (format comment (%.code sample)) source_code//size (text.size source_code)] (/.parse "" (dictionary.empty text.hash) source_code//size diff --git a/stdlib/source/test/lux/meta/compiler/meta/cache.lux b/stdlib/source/test/lux/meta/compiler/meta/cache.lux index 68ba4e7fb..e52d9f4c2 100644 --- a/stdlib/source/test/lux/meta/compiler/meta/cache.lux +++ b/stdlib/source/test/lux/meta/compiler/meta/cache.lux @@ -1,7 +1,6 @@ (.require [library [lux (.except) - ["_" test (.only Test)] [abstract [monad (.only do)]] [control @@ -11,7 +10,9 @@ [math ["[0]" random]] [world - ["[0]" file]]]] + ["[0]" file]] + ["_" test (.only Test) + ["[0]" unit]]]] [\\library ["[0]" /]] ["[0]" / @@ -36,7 +37,7 @@ outcome (/.enable! ! fs context) post/0 (at fs directory? (/.path fs context)) post/1 (/.enabled? fs context)] - (_.coverage' [/.path /.enabled? /.enable!] + (unit.coverage [/.path /.enabled? /.enable!] (and (not pre/0) (not pre/1) diff --git a/stdlib/source/test/lux/meta/compiler/meta/cache/archive.lux b/stdlib/source/test/lux/meta/compiler/meta/cache/archive.lux index 09821245e..09263a7d3 100644 --- a/stdlib/source/test/lux/meta/compiler/meta/cache/archive.lux +++ b/stdlib/source/test/lux/meta/compiler/meta/cache/archive.lux @@ -1,7 +1,6 @@ (.require [library [lux (.except) - ["_" test (.only Test)] [abstract [monad (.only do)]] [control @@ -17,7 +16,9 @@ [number ["n" nat]]] [world - ["[0]" file]]]] + ["[0]" file]] + ["_" test (.only Test) + ["[0]" unit]]]] [\\library ["[0]" / (.only) ["/[1]" // (.only) @@ -72,7 +73,7 @@ cached? (/.cache! fs context archive) actual (at fs read (/.descriptor fs context)) post/0 (at fs file? (/.descriptor fs context))] - (_.coverage' [/.descriptor /.cache!] + (unit.coverage [/.descriptor /.cache!] (and (not pre/0) (|> (do try.monad [_ enabled? diff --git a/stdlib/source/test/lux/meta/compiler/meta/cache/artifact.lux b/stdlib/source/test/lux/meta/compiler/meta/cache/artifact.lux index 7d3fa626d..aff81fd7e 100644 --- a/stdlib/source/test/lux/meta/compiler/meta/cache/artifact.lux +++ b/stdlib/source/test/lux/meta/compiler/meta/cache/artifact.lux @@ -1,7 +1,6 @@ (.require [library [lux (.except) - ["_" test (.only Test)] [abstract [monad (.only do)]] [control @@ -16,7 +15,9 @@ [number ["n" nat]]] [world - ["[0]" file]]]] + ["[0]" file]] + ["_" test (.only Test) + ["[0]" unit]]]] [\\library ["[0]" / (.only) ["/[1]" // @@ -41,7 +42,7 @@ write! (/.cache! fs context @module @artifact expected) post (at fs file? (/.path fs context @module @artifact)) read! (/.cache fs context @module @artifact)] - (_.coverage' [/.path /.cache! /.cache] + (unit.coverage [/.path /.cache! /.cache] (and (not pre) (case write! {try.#Success _} true diff --git a/stdlib/source/test/lux/meta/compiler/meta/cache/module.lux b/stdlib/source/test/lux/meta/compiler/meta/cache/module.lux index bce9082e5..bf12dcc3a 100644 --- a/stdlib/source/test/lux/meta/compiler/meta/cache/module.lux +++ b/stdlib/source/test/lux/meta/compiler/meta/cache/module.lux @@ -1,7 +1,6 @@ (.require [library [lux (.except) - ["_" test (.only Test)] [abstract [monad (.only do)]] [control @@ -12,7 +11,9 @@ [math ["[0]" random]] [world - ["[0]" file]]]] + ["[0]" file]] + ["_" test (.only Test) + ["[0]" unit]]]] [\\library ["[0]" /]] ["$[0]" /// @@ -60,7 +61,7 @@ outcome (/.enable! ! fs context @module) post/0 (at fs directory? (/.path fs context @module)) post/1 (/.enabled? fs context @module)] - (_.coverage' [/.path /.enabled? /.enable!] + (unit.coverage [/.path /.enabled? /.enable!] (and (not pre/0) (not pre/1) @@ -78,7 +79,7 @@ outcome (/.enable! ! (..bad fs) context @module) post/0 (at fs directory? (/.path fs context @module)) post/1 (/.enabled? fs context @module)] - (_.coverage' [/.cannot_enable] + (unit.coverage [/.cannot_enable] (and (not pre/0) (not pre/1) diff --git a/stdlib/source/test/lux/meta/compiler/meta/cache/purge.lux b/stdlib/source/test/lux/meta/compiler/meta/cache/purge.lux index c5bc1dfb5..cf0b520f2 100644 --- a/stdlib/source/test/lux/meta/compiler/meta/cache/purge.lux +++ b/stdlib/source/test/lux/meta/compiler/meta/cache/purge.lux @@ -1,7 +1,6 @@ (.require [library [lux (.except) - ["_" test (.only Test)] [abstract [monad (.only do)]] [control @@ -23,7 +22,9 @@ [number ["n" nat]]] [world - ["[0]" file]]]] + ["[0]" file]] + ["_" test (.only Test) + ["[0]" unit]]]] [\\library ["[0]" / (.only) ["/[1]" // @@ -124,7 +125,7 @@ pre (at fs directory_files dir) _ (/.purge! fs context id/0) post (at fs directory_files dir)] - (_.coverage' [/.purge!] + (unit.coverage [/.purge!] (<| (try.else false) (do try.monad [pre pre] diff --git a/stdlib/source/test/lux/meta/compiler/meta/export.lux b/stdlib/source/test/lux/meta/compiler/meta/export.lux index d9fb14ace..e1dd299b0 100644 --- a/stdlib/source/test/lux/meta/compiler/meta/export.lux +++ b/stdlib/source/test/lux/meta/compiler/meta/export.lux @@ -1,7 +1,6 @@ (.require [library [lux (.except) - ["_" test (.only Test)] [abstract [monad (.only do)]] [control @@ -27,7 +26,9 @@ [number ["n" nat]]] [world - ["[0]" file]]]] + ["[0]" file]] + ["_" test (.only Test) + ["[0]" unit]]]] [\\library ["[0]" / (.only) [// @@ -73,8 +74,8 @@ export_tar (at fs read (format target / /.file)) export_tar (at ! in (<binary>.result tar.parser export_tar))] (in [library_tar export_tar]))] - (all _.and' - (_.coverage' [/.library /.mode /.ownership] + (all unit.and + (unit.coverage [/.library /.mode /.ownership] (|> it (try#each (|>> product.left sequence.list @@ -97,7 +98,7 @@ _ false))) (try.else false))) - (_.coverage' [/.export /.file] + (unit.coverage [/.export /.file] (|> it (try#each (|>> product.right sequence.list diff --git a/stdlib/source/test/lux/meta/compiler/meta/import.lux b/stdlib/source/test/lux/meta/compiler/meta/import.lux index fc2e79616..30ba445cd 100644 --- a/stdlib/source/test/lux/meta/compiler/meta/import.lux +++ b/stdlib/source/test/lux/meta/compiler/meta/import.lux @@ -1,7 +1,6 @@ (.require [library [lux (.except) - ["_" test (.only Test)] [abstract [monad (.only do)]] [control @@ -30,7 +29,9 @@ [number ["n" nat]]] [world - ["[0]" file]]]] + ["[0]" file]] + ["_" test (.only Test) + ["[0]" unit]]]] [\\library ["[0]" / (.only) [// @@ -118,7 +119,7 @@ _ (at fs write library/0 library_content/0) _ (at fs write library/1 library_content/1)] (/.import fs (list library/0 library/1)))] - (_.coverage' [/.import] + (unit.coverage [/.import] (and (|> it/0 (try#each imported?) (try.else false)) @@ -131,7 +132,7 @@ _ (at fs write library/0 library_content) _ (/.import fs (list library/0 library/0))] (in false))] - (_.coverage' [/.duplicate] + (unit.coverage [/.duplicate] (exception.otherwise (exception.match? /.duplicate) it)))) (in (do [! async.monad] [it/0 (do (try.with !) @@ -149,7 +150,7 @@ _ (at fs write library/0 library_content/-2) _ (/.import fs (list library/0))] (in false))] - (_.coverage' [/.useless_tar_entry] + (unit.coverage [/.useless_tar_entry] (and (exception.otherwise (exception.match? /.useless_tar_entry) it/0) (exception.otherwise (exception.match? /.useless_tar_entry) it/1) (exception.otherwise (exception.match? /.useless_tar_entry) it/2))))) diff --git a/stdlib/source/test/lux/meta/macro/context.lux b/stdlib/source/test/lux/meta/macro/context.lux index 52df97710..865d6abe8 100644 --- a/stdlib/source/test/lux/meta/macro/context.lux +++ b/stdlib/source/test/lux/meta/macro/context.lux @@ -8,5 +8,5 @@ (def .public test Test (<| (_.covering /._) - (_.property "TBD" false) + (_.test "TBD" false) )) diff --git a/stdlib/source/test/lux/meta/static.lux b/stdlib/source/test/lux/meta/static.lux index aa67ab7a2..0a0d784a9 100644 --- a/stdlib/source/test/lux/meta/static.lux +++ b/stdlib/source/test/lux/meta/static.lux @@ -23,7 +23,7 @@ (def .public test Test (<| (_.covering /._) - (for @.old (_.property "PLACEHOLDER" true)) + (for @.old (_.test "PLACEHOLDER" true)) (_.for [meta.eval]) (`` (all _.and (,, (with_template [<static> <random> <=> <+> <tag>] diff --git a/stdlib/source/test/lux/meta/symbol.lux b/stdlib/source/test/lux/meta/symbol.lux index 6972cd346..1c54441cc 100644 --- a/stdlib/source/test/lux/meta/symbol.lux +++ b/stdlib/source/test/lux/meta/symbol.lux @@ -50,7 +50,7 @@ ($order.spec /.order (..random sizeM1 sizeS1))) (_.for [/.codec] (_.and ($codec.spec /.equivalence /.codec (..random sizeM1 sizeS1)) - (_.property "Encoding a symbol without a module component results in text equal to the short of the symbol." + (_.test "Encoding a symbol without a module component results in text equal to the short of the symbol." (if (text.empty? module1) (same? short1 (at /.codec encoded symbol1)) true)))) @@ -66,7 +66,7 @@ (_.for [.symbol] (let [(open "/#[0]") /.equivalence] (all _.and - (_.property "Can obtain Symbol from a symbol." + (_.test "Can obtain Symbol from a symbol." (and (/#= [.prelude "yolo"] (.symbol .yolo)) (/#= ["test/lux/meta/symbol" "yolo"] (.symbol ..yolo)) (/#= ["" "yolo"] (.symbol yolo)) diff --git a/stdlib/source/test/lux/meta/target/jvm.lux b/stdlib/source/test/lux/meta/target/jvm.lux index 28fff6e38..b3758f810 100644 --- a/stdlib/source/test/lux/meta/target/jvm.lux +++ b/stdlib/source/test/lux/meta/target/jvm.lux @@ -912,7 +912,7 @@ try.trusted (binary.result /class.format)) loader (/loader.memory (/loader.new_library []))]] - (_.property "PUTSTATIC & PUTFIELD & GETFIELD & GETSTATIC" + (_.test "PUTSTATIC & PUTFIELD & GETFIELD & GETSTATIC" (case (do try.monad [_ (/loader.define class_name bytecode loader) class (io.run! (/loader.load class_name loader)) @@ -1732,7 +1732,7 @@ try.trusted (binary.result /class.format)) loader (/loader.memory (/loader.new_library []))]] - (_.property "Class & interface inheritance" + (_.test "Class & interface inheritance" (case (do try.monad [_ (/loader.define abstract_class abstract_bytecode loader) _ (/loader.define interface_class interface_bytecode loader) diff --git a/stdlib/source/test/lux/meta/type/resource.lux b/stdlib/source/test/lux/meta/type/resource.lux index 65618e66a..0935d0c2e 100644 --- a/stdlib/source/test/lux/meta/type/resource.lux +++ b/stdlib/source/test/lux/meta/type/resource.lux @@ -1,7 +1,6 @@ (.require [library [lux (.except) - ["_" test (.only Test)] [abstract ["[0]" monad (.only) [indexed (.only do)]]] @@ -22,7 +21,9 @@ ["<[1]>" \\parser]] [macro [syntax (.only syntax)] - ["[0]" expansion]]]]] + ["[0]" expansion]]] + ["_" test (.only Test) + ["[0]" unit]]]] [\\library ["[0]" / (.only Res)]]) @@ -126,7 +127,7 @@ (do (/.monad !) <bindings> (in (format left right))))] - (_.coverage' <coverage> + (unit.coverage <coverage> (text#= (format pre post) outcome))))] diff --git a/stdlib/source/test/lux/test.lux b/stdlib/source/test/lux/test.lux index 3e47848dc..956969668 100644 --- a/stdlib/source/test/lux/test.lux +++ b/stdlib/source/test/lux/test.lux @@ -20,16 +20,17 @@ [number ["n" nat]]]]] [\\library - ["[0]" /]]) + ["[0]" / (.only) + ["[0]" unit]]]) (def (verify expected_message/0 expected_message/1 successes failures [tally message]) - (-> Text Text Nat Nat [/.Tally Text] Bit) + (-> Text Text Nat Nat [unit.Tally Text] Bit) (and (text.contains? expected_message/0 message) (text.contains? expected_message/1 message) - (n.= successes (the /.#successes tally)) - (n.= failures (the /.#failures tally)))) + (n.= successes (the unit.#successes tally)) + (n.= failures (the unit.#failures tally)))) -(def assertion +(def unit_test /.Test (do [! random.monad] [expected_message/0 (random.lower_case 5) @@ -37,25 +38,25 @@ (random.lower_case 5))] (all /.and (in (do async.monad - [[success_tally success_message] (/.assertion expected_message/0 true) - [failure_tally failure_message] (/.assertion expected_message/0 false)] - (/.coverage' [/.assertion /.Tally] + [[success_tally success_message] (unit.test expected_message/0 true) + [failure_tally failure_message] (unit.test expected_message/0 false)] + (unit.coverage [unit.test unit.Tally] (and (text.ends_with? expected_message/0 success_message) (text.ends_with? expected_message/0 failure_message) - (and (n.= 1 (the /.#successes success_tally)) - (n.= 0 (the /.#failures success_tally))) - (and (n.= 0 (the /.#successes failure_tally)) - (n.= 1 (the /.#failures failure_tally))))))) + (and (n.= 1 (the unit.#successes success_tally)) + (n.= 0 (the unit.#failures success_tally))) + (and (n.= 0 (the unit.#successes failure_tally)) + (n.= 1 (the unit.#failures failure_tally))))))) (in (do async.monad - [tt (/.and' (/.assertion expected_message/0 true) - (/.assertion expected_message/1 true)) - ff (/.and' (/.assertion expected_message/0 false) - (/.assertion expected_message/1 false)) - tf (/.and' (/.assertion expected_message/0 true) - (/.assertion expected_message/1 false)) - ft (/.and' (/.assertion expected_message/0 false) - (/.assertion expected_message/1 true))] - (/.coverage' [/.and'] + [tt (unit.and (unit.test expected_message/0 true) + (unit.test expected_message/1 true)) + ff (unit.and (unit.test expected_message/0 false) + (unit.test expected_message/1 false)) + tf (unit.and (unit.test expected_message/0 true) + (unit.test expected_message/1 false)) + ft (unit.and (unit.test expected_message/0 false) + (unit.test expected_message/1 true))] + (unit.coverage [unit.and] (and (..verify expected_message/0 expected_message/1 2 0 tt) (..verify expected_message/0 expected_message/1 0 2 ff) (..verify expected_message/0 expected_message/1 1 1 tf) @@ -72,49 +73,49 @@ (do ! [sample random.nat .let [wrote? (io.run! (write sample))]] - (/.property "" wrote?))) + (/.test "" wrote?))) post (<| (/.seed seed) (do ! [actual random.nat] (in (do async.monad [expected read] - (/.assertion "" (n.= expected actual))))))] + (unit.test "" (n.= expected actual))))))] (in (do async.monad [[pre_tally pre_message] pre [post_tally post_message] post] - (/.coverage' [/.seed] - (and (and (n.= 1 (the /.#successes pre_tally)) - (n.= 0 (the /.#failures pre_tally))) - (and (n.= 1 (the /.#successes post_tally)) - (n.= 0 (the /.#failures post_tally))))))))) + (unit.coverage [/.seed] + (and (and (n.= 1 (the unit.#successes pre_tally)) + (n.= 0 (the unit.#failures pre_tally))) + (and (n.= 1 (the unit.#successes post_tally)) + (n.= 0 (the unit.#failures post_tally))))))))) (def times /.Test (all /.and (do [! random.monad] - [times_assertion (/.times 0 (/.property "" true))] + [times_unit_test (/.times 0 (/.test "" true))] (in (do async.monad - [[tally error] times_assertion] - (/.coverage' [/.must_try_test_at_least_once] + [[tally error] times_unit_test] + (unit.coverage [/.must_try_test_at_least_once] (and (text.contains? (the exception.#label /.must_try_test_at_least_once) error) - (n.= 0 (the /.#successes tally)) - (n.= 1 (the /.#failures tally))))))) + (n.= 0 (the unit.#successes tally)) + (n.= 1 (the unit.#failures tally))))))) (do [! random.monad] [expected (at ! each (|>> (n.% 10) ++) random.nat) .let [counter (is (Atom Nat) (atom.atom 0))] - times_assertion (<| (/.times expected) + times_unit_test (<| (/.times expected) (do ! [_ (in []) .let [_ (io.run! (atom.update! ++ counter))]] - (/.property "" true)))] + (/.test "" true)))] (in (do async.monad - [[tally error] times_assertion + [[tally error] times_unit_test actual (async.future (atom.read! counter))] - (/.coverage' [/.times] + (unit.coverage [/.times] (and (n.= expected actual) - (n.= 1 (the /.#successes tally)) - (n.= 0 (the /.#failures tally))))))) + (n.= 1 (the unit.#successes tally)) + (n.= 0 (the unit.#failures tally))))))) )) (def in_parallel @@ -124,40 +125,40 @@ [expected (at ! each (|>> (n.% 10) ++) random.nat) .let [counter (is (Atom Nat) (atom.atom 0))] - assertion (<| /.in_parallel + unit_test (<| /.in_parallel (list.repeated expected) (is /.Test) (do ! [_ (in []) .let [_ (io.run! (atom.update! ++ counter))]] - (/.property "" true)))] + (/.test "" true)))] (in (do async.monad - [[tally error] assertion + [[tally error] unit_test actual (async.future (atom.read! counter))] - (/.coverage' [/.in_parallel] + (unit.coverage [/.in_parallel] (and (n.= expected actual) - (n.= expected (the /.#successes tally)) - (n.= 0 (the /.#failures tally))))))) + (n.= expected (the unit.#successes tally)) + (n.= 0 (the unit.#failures tally))))))) (do [! random.monad] [expected (at ! each (|>> (n.% 10) ++) random.nat) .let [counter (is (Atom Nat) (atom.atom 0))] - assertion (<| /.in_parallel + unit_test (<| /.in_parallel (list.repeated expected) (is /.Test) (do ! [_ (in []) .let [_ (undefined) _ (io.run! (atom.update! ++ counter))]] - (/.property "" true)))] + (/.test "" true)))] (in (do async.monad - [[tally error] assertion + [[tally error] unit_test actual (async.future (atom.read! counter))] - (/.coverage' [/.error_during_execution] + (unit.coverage [/.error_during_execution] (let [correct_error! (text.contains? (the exception.#label /.error_during_execution) error) no_complete_run! (n.= 0 actual) - no_successes! (n.= 0 (the /.#successes tally)) - ran_all_tests! (n.= expected (the /.#failures tally))] + no_successes! (n.= 0 (the unit.#successes tally)) + ran_all_tests! (n.= expected (the unit.#failures tally))] (and correct_error! no_complete_run! no_successes! @@ -171,49 +172,49 @@ /.Test (all /.and (do random.monad - [not_covering (/.property "" true) - covering (/.covering .._ (/.property "" true))] + [not_covering (/.test "" true) + covering (/.covering .._ (/.test "" true))] (in (do async.monad [[not_covering _] not_covering [covering _] covering] - (/.coverage' [/.covering] - (and (and (set.empty? (the /.#expected not_covering)) - (set.empty? (the /.#actual not_covering))) - (and (not (set.empty? (the /.#expected covering))) - (set.empty? (the /.#actual covering)))))))) + (unit.coverage [/.covering] + (and (and (set.empty? (the unit.#expected not_covering)) + (set.empty? (the unit.#actual not_covering))) + (and (not (set.empty? (the unit.#expected covering))) + (set.empty? (the unit.#actual covering)))))))) (do random.monad - [not_covering (/.covering .._ (/.property "" true)) + [not_covering (/.covering .._ (/.test "" true)) covering (/.covering .._ (/.coverage [..dummy_target] true))] (in (do async.monad [[not_covering _] not_covering [covering _] covering] - (/.coverage' [/.coverage] - (and (and (not (set.empty? (the /.#expected not_covering))) - (not (set.member? (the /.#actual not_covering) (symbol ..dummy_target)))) - (and (not (set.empty? (the /.#expected covering))) - (set.member? (the /.#actual covering) (symbol ..dummy_target)))))))) + (unit.coverage [/.coverage] + (and (and (not (set.empty? (the unit.#expected not_covering))) + (not (set.member? (the unit.#actual not_covering) (symbol ..dummy_target)))) + (and (not (set.empty? (the unit.#expected covering))) + (set.member? (the unit.#actual covering) (symbol ..dummy_target)))))))) (do random.monad - [not_covering (/.covering .._ (/.property "" true)) - covering (/.covering .._ (in (/.coverage' [..dummy_target] true)))] + [not_covering (/.covering .._ (/.test "" true)) + covering (/.covering .._ (in (unit.coverage [..dummy_target] true)))] (in (do async.monad [[not_covering _] not_covering [covering _] covering] - (/.coverage' [/.coverage'] - (and (and (not (set.empty? (the /.#expected not_covering))) - (not (set.member? (the /.#actual not_covering) (symbol ..dummy_target)))) - (and (not (set.empty? (the /.#expected covering))) - (set.member? (the /.#actual covering) (symbol ..dummy_target)))))))) + (unit.coverage [unit.coverage] + (and (and (not (set.empty? (the unit.#expected not_covering))) + (not (set.member? (the unit.#actual not_covering) (symbol ..dummy_target)))) + (and (not (set.empty? (the unit.#expected covering))) + (set.member? (the unit.#actual covering) (symbol ..dummy_target)))))))) (do random.monad - [not_covering (/.covering .._ (/.property "" true)) - covering (/.covering .._ (/.for [..dummy_target] (/.property "" true)))] + [not_covering (/.covering .._ (/.test "" true)) + covering (/.covering .._ (/.for [..dummy_target] (/.test "" true)))] (in (do async.monad [[not_covering _] not_covering [covering _] covering] - (/.coverage' [/.for] - (and (and (not (set.empty? (the /.#expected not_covering))) - (not (set.member? (the /.#actual not_covering) (symbol ..dummy_target)))) - (and (not (set.empty? (the /.#expected covering))) - (set.member? (the /.#actual covering) (symbol ..dummy_target)))))))) + (unit.coverage [/.for] + (and (and (not (set.empty? (the unit.#expected not_covering))) + (not (set.member? (the unit.#actual not_covering) (symbol ..dummy_target)))) + (and (not (set.empty? (the unit.#expected covering))) + (set.member? (the unit.#actual covering) (symbol ..dummy_target)))))))) )) (def .public test @@ -227,78 +228,78 @@ expected_message/1 (random.only (|>> (text#= expected_message/0) not) (random.lower_case 5))] (all /.and - (/.for [/.Assertion] - ..assertion) + (/.for [unit.Test] + ..unit_test) (/.for [/.Seed] seed) (do ! - [success_assertion (/.property expected_message/0 true) - failure_assertion (/.property expected_message/0 false)] + [success_unit_test (/.test expected_message/0 true) + failure_unit_test (/.test expected_message/0 false)] (in (do async.monad - [[success_tally success_message] success_assertion - [failure_tally failure_message] failure_assertion] - (/.coverage' [/.property] + [[success_tally success_message] success_unit_test + [failure_tally failure_message] failure_unit_test] + (unit.coverage [/.test] (and (text.ends_with? (%.text expected_message/0) success_message) (text.ends_with? (%.text expected_message/0) failure_message) - (and (n.= 1 (the /.#successes success_tally)) - (n.= 0 (the /.#failures success_tally))) - (and (n.= 0 (the /.#successes failure_tally)) - (n.= 1 (the /.#failures failure_tally)))))))) + (and (n.= 1 (the unit.#successes success_tally)) + (n.= 0 (the unit.#failures success_tally))) + (and (n.= 0 (the unit.#successes failure_tally)) + (n.= 1 (the unit.#failures failure_tally)))))))) (do ! - [tt (/.and (/.property expected_message/0 true) - (/.property expected_message/1 true)) - ff (/.and (/.property expected_message/0 false) - (/.property expected_message/1 false)) - tf (/.and (/.property expected_message/0 true) - (/.property expected_message/1 false)) - ft (/.and (/.property expected_message/0 false) - (/.property expected_message/1 true))] + [tt (/.and (/.test expected_message/0 true) + (/.test expected_message/1 true)) + ff (/.and (/.test expected_message/0 false) + (/.test expected_message/1 false)) + tf (/.and (/.test expected_message/0 true) + (/.test expected_message/1 false)) + ft (/.and (/.test expected_message/0 false) + (/.test expected_message/1 true))] (in (do async.monad [tt tt ff ff tf tf ft ft] - (/.coverage' [/.and] + (unit.coverage [/.and] (and (..verify expected_message/0 expected_message/1 2 0 tt) (..verify expected_message/0 expected_message/1 0 2 ff) (..verify expected_message/0 expected_message/1 1 1 tf) (..verify expected_message/0 expected_message/1 1 1 ft)))))) (do ! - [success_assertion (/.context expected_context (/.property expected_message/0 true)) - failure_assertion (/.context expected_context (/.property expected_message/0 false))] + [success_unit_test (/.context expected_context (/.test expected_message/0 true)) + failure_unit_test (/.context expected_context (/.test expected_message/0 false))] (in (do async.monad - [[success_tally success_message] success_assertion - [failure_tally failure_message] failure_assertion] - (/.coverage' [/.context] + [[success_tally success_message] success_unit_test + [failure_tally failure_message] failure_unit_test] + (unit.coverage [/.context] (and (and (text.contains? expected_context success_message) (text.contains? expected_message/0 success_message)) (and (text.contains? expected_context failure_message) (text.contains? expected_message/0 failure_message)) - (and (n.= 1 (the /.#successes success_tally)) - (n.= 0 (the /.#failures success_tally))) - (and (n.= 0 (the /.#successes failure_tally)) - (n.= 1 (the /.#failures failure_tally)))))))) + (and (n.= 1 (the unit.#successes success_tally)) + (n.= 0 (the unit.#failures success_tally))) + (and (n.= 0 (the unit.#successes failure_tally)) + (n.= 1 (the unit.#failures failure_tally)))))))) (do ! - [failure_assertion (/.failure expected_message/0)] + [failure_unit_test (/.failure expected_message/0)] (in (do async.monad - [[failure_tally failure_message] failure_assertion] - (/.coverage' [/.failure] + [[failure_tally failure_message] failure_unit_test] + (unit.coverage [/.failure] (and (text.contains? expected_message/0 failure_message) - (and (n.= 0 (the /.#successes failure_tally)) - (n.= 1 (the /.#failures failure_tally)))))))) + (and (n.= 0 (the unit.#successes failure_tally)) + (n.= 1 (the unit.#failures failure_tally)))))))) (do ! - [success_assertion (/.lifted expected_message/0 (in true)) - failure_assertion (/.lifted expected_message/0 (in false))] + [success_unit_test (/.lifted expected_message/0 (in true)) + failure_unit_test (/.lifted expected_message/0 (in false))] (in (do async.monad - [[success_tally success_message] success_assertion - [failure_tally failure_message] failure_assertion] - (/.coverage' [/.lifted] + [[success_tally success_message] success_unit_test + [failure_tally failure_message] failure_unit_test] + (unit.coverage [/.lifted] (and (text.contains? expected_message/0 success_message) (text.contains? expected_message/0 failure_message) - (and (n.= 1 (the /.#successes success_tally)) - (n.= 0 (the /.#failures success_tally))) - (and (n.= 0 (the /.#successes failure_tally)) - (n.= 1 (the /.#failures failure_tally)))))))) + (and (n.= 1 (the unit.#successes success_tally)) + (n.= 0 (the unit.#failures success_tally))) + (and (n.= 0 (the unit.#successes failure_tally)) + (n.= 1 (the unit.#failures failure_tally)))))))) ..times ..in_parallel ..coverage diff --git a/stdlib/source/test/lux/world/file.lux b/stdlib/source/test/lux/world/file.lux index faebedb1f..ff12cb791 100644 --- a/stdlib/source/test/lux/world/file.lux +++ b/stdlib/source/test/lux/world/file.lux @@ -1,7 +1,6 @@ (.require [library [lux (.except) - ["_" test (.only Test)] [abstract ["[0]" monad (.only do)]] [control @@ -24,7 +23,9 @@ ["^" pattern]]] [world [time - ["[0]" instant (.only Instant)]]]]] + ["[0]" instant (.only Instant)]]] + ["_" test (.only Test) + ["[0]" unit]]]] ["[0]" / ["[1][0]" watch]] [\\library @@ -255,7 +256,7 @@ (in (do async.monad [.let [fs (/.mock /)] ? (at fs delete file)] - (_.coverage' [/.cannot_delete] + (unit.coverage [/.cannot_delete] (case ? {try.#Failure error} (exception.match? /.cannot_delete error) @@ -265,7 +266,7 @@ (in (do async.monad [.let [fs (/.mock /)] ? (at fs read file)] - (_.coverage' [/.cannot_find_file] + (unit.coverage [/.cannot_find_file] (case ? {try.#Failure error} (exception.match? /.cannot_find_file error) @@ -276,7 +277,7 @@ [.let [fs (/.mock /)] ?/0 (at fs directory_files file) ?/1 (at fs sub_directories file)] - (_.coverage' [/.cannot_find_directory] + (unit.coverage [/.cannot_find_directory] (case [?/0 ?/1] [{try.#Failure error/0} {try.#Failure error/1}] (and (exception.match? /.cannot_find_directory error/0) diff --git a/stdlib/source/test/lux/world/file/watch.lux b/stdlib/source/test/lux/world/file/watch.lux index 9977934a0..a56fce833 100644 --- a/stdlib/source/test/lux/world/file/watch.lux +++ b/stdlib/source/test/lux/world/file/watch.lux @@ -1,7 +1,6 @@ (.require [library [lux (.except) - ["_" test (.only Test)] [abstract [monad (.only do)]] [control @@ -18,7 +17,9 @@ [collection ["[0]" list]]] [math - ["[0]" random (.only Random) (.use "[1]#[0]" monad)]]]] + ["[0]" random (.only Random) (.use "[1]#[0]" monad)]] + ["_" test (.only Test) + ["[0]" unit]]]] [\\library ["[0]" / (.only) ["/[1]" //]]] @@ -74,7 +75,7 @@ (in (do async.monad [?concern (at watcher concern directory) ?stop (at watcher stop directory)] - (_.coverage' [/.not_being_watched] + (unit.coverage [/.not_being_watched] (and (case ?concern {try.#Failure error} (exception.match? /.not_being_watched error) @@ -182,7 +183,7 @@ after_creation! after_modification! after_deletion!)))] - (_.coverage' [/.mock /.polling] + (unit.coverage [/.mock /.polling] (try.else false verdict))))) (do random.monad [directory (random.alphabetic 5) @@ -190,7 +191,7 @@ [fs watcher] (/.mock /)]] (in (do async.monad [started? (at watcher start /.all directory)] - (_.coverage' [/.cannot_poll_a_non_existent_directory] + (unit.coverage [/.cannot_poll_a_non_existent_directory] (case started? {try.#Success _} false diff --git a/stdlib/source/test/lux/world/net/http/client.lux b/stdlib/source/test/lux/world/net/http/client.lux index bd73d7e87..fcba904f9 100644 --- a/stdlib/source/test/lux/world/net/http/client.lux +++ b/stdlib/source/test/lux/world/net/http/client.lux @@ -1,7 +1,6 @@ (.require [library [lux (.except) - ["_" test (.only Test)] [abstract [monad (.only Monad do)]] [control @@ -23,7 +22,9 @@ [math ["[0]" random (.only Random)] [number - ["[0]" nat]]]]] + ["[0]" nat]]] + ["_" test (.only Test) + ["[0]" unit]]]] [\\library ["[0]" / (.only) ["/[1]" // (.only) @@ -119,7 +120,7 @@ (verification ! <expected>))] <cases>))] - (_.coverage' [/.async] + (unit.coverage [/.async] (and (,, (with_template [<definition> <expected>] [<expected>] diff --git a/stdlib/source/test/lux/world/shell.lux b/stdlib/source/test/lux/world/shell.lux index 09126a8a3..0e3b16ce9 100644 --- a/stdlib/source/test/lux/world/shell.lux +++ b/stdlib/source/test/lux/world/shell.lux @@ -1,7 +1,6 @@ (.require [library [lux (.except) - ["_" test (.only Test)] [abstract [monad (.only do)]] [control @@ -18,7 +17,9 @@ ["[0]" random] [number ["n" nat] - ["i" int]]]]] + ["i" int]]] + ["_" test (.only Test) + ["[0]" unit]]]] [\\library ["[0]" / (.only) [// @@ -123,6 +124,6 @@ wrote! destroyed! (i.= exit await))))] - (_.coverage' [/.Shell] + (unit.coverage [/.Shell] (try.else false verdict))))) ))) |