aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/test/lux/world/net/http/status.lux
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--stdlib/source/test/lux/world/net/http/status.lux119
1 files changed, 119 insertions, 0 deletions
diff --git a/stdlib/source/test/lux/world/net/http/status.lux b/stdlib/source/test/lux/world/net/http/status.lux
new file mode 100644
index 000000000..801dc1b43
--- /dev/null
+++ b/stdlib/source/test/lux/world/net/http/status.lux
@@ -0,0 +1,119 @@
+(.module:
+ [lux #*
+ ["_" test (#+ Test)]
+ [data
+ [collection
+ ["." list]
+ ["." set (#+ Set)]]]
+ [macro
+ ["." template]]
+ [math
+ [number
+ ["n" nat]]]]
+ {1
+ ["." /
+ ["/#" //]]})
+
+(with_expansions [<categories> (as_is [informational
+ [/.continue
+ /.switching_protocols
+ /.processing
+ /.early_hints]]
+ [success
+ [/.ok
+ /.created
+ /.accepted
+ /.non_authoritative_information
+ /.no_content
+ /.reset_content
+ /.partial_content
+ /.multi_status
+ /.already_reported
+ /.im_used]]
+ [redirection
+ [/.multiple_choices
+ /.moved_permanently
+ /.found
+ /.see_other
+ /.not_modified
+ /.use_proxy
+ /.switch_proxy
+ /.temporary_redirect
+ /.permanent_redirect]]
+ [client
+ [/.bad_request
+ /.unauthorized
+ /.payment_required
+ /.forbidden
+ /.not_found
+ /.method_not_allowed
+ /.not_acceptable
+ /.proxy_authentication_required
+ /.request_timeout
+ /.conflict
+ /.gone
+ /.length_required
+ /.precondition_failed
+ /.payload_too_large
+ /.uri_too_long
+ /.unsupported_media_type
+ /.range_not_satisfiable
+ /.expectation_failed
+ /.im_a_teapot
+ /.misdirected_request
+ /.unprocessable_entity
+ /.locked
+ /.failed_dependency
+ /.upgrade_required
+ /.precondition_required
+ /.too_many_requests
+ /.request_header_fields_too_large
+ /.unavailable_for_legal_reasons]]
+ [server
+ [/.internal_server_error
+ /.not_implemented
+ /.bad_gateway
+ /.service_unavailable
+ /.gateway_timeout
+ /.http_version_not_supported
+ /.variant_also_negotiates
+ /.insufficient_storage
+ /.loop_detected
+ /.not_extended
+ /.network_authentication_required]])]
+ (def: all
+ (List //.Status)
+ (list.concat (`` (list (~~ (template [<category> <status+>]
+ [((: (-> Any (List //.Status))
+ (function (_ _)
+ (`` (list (~~ (template.splice <status+>))))))
+ 123)]
+
+ <categories>))))))
+
+ (def: unique
+ (Set //.Status)
+ (set.from_list n.hash ..all))
+
+ (def: verdict
+ (n.= (list.size ..all)
+ (set.size ..unique)))
+
+ (template [<category> <status+>]
+ [(def: <category>
+ Test
+ (_.cover <status+>
+ ..verdict))]
+
+ <categories>)
+
+ (def: #export test
+ Test
+ (<| (_.covering /._)
+ (`` ($_ _.and
+ (~~ (template [<category> <status+>]
+ [<category>]
+
+ <categories>))
+ ))))
+ )