aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/test
diff options
context:
space:
mode:
authorEduardo Julian2022-10-22 02:49:30 -0400
committerEduardo Julian2022-10-22 02:49:30 -0400
commitb25eec45fa9aabdc252d59afad3e0c7e73a18fd9 (patch)
tree98683e23f5a49d972d3550281bc4584218b7f9a6 /stdlib/source/test
parent74e8954ee269aa5dea39f1e4e3c55e8d387384a8 (diff)
Clean-up after format change for extensions [part 3]
Diffstat (limited to '')
-rw-r--r--stdlib/source/test/lux/meta/compiler/language/lux/phase/extension.lux30
-rw-r--r--stdlib/source/test/lux/world/net.lux6
-rw-r--r--stdlib/source/test/lux/world/net/uri/scheme.lux163
-rw-r--r--stdlib/source/test/lux/world/time.lux25
4 files changed, 187 insertions, 37 deletions
diff --git a/stdlib/source/test/lux/meta/compiler/language/lux/phase/extension.lux b/stdlib/source/test/lux/meta/compiler/language/lux/phase/extension.lux
index c9953642d..755487cce 100644
--- a/stdlib/source/test/lux/meta/compiler/language/lux/phase/extension.lux
+++ b/stdlib/source/test/lux/meta/compiler/language/lux/phase/extension.lux
@@ -183,36 +183,6 @@
(phase.result [/.#bundle /.empty
/.#state state])
(try.else false)))
- (_.coverage [/.incorrect_arity]
- (let [handler (is (/.Handler Int Nat Nat)
- (function (_ @self phase archive inputs)
- (phase.except /.incorrect_arity [@self 2 (list.size inputs)])))]
- (|> (do phase.monad
- [_ (/.install extender extension handler)]
- (/.apply archive.empty phase [extension (list)]))
- (phase.result [/.#bundle /.empty
- /.#state state])
- (pipe.when
- {try.#Failure error}
- (exception.match? /.incorrect_arity error)
-
- _
- false))))
- (_.coverage [/.invalid_syntax]
- (let [handler (is (/.Handler Int Nat Nat)
- (function (_ @self phase archive inputs)
- (phase.except /.invalid_syntax [@self %.nat inputs])))]
- (|> (do phase.monad
- [_ (/.install extender extension handler)]
- (/.apply archive.empty phase [extension (list left right)]))
- (phase.result [/.#bundle /.empty
- /.#state state])
- (pipe.when
- {try.#Failure error}
- (exception.match? /.invalid_syntax error)
-
- _
- false))))
(_.for [/.Name]
..test|name)
))
diff --git a/stdlib/source/test/lux/world/net.lux b/stdlib/source/test/lux/world/net.lux
index 29427d6c3..f0c4acb39 100644
--- a/stdlib/source/test/lux/world/net.lux
+++ b/stdlib/source/test/lux/world/net.lux
@@ -13,7 +13,9 @@
["[1][0]" http
["[1]/[0]" client]
["[1]/[0]" status]
- ["[1]/[0]" version]]])
+ ["[1]/[0]" version]]
+ ["[1][0]" uri
+ ["[1]/[0]" scheme]]])
(def .public test
Test
@@ -33,4 +35,6 @@
/http/client.test
/http/status.test
/http/version.test
+
+ /uri/scheme.test
)))
diff --git a/stdlib/source/test/lux/world/net/uri/scheme.lux b/stdlib/source/test/lux/world/net/uri/scheme.lux
new file mode 100644
index 000000000..c91c49fbf
--- /dev/null
+++ b/stdlib/source/test/lux/world/net/uri/scheme.lux
@@ -0,0 +1,163 @@
+(.require
+ [library
+ [lux (.except)
+ [abstract
+ [monad (.only do)]
+ [\\specification
+ ["$[0]" equivalence]
+ ["$[0]" hash]]]
+ [data
+ [collection
+ ["[0]" list]
+ ["[0]" set]]]
+ [math
+ ["[0]" random (.only Random) (.use "[1]#[0]" monad)]
+ [number
+ ["n" nat]]]
+ [test
+ ["_" property (.only Test)]]]]
+ [\\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 /.secure_hypertext_transfer_protocol]
+
+ [/.imap /.internet_message_access_protocol]
+ [/.ipp /.internet_printing_protocol]
+ [/.ipps /.secure_internet_printing_protocol]
+ [/.irc /.internet_relay_chat]
+ [/.ircs /.secure_internet_relay_chat]
+
+ [/.ldap /.lightweight_directory_access_protocol]
+ [/.ldaps /.secure_lightweight_directory_access_protocol]
+
+ [/.pop /.post_office_protocol]
+
+ [/.sip /.session_initiation_protocol]
+ [/.sips /.secure_session_initiation_protocol]
+ [/.sms /.short_message_service]
+ [/.snmp /.simple_network_management_protocol]
+ [/.ssh /.secure_shell_protocol]
+
+ [/.stun /.session_traversal_utilities_for_nat]
+ [/.stuns /.secure_session_traversal_utilities_for_nat]
+
+ [/.turn /.traversal_using_relays_around_nat]
+ [/.turns /.secure_traversal_using_relays_around_nat]
+
+ [/.xmpp /.extensible_messaging_and_presence_protocol]))
+ ))))
diff --git a/stdlib/source/test/lux/world/time.lux b/stdlib/source/test/lux/world/time.lux
index 68e6e478c..d6ee9b953 100644
--- a/stdlib/source/test/lux/world/time.lux
+++ b/stdlib/source/test/lux/world/time.lux
@@ -50,12 +50,25 @@
Test
(do [! random.monad]
[expected random.time]
- (_.coverage [/.clock /.time]
- (|> expected
- /.clock
- /.time
- (try#each (at /.equivalence = expected))
- (try.else false)))))
+ (all _.and
+ (_.coverage [/.clock /.time]
+ (|> expected
+ /.clock
+ /.time
+ (try#each (at /.equivalence = expected))
+ (try.else false)))
+ (let [expected (/.clock expected)]
+ (`` (all _.and
+ (,, (with_template [<limit> <slot>]
+ [(_.coverage [<slot>]
+ (n.< <limit> (the <slot> expected)))]
+
+ [0024 /.#hour]
+ [0060 /.#minute]
+ [0060 /.#second]
+ [1000 /.#milli_second]
+ )))))
+ )))
(def for_ranges
Test