diff options
author | Eduardo Julian | 2022-11-19 21:23:04 -0400 |
---|---|---|
committer | Eduardo Julian | 2022-11-19 21:23:04 -0400 |
commit | d4c72c03c1a47fe388ec36e973db17cb95dfdcfb (patch) | |
tree | aef020e7b5f351cc0fd20e0656edc6a9f853bc62 /stdlib | |
parent | 6aa4fac0c97264a2b1186063c062ae0873582f54 (diff) |
Got the tests to compile again for Python.
Diffstat (limited to '')
-rw-r--r-- | stdlib/source/library/lux.lux | 11 | ||||
-rw-r--r-- | stdlib/source/library/lux/ffi/export.py.lux | 37 | ||||
-rw-r--r-- | stdlib/source/library/lux/meta.lux | 77 | ||||
-rw-r--r-- | stdlib/source/library/lux/meta/extension.lux | 97 | ||||
-rw-r--r-- | stdlib/source/library/lux/test/coverage.lux | 5 | ||||
-rw-r--r-- | stdlib/source/test/lux/meta/extension.lux | 27 | ||||
-rw-r--r-- | stdlib/source/test/lux/meta/type/primitive.lux | 2 | ||||
-rw-r--r-- | stdlib/source/test/lux/world/net/mime.lux | 204 | ||||
-rw-r--r-- | stdlib/source/test/lux/world/net/uri/port.lux | 201 | ||||
-rw-r--r-- | stdlib/source/test/lux/world/net/uri/scheme.lux | 243 |
10 files changed, 469 insertions, 435 deletions
diff --git a/stdlib/source/library/lux.lux b/stdlib/source/library/lux.lux index 710521e74..54daff3b3 100644 --- a/stdlib/source/library/lux.lux +++ b/stdlib/source/library/lux.lux @@ -5661,16 +5661,7 @@ imports) =module (` (.module# (, =imports)))] g!_ (..generated_symbol "")] - (in {#Item =module - (for "Python" - ... TODO: Remove this hack once Jython is no longer being used as the Python interpreter. - ... Without it, I get this strange error - ... {library/lux/tool/compiler/language/lux/generation.no_buffer_for_saving_code} - ... Artifact ID: 0 - ... Which only ever happens for the Python compiler. - (list#partial (` (.def# (, g!_) [] #0)) - =refers) - =refers)}))))) + (in {#Item =module =refers}))))) (type .public Immediate_UnQuote (Primitive "#Macro/Immediate_UnQuote")) diff --git a/stdlib/source/library/lux/ffi/export.py.lux b/stdlib/source/library/lux/ffi/export.py.lux index 6e69e2a51..d46e632aa 100644 --- a/stdlib/source/library/lux/ffi/export.py.lux +++ b/stdlib/source/library/lux/ffi/export.py.lux @@ -11,11 +11,8 @@ [collection ["[0]" list (.use "[1]#[0]" monad mix)] ["[0]" set]]] - [math - ["[0]" random]] ["[0]" meta (.only) [extension (.only declaration)] - ["[0]" static] ["[0]" code (.only) ["<[1]>" \\parser]] [macro @@ -47,19 +44,19 @@ <code>.any))) meta.lifted)) -(with_expansions [<extension> (static.random (|>> %.nat (%.format "python export ") code.text) - random.nat)] - (declaration (<extension> self phase archive [name <code>.text - term <code>.any]) +(def .public export_one + (declaration (_ phase archive [name <code>.text + term <code>.any]) (do [! phase.monad] [next declaration.analysis [_ term] (<| declaration.lifted_analysis type.inferring (next archive term)) + lux (declaration.lifted_analysis meta.compiler_state) next declaration.synthesis term (declaration.lifted_synthesis - (next archive term)) + (next lux archive term)) dependencies (declaration.lifted_translation (dependency.dependencies archive term)) @@ -67,7 +64,7 @@ next declaration.translation [interim_artifacts term] (declaration.lifted_translation (translation.with_interim_artifacts archive - (next archive term))) + (next lux archive term))) _ (declaration.lifted_translation (do ! @@ -76,15 +73,15 @@ _ (translation.execute! code) _ (translation.save! @self {.#None} code)] (translation.log! (%.format "Export " (%.text name)))))] - (in declaration.no_requirements))) + (in declaration.no_requirements)))) - (def .public export - (syntax (_ [exports (<>.many <code>.any)]) - (let [! meta.monad] - (|> exports - (monad.each ! expansion.complete) - (at ! each (|>> list#conjoint - (monad.each ! ..definition))) - (at ! conjoint) - (at ! each (list#each (function (_ [name term]) - (` (<extension> (, (code.text name)) (, term))))))))))) +(def .public export + (syntax (_ [exports (<>.many <code>.any)]) + (let [! meta.monad] + (|> exports + (monad.each ! expansion.complete) + (at ! each (|>> list#conjoint + (monad.each ! ..definition))) + (at ! conjoint) + (at ! each (list#each (function (_ [name term]) + (` (..export_one (, (code.text name)) (, term)))))))))) diff --git a/stdlib/source/library/lux/meta.lux b/stdlib/source/library/lux/meta.lux index 21a2db376..57476530a 100644 --- a/stdlib/source/library/lux/meta.lux +++ b/stdlib/source/library/lux/meta.lux @@ -499,35 +499,54 @@ (-> Text (Meta (List [Text [Bit Definition]]))) (do [! ..monad] [it (..globals module) - .let [it (list.all (function (_ [name [exported? global]]) - (when global - {.#Alias de_aliased} - {.#Some [name exported? {.#Left de_aliased}]} - - {.#Definition definition} - {.#Some [name exported? {.#Right definition}]} - - {.#Default _} - {.#None})) - it)]] - (monad.each ! (function (again [name [exported? it]]) - (when it - {.#Left de_aliased} - (do ! - [[_ definition] (..definition de_aliased)] - (when definition - {.#Alias de_aliased} - (again [name [exported? {.#Left de_aliased}]]) - - {.#Definition definition} - (in [name [exported? definition]]) - - {.#Default _} - (undefined))) - - {.#Right definition} - (in [name [exported? definition]]))) - it))) + .let [input (is (List [Text Bit (Either Symbol Definition)]) + (list.all (function (_ [name [exported? global]]) + (when global + {.#Alias de_aliased} + {.#Some [name exported? {.#Left de_aliased}]} + + {.#Definition definition} + {.#Some [name exported? {.#Right definition}]} + + {.#Default _} + {.#None})) + it))]] + (function (_ lux) + (loop (next [input input + output (is (List [Text [Bit Definition]]) + (list))]) + (when input + (list) + {try.#Success [lux output]} + + (list.partial [name exported? it] input) + (let [real_definition (is (Try Definition) + (loop (again [it it]) + (when it + {.#Left de_aliased} + (when (..definition de_aliased lux) + {try.#Success [_ [_ definition]]} + (when definition + {.#Alias de_aliased} + (again {.#Left de_aliased}) + + {.#Definition definition} + {try.#Success definition} + + {.#Default _} + {try.#Failure "Cannot de-alias a default global."}) + + {try.#Failure error} + {try.#Failure error}) + + {.#Right definition} + {try.#Success definition})))] + (when real_definition + {try.#Success it} + (next input (list.partial [name [exported? it]] output)) + + {try.#Failure error} + {try.#Failure error}))))))) (def .public (exports module_name) (-> Text (Meta (List [Text Definition]))) diff --git a/stdlib/source/library/lux/meta/extension.lux b/stdlib/source/library/lux/meta/extension.lux index 4169598cd..9d43881f1 100644 --- a/stdlib/source/library/lux/meta/extension.lux +++ b/stdlib/source/library/lux/meta/extension.lux @@ -1,45 +1,58 @@ -(.require - [library - [lux (.except) - [abstract - ["[0]" monad]] - [control - ["<>" parser (.use "[1]#[0]" monad)]] - [data - ["[0]" product] - [collection - ["[0]" list (.use "[1]#[0]" functor)]]] - [meta - ["@" target (.only) - [jvm - ["_" bytecode (.only Bytecode)]]] - ["[0]" code (.only) - ["<c>" \\parser (.only Parser)]] - [macro (.only with_symbols) - [syntax (.only syntax)] - ["[0]" template]] - [compiler - ["[0]" phase] - [language - [lux - ["[0]" analysis (.only) - ["<a>" \\parser]] - ["[0]" synthesis (.only) - ["<s>" \\parser]] - ["[0]" translation] - ["[0]" declaration] - [phase - [translation - ["[0]" jvm - ["[1]" runtime]] - ["[0]" js - ["[1]" runtime]] - ["[0]" lua - ["[1]" runtime]] - ["[0]" python - ["[1]" runtime]] - ["[0]" ruby - ["[1]" runtime]]]]]]]]]]) +(.`` (.`` (.require + [library + [lux (.except) + [abstract + ["[0]" monad]] + [control + ["<>" parser (.use "[1]#[0]" monad)]] + [data + ["[0]" product] + [collection + ["[0]" list (.use "[1]#[0]" functor)]]] + [meta + ["@" target (.only) + (.,, (.for "JVM" + [jvm + ["_" bytecode (.only Bytecode)]] + + ... else + [/]))] + ["[0]" code (.only) + ["<c>" \\parser (.only Parser)]] + [macro (.only with_symbols) + [syntax (.only syntax)] + ["[0]" template]] + [compiler + ["[0]" phase] + [language + [lux + ["[0]" analysis (.only) + ["<a>" \\parser]] + ["[0]" synthesis (.only) + ["<s>" \\parser]] + ["[0]" translation] + ["[0]" declaration] + [phase + [translation + (.,, (.for "JVM" + ["[0]" jvm + ["[1]" runtime]] + + "JavaScript" + ["[0]" js + ["[1]" runtime]] + + "Lua" + ["[0]" lua + ["[1]" runtime]] + + "Python" + ["[0]" python + ["[1]" runtime]] + + "Ruby" + ["[0]" ruby + ["[1]" runtime]]))]]]]]]]]))) (with_template [<any> <end> <and> <result> <name> <extension_type> <handler_type>] [(def .public <name> diff --git a/stdlib/source/library/lux/test/coverage.lux b/stdlib/source/library/lux/test/coverage.lux index 86b1314cc..e717d27ed 100644 --- a/stdlib/source/library/lux/test/coverage.lux +++ b/stdlib/source/library/lux/test/coverage.lux @@ -42,5 +42,6 @@ (-> Text Text Coverage) (|> encoding (text.all_split_by ..separator) - (list#each (|>> [module])) - (set.of_list symbol.hash))) + (list#mix (function (_ short it) + (set.has [module short] it)) + (set.empty symbol.hash)))) diff --git a/stdlib/source/test/lux/meta/extension.lux b/stdlib/source/test/lux/meta/extension.lux index 1302a74fc..4391469e0 100644 --- a/stdlib/source/test/lux/meta/extension.lux +++ b/stdlib/source/test/lux/meta/extension.lux @@ -67,13 +67,6 @@ (these) (these - (for @.python - ... TODO: Remove this hack once Jython is no longer being used as the Python interpreter. - (analysis ("dummy dum dum" phase archive []) - (undefined)) - - (these)) - ... Analysis (def my_analysis Analysis @@ -101,7 +94,7 @@ (def my_translation|translation Translation (translation (_ phase archive [pass_through <synthesis>.any]) - (phase archive pass_through))) + (phase archive pass_through))) (def my_translation|synthesis Synthesis @@ -127,15 +120,15 @@ (def dummy_translation|translation Translation (translation (_ phase archive []) - (let [[_ self] (symbol ..dummy_translation)] - (at phase.monad in - (for @.jvm (jvm.string self) - @.js (js.string self) - @.python (python.unicode self) - @.lua (lua.string self) - @.ruby (ruby.string self) - @.php (php.string self) - @.scheme (scheme.string self)))))) + (let [[_ self] (symbol ..dummy_translation)] + (at phase.monad in + (for @.jvm (jvm.string self) + @.js (js.string self) + @.python (python.unicode self) + @.lua (lua.string self) + @.ruby (ruby.string self) + @.php (php.string self) + @.scheme (scheme.string self)))))) (def dummy_translation|synthesis Synthesis diff --git a/stdlib/source/test/lux/meta/type/primitive.lux b/stdlib/source/test/lux/meta/type/primitive.lux index 37284d46e..c0bf30297 100644 --- a/stdlib/source/test/lux/meta/type/primitive.lux +++ b/stdlib/source/test/lux/meta/type/primitive.lux @@ -8,7 +8,7 @@ ["[0]" exception]] [data ["[0]" text (.use "[1]#[0]" equivalence)]] - ["[0]" math (.only) + [math ["[0]" random] [number ["n" nat]]] diff --git a/stdlib/source/test/lux/world/net/mime.lux b/stdlib/source/test/lux/world/net/mime.lux index c1116ad5a..3b36e7ecd 100644 --- a/stdlib/source/test/lux/world/net/mime.lux +++ b/stdlib/source/test/lux/world/net/mime.lux @@ -22,89 +22,131 @@ [\\library ["[0]" /]]) -(with_expansions [<options> (these [/.aac] - [/.abiword] - [/.avi] - [/.amazon_kindle_ebook] - [/.binary] - [/.bitmap] - [/.bzip] - [/.bzip2] - [/.c_shell] - [/.css] - [/.csv] - [/.microsoft_word] - [/.microsoft_word_openxml] - [/.ms_embedded_opentype_fonts] - [/.epub] - [/.ecmascript] - [/.gif] - [/.html] - [/.icon] - [/.icalendar] - [/.jar] - [/.jpeg] - [/.javascript] - [/.json] - [/.midi] - [/.mpeg] - [/.apple_installer_package] - [/.opendocument_presentation] - [/.opendocument_spreadsheet] - [/.opendocument_text] - [/.ogg_audio] - [/.ogg_video] - [/.ogg] - [/.opentype_font] - [/.png] - [/.pdf] - [/.microsoft_powerpoint] - [/.microsoft_powerpoint_openxml] - [/.rar] - [/.rtf] - [/.bourne_shell] - [/.svg] - [/.flash] - [/.tar] - [/.tiff] - [/.typescript] - [/.truetype_font] - [/.microsoft_visio] - [/.wav] - [/.webm_audio] - [/.webm_video] - [/.webp] - [/.woff] - [/.woff2] - [/.xhtml] - [/.microsoft_excel] - [/.microsoft_excel_openxml] - [/.xml] - [/.xul] - [/.zip] +(with_expansions [<randoms> (with_template [<name> <options>] + [(def <name> + (Random /.MIME) + (`` (all random.either + (,, (with_template [<type>] + [(random#in <type>)] + + <options>)) + )))] - [/.audio_3gpp] - [/.video_3gpp] - [/.audio_3gpp2] - [/.video_3gpp2] - [/.compressed_7z] + [random/0 <options/0>] + [random/1 <options/1>] + [random/2 <options/2>] + [random/3 <options/3>] + ) + <coverages> (with_template [<options>] + [(`` (_.coverage [(,, (with_template [<type>] + [<type>] + + <options> + ))] + (let [uniques (set.of_list /.hash ..options)] + (n.= (list.size ..options) + (set.size uniques)))))] - [/.form] - [/.multi_part_form] + [<options/0>] + [<options/1>] + [<options/2>] + [<options/3>] + ) + <all_options> (with_template [<options>] + [(is (List /.MIME) + (let [options (is (-> Any (List /.MIME)) + (function (_ _) + (list <options>)))] + (options [])))] + + [<options/0>] + [<options/1>] + [<options/2>] + [<options/3>] + ) + <options/0> (these [/.aac] + [/.abiword] + [/.avi] + [/.amazon_kindle_ebook] + [/.binary] + [/.bitmap] + [/.bzip] + [/.bzip2] + [/.c_shell] + [/.css] + [/.csv] + [/.microsoft_word] + [/.microsoft_word_openxml] + [/.ms_embedded_opentype_fonts] + [/.epub] + [/.ecmascript] + [/.gif] + [/.html] + [/.icon] + [/.icalendar] + [/.jar] + [/.jpeg] + [/.javascript] + [/.json] + [/.midi] + [/.mpeg]) + <options/1> (these [/.apple_installer_package] + [/.opendocument_presentation] + [/.opendocument_spreadsheet] + [/.opendocument_text] + [/.ogg_audio] + [/.ogg_video] + [/.ogg] + [/.opentype_font] + [/.png] + [/.pdf] + [/.microsoft_powerpoint] + [/.microsoft_powerpoint_openxml] + [/.rar] + [/.rtf] + [/.bourne_shell] + [/.svg] + [/.flash]) + <options/2> (these [/.tar] + [/.tiff] + [/.typescript] + [/.truetype_font] + [/.microsoft_visio] + [/.wav] + [/.webm_audio] + [/.webm_video] + [/.webp] + [/.woff] + [/.woff2] + [/.xhtml] + [/.microsoft_excel] + [/.microsoft_excel_openxml] + [/.xml] + [/.xul] + [/.zip]) + <options/3> (these [/.audio_3gpp] + [/.video_3gpp] + [/.audio_3gpp2] + [/.video_3gpp2] + [/.compressed_7z] + + [/.form] + [/.multi_part_form] + + [/.utf_8])] + <randoms> - [/.utf_8]) - <types> (with_template [<type>] - [<type>] - - <options>)] (def .public random (Random /.MIME) - (`` (all random.either - (,, (with_template [<type>] - [(random#in <type>)] - - <options>)) - ))) + (all random.either + ..random/0 + ..random/1 + ..random/2 + )) + + (def options + (List /.MIME) + (list.together (list <all_options>))) (def .public test Test @@ -124,11 +166,7 @@ /.name /.mime (at /.equivalence = expected))) - (_.coverage [<types>] - (let [options (list <types>) - uniques (set.of_list /.hash options)] - (n.= (list.size options) - (set.size uniques)))) + <coverages> (_.coverage [/.text] (|> (/.text encoding) /.name diff --git a/stdlib/source/test/lux/world/net/uri/port.lux b/stdlib/source/test/lux/world/net/uri/port.lux index 73ee68337..ea56944b0 100644 --- a/stdlib/source/test/lux/world/net/uri/port.lux +++ b/stdlib/source/test/lux/world/net/uri/port.lux @@ -16,93 +16,124 @@ [\\library ["[0]" /]]) -(with_expansions [<options> (these [/.echo_protocol] - [/.discard_protocol] - [/.daytime_protocol] - [/.quote_of_the_day] - [/.message_send_protocol] - [/.character_generator_protocol] - [/.file_transfer_protocol_data_transfer] - [/.file_transfer_protocol_control] - [/.telnet] - [/.simple_mail_transfer_protocol] - [/.time_protocol] - [/.host_name_server_protocol] - [/.whois] - [/.domain_name_system] - [/.gopher] - [/.finger] - [/.hypertext_transfer_protocol] - [/.kerberos] - - [/.digital_imaging_and_communications_in_medicine] - [/.remote_user_telnet_service] - [/.post_office_protocol_2] - [/.post_office_protocol_3] - [/.open_network_computing_remote_procedure_call] - [/.simple_file_transfer_protocol] - [/.network_news_transfer_protocol] - [/.network_time_protocol] - [/.internet_message_access_protocol] - [/.simple_gateway_monitoring_protocol] - [/.structured_query_language] - [/.simple_network_management_protocol] - [/.simple_network_management_protocol_trap] - [/.secure_neighbor_discovery] - [/.x_display_manager_control_protocol] - [/.border_gateway_protocol] - [/.internet_relay_chat] - [/.snmp_unix_multiplexer] - - [/.border_gateway_multicast_protocol] - - [/.precision_time_protocol_event_messages] - [/.precision_time_protocol_general_messages] - [/.lightweight_directory_access_protocol] - - [/.uninterruptible_power_supply] - [/.service_location_protocol] - [/.hypertext_transfer_protocol_secure] - [/.simple_network_paging_protocol] - [/.kerberos_change/set_password] - - [/.remote_procedure_call] - [/.real_time_streaming_protocol] - [/.dynamic_host_configuration_protocol/6_client] - [/.dynamic_host_configuration_protocol/6_server] - [/.network_news_transfer_protocol_secure] - - [/.internet_printing_protocol] - [/.lightweight_directory_access_protocol_secure] - [/.multicast_source_discovery_protocol] - [/.label_distribution_protocol] - [/.application_configuration_access_protocol] - [/.optimized_link_state_routing_protocol] - - [/.extensible_provisioning_protocol] - [/.link_management_protocol] - [/.secure_internet_live_conferencing_protocol] - [/.kerberos_administration] - - [/.certificate_management_protocol] - [/.network_configuration_protocol/ssh] - [/.network_configuration_protocol/beep] - [/.network_configuration_protocol/soap/https] - [/.network_configuration_protocol/soap/beep] - - [/.file_transfer_protocol_secure_data_transfer] - [/.file_transfer_protocol_secure_control] - [/.telnet/tls] - [/.internet_message_access_protocol_secure] - [/.post_office_protocol_3_secure])] +(with_expansions [<all_options> (with_template [<>] + [(is (List /.Port) + (let [it (is (-> Any (List /.Port)) + (function (_ _) + (list <>)))] + (it [])))] + + [<options/0>] + [<options/1>] + [<options/2>] + [<options/3>] + ) + <coverages> (with_template [<options>] + [(_.coverage [(,, (with_template [<port>] + [<port>] + + <options> + ))] + (let [uniques (set.of_list nat.hash ..options)] + (nat.= (list.size ..options) + (set.size uniques))))] + + [<options/0>] + [<options/1>] + [<options/2>] + [<options/3>] + ) + <options/0> (these [/.echo_protocol] + [/.discard_protocol] + [/.daytime_protocol] + [/.quote_of_the_day] + [/.message_send_protocol] + [/.character_generator_protocol] + [/.file_transfer_protocol_data_transfer] + [/.file_transfer_protocol_control] + [/.telnet] + [/.simple_mail_transfer_protocol] + [/.time_protocol] + [/.host_name_server_protocol] + [/.whois] + [/.domain_name_system] + [/.gopher] + [/.finger] + [/.hypertext_transfer_protocol] + [/.kerberos]) + <options/1> (these [/.digital_imaging_and_communications_in_medicine] + [/.remote_user_telnet_service] + [/.post_office_protocol_2] + [/.post_office_protocol_3] + [/.open_network_computing_remote_procedure_call] + [/.simple_file_transfer_protocol] + [/.network_news_transfer_protocol] + [/.network_time_protocol] + [/.internet_message_access_protocol] + [/.simple_gateway_monitoring_protocol] + [/.structured_query_language] + [/.simple_network_management_protocol] + [/.simple_network_management_protocol_trap] + [/.secure_neighbor_discovery] + [/.x_display_manager_control_protocol] + [/.border_gateway_protocol] + [/.internet_relay_chat] + [/.snmp_unix_multiplexer]) + <options/2> (these [/.border_gateway_multicast_protocol] + + [/.precision_time_protocol_event_messages] + [/.precision_time_protocol_general_messages] + [/.lightweight_directory_access_protocol] + + [/.uninterruptible_power_supply] + [/.service_location_protocol] + [/.hypertext_transfer_protocol_secure] + [/.simple_network_paging_protocol] + [/.kerberos_change/set_password] + + [/.remote_procedure_call] + [/.real_time_streaming_protocol] + [/.dynamic_host_configuration_protocol/6_client] + [/.dynamic_host_configuration_protocol/6_server] + [/.network_news_transfer_protocol_secure]) + <options/3> (these [/.internet_printing_protocol] + [/.lightweight_directory_access_protocol_secure] + [/.multicast_source_discovery_protocol] + [/.label_distribution_protocol] + [/.application_configuration_access_protocol] + [/.optimized_link_state_routing_protocol] + + [/.extensible_provisioning_protocol] + [/.link_management_protocol] + [/.secure_internet_live_conferencing_protocol] + [/.kerberos_administration] + + [/.certificate_management_protocol] + [/.network_configuration_protocol/ssh] + [/.network_configuration_protocol/beep] + [/.network_configuration_protocol/soap/https] + [/.network_configuration_protocol/soap/beep] + + [/.file_transfer_protocol_secure_data_transfer] + [/.file_transfer_protocol_secure_control] + [/.telnet/tls] + [/.internet_message_access_protocol_secure] + [/.post_office_protocol_3_secure])] (def .public random (Random /.Port) (`` (all random.either (,, (with_template [<port>] [(random#in <port>)] - <options> + <options/0> + <options/1> + <options/2> + <options/3> ))))) + + (def options + (List /.Port) + (list.together (list <all_options>))) (def .public test Test @@ -111,15 +142,7 @@ []) (_.for [/.Port]) (`` (all _.and - (_.coverage [(,, (with_template [<port>] - [<port>] - - <options> - ))] - (let [options (list <options>) - uniques (set.of_list nat.hash options)] - (nat.= (list.size options) - (set.size uniques)))) + <coverages> (,, (with_template [<long> <short>] [(_.coverage [<short>] (same? <long> <short>))] diff --git a/stdlib/source/test/lux/world/net/uri/scheme.lux b/stdlib/source/test/lux/world/net/uri/scheme.lux index 868f2cddf..4a651646c 100644 --- a/stdlib/source/test/lux/world/net/uri/scheme.lux +++ b/stdlib/source/test/lux/world/net/uri/scheme.lux @@ -19,145 +19,104 @@ [\\library ["[0]" /]]) -(def .public random - (Random /.Scheme) - (all random.either - (random#in /.about) - (random#in /.acap) - (random#in /.user_account) - (random#in /.anonymous_customer_reference) - (random#in /.attachment) - - (random#in /.bitcoin) - (random#in /.blob) - - (random#in /.calendar_access_protocol) - - (random#in /.data) - (random#in /.dns) - (random#in /.dntp) - (random#in /.digital_object_identifier) - (random#in /.drm) - - (random#in /.feed) - (random#in /.file) - (random#in /.finger) - (random#in /.fish) - (random#in /.fm) - (random#in /.ftp) - - (random#in /.geo) - (random#in /.git) - - (random#in /.http) - (random#in /.https) - - (random#in /.imap) - (random#in /.ipp) - (random#in /.ipps) - (random#in /.irc) - (random#in /.irc6) - (random#in /.ircs) - - (random#in /.jar) - - (random#in /.ldap) - (random#in /.ldaps) - - (random#in /.magnet) - (random#in /.mail_to) - (random#in /.apache_maven) - - (random#in /.pop) - - (random#in /.sip) - (random#in /.sips) - (random#in /.sms) - (random#in /.snmp) - (random#in /.ssh) - (random#in /.stun) - (random#in /.stuns) - - (random#in /.telephone_number) - (random#in /.turn) - (random#in /.turns) - - (random#in /.xmpp) - )) - -(def .public test - Test - (<| (_.covering /._) - (do [! random.monad] - [expected ..random]) - (_.for [/.Scheme]) - (`` (all _.and - (_.for [/.equivalence] - ($equivalence.spec /.equivalence ..random)) - (_.for [/.hash] - ($hash.spec /.hash ..random)) - - (_.coverage [/.name /.scheme] - (|> expected - /.name - /.scheme - (at /.equivalence = expected))) - (with_expansions [<schemes> (these /.about /.acap /.user_account /.anonymous_customer_reference /.attachment - /.bitcoin /.blob - /.calendar_access_protocol - /.data /.dns /.dntp /.digital_object_identifier /.drm - /.feed /.file /.finger /.fish /.fm /.ftp - /.geo /.git - /.http /.https - /.imap /.ipp /.ipps /.irc /.irc6 /.ircs - /.jar - /.ldap /.ldaps - /.magnet /.mail_to /.apache_maven - /.pop - /.sip /.sips /.sms /.snmp /.ssh /.stun /.stuns - /.telephone_number /.turn /.turns - /.xmpp)] - (_.coverage [<schemes>] - (let [options (list <schemes>) - uniques (set.of_list /.hash options)] - (n.= (list.size options) - (set.size uniques))))) - (,, (with_template [<original> <alias>] - [(_.coverage [<alias>] - (at /.equivalence = <original> <alias>))] - - [/.acap /.application_configuration_access_protocol] - - [/.dns /.domain_name_system] - [/.dntp /.direct_network_transfer_protocol] - - [/.ftp /.file_transfer_protocol] - - [/.http /.hypertext_transfer_protocol] - [/.https /.hypertext_transfer_protocol_secure] - - [/.imap /.internet_message_access_protocol] - [/.ipp /.internet_printing_protocol] - [/.ipps /.internet_printing_protocol_secure] - [/.irc /.internet_relay_chat] - [/.ircs /.internet_relay_chat_secure] - - [/.ldap /.lightweight_directory_access_protocol] - [/.ldaps /.lightweight_directory_access_protocol_secure] - - [/.pop /.post_office_protocol] - - [/.sip /.session_initiation_protocol] - [/.sips /.session_initiation_protocol_secure] - [/.sms /.short_message_service] - [/.snmp /.simple_network_management_protocol] - [/.ssh /.secure_shell_protocol] - - [/.stun /.session_traversal_utilities_for_nat] - [/.stuns /.session_traversal_utilities_for_nat_secure] - - [/.turn /.traversal_using_relays_around_nat] - [/.turns /.traversal_using_relays_around_nat_secure] - - [/.xmpp /.extensible_messaging_and_presence_protocol])) - )))) +(with_expansions [<schemes/0> (these [/.about] [/.acap] [/.user_account] [/.anonymous_customer_reference] [/.attachment] + [/.bitcoin] [/.blob] + [/.calendar_access_protocol] + [/.data] [/.dns] [/.dntp] [/.digital_object_identifier] [/.drm] + [/.feed] [/.file] [/.finger] [/.fish] [/.fm] [/.ftp] + [/.geo] [/.git] + [/.http] [/.https]) + <schemes/1> (these [/.imap] [/.ipp] [/.ipps] [/.irc] [/.irc6] [/.ircs] + [/.jar] + [/.ldap] [/.ldaps] + [/.magnet] [/.mail_to] [/.apache_maven] + [/.pop] + [/.sip] [/.sips] [/.sms] [/.snmp] [/.ssh] [/.stun] [/.stuns] + [/.telephone_number] [/.turn] [/.turns] + [/.xmpp])] + (def .public random + (Random /.Scheme) + (`` (all random.either + (,, (with_template [<scheme>] + [(random#in <scheme>)] + + <schemes/0> + <schemes/1> + )) + ))) + + (def options + (List /.Scheme) + (list <schemes/0> + <schemes/1>)) + + (def .public test + Test + (<| (_.covering /._) + (do [! random.monad] + [expected ..random]) + (_.for [/.Scheme]) + (`` (all _.and + (_.for [/.equivalence] + ($equivalence.spec /.equivalence ..random)) + (_.for [/.hash] + ($hash.spec /.hash ..random)) + + (_.coverage [/.name /.scheme] + (|> expected + /.name + /.scheme + (at /.equivalence = expected))) + (_.coverage [(,, (with_template [<scheme>] + [<scheme>] + + <schemes/0>))] + (let [uniques (set.of_list /.hash ..options)] + (n.= (list.size ..options) + (set.size uniques)))) + (_.coverage [(,, (with_template [<scheme>] + [<scheme>] + + <schemes/1>))] + (let [uniques (set.of_list /.hash ..options)] + (n.= (list.size ..options) + (set.size uniques)))) + (,, (with_template [<original> <alias>] + [(_.coverage [<alias>] + (at /.equivalence = <original> <alias>))] + + [/.acap /.application_configuration_access_protocol] + + [/.dns /.domain_name_system] + [/.dntp /.direct_network_transfer_protocol] + + [/.ftp /.file_transfer_protocol] + + [/.http /.hypertext_transfer_protocol] + [/.https /.hypertext_transfer_protocol_secure] + + [/.imap /.internet_message_access_protocol] + [/.ipp /.internet_printing_protocol] + [/.ipps /.internet_printing_protocol_secure] + [/.irc /.internet_relay_chat] + [/.ircs /.internet_relay_chat_secure] + + [/.ldap /.lightweight_directory_access_protocol] + [/.ldaps /.lightweight_directory_access_protocol_secure] + + [/.pop /.post_office_protocol] + + [/.sip /.session_initiation_protocol] + [/.sips /.session_initiation_protocol_secure] + [/.sms /.short_message_service] + [/.snmp /.simple_network_management_protocol] + [/.ssh /.secure_shell_protocol] + + [/.stun /.session_traversal_utilities_for_nat] + [/.stuns /.session_traversal_utilities_for_nat_secure] + + [/.turn /.traversal_using_relays_around_nat] + [/.turns /.traversal_using_relays_around_nat_secure] + + [/.xmpp /.extensible_messaging_and_presence_protocol])) + ))))) |