From d656ef2143151a1d78768df4562e5275dff67b9d Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Tue, 15 Nov 2022 14:06:17 -0400 Subject: Added LineNumberTable annotations to functions when compiling for the JVM. --- stdlib/source/test/lux.lux | 11 ++++-- stdlib/source/test/lux/meta/extension.lux | 21 ++++++++--- stdlib/source/test/lux/world/net.lux | 21 +---------- stdlib/source/test/lux/world/net/http.lux | 45 +++++++++++++++++++++++ stdlib/source/test/lux/world/net/http/request.lux | 6 +-- stdlib/source/test/lux/world/net/http/server.lux | 26 ++++++------- 6 files changed, 86 insertions(+), 44 deletions(-) create mode 100644 stdlib/source/test/lux/world/net/http.lux (limited to 'stdlib/source/test') diff --git a/stdlib/source/test/lux.lux b/stdlib/source/test/lux.lux index d2af0e624..916f1dbc2 100644 --- a/stdlib/source/test/lux.lux +++ b/stdlib/source/test/lux.lux @@ -341,7 +341,8 @@ example_nat random.nat example_int random.int] (all _.and - (_.for [/.Code /.Code'] + (_.for [/.Code /.Code' + /.#Bit /.#Nat /.#Int /.#Rev /.#Frac /.#Text /.#Symbol /.#Form /.#Variant /.#Tuple] (all _.and ..for_code/' ..for_code/` @@ -1107,15 +1108,17 @@ (do meta.monad [prelude (meta.module .prelude)] (in (list (code.bit (when (the .#module_state prelude) - {.#Active} false - _ true))))))) + {/.#Active} false + {/.#Compiled} true + {/.#Cached} true))))))) (def for_meta Test (all _.and (_.coverage [/.Mode /.Info] (for_meta|Info)) - (_.coverage [/.Module_State] + (_.coverage [/.Module_State + /.#Active /.#Compiled /.#Cached] (for_meta|Module_State)) )) diff --git a/stdlib/source/test/lux/meta/extension.lux b/stdlib/source/test/lux/meta/extension.lux index ab58d17b3..e27b0282f 100644 --- a/stdlib/source/test/lux/meta/extension.lux +++ b/stdlib/source/test/lux/meta/extension.lux @@ -21,6 +21,7 @@ [number ["n" nat]]] ["[0]" meta (.only) + ["[0]" location] ["[0]" code ["<[1]>" \\parser]] ["@" target (.only) @@ -91,7 +92,10 @@ (let [! phase.monad] (|> parameters (monad.each ! (phase archive)) - (at ! each (|>> {analysis.#Extension (symbol ..my_synthesis|synthesis)})))))) + (at ! each (|>> (is (List analysis.Analysis)) + {analysis.#Extension (symbol ..my_synthesis|synthesis)} + [location.dummy] + (is analysis.Analysis))))))) ... Generation (def my_generation|generation @@ -105,7 +109,9 @@ (let [! phase.monad] (|> parameters (monad.each ! (phase archive)) - (at ! each (|>> {synthesis.#Extension (symbol ..my_generation|generation)})))))) + (at ! each (|>> {synthesis.#Extension (symbol ..my_generation|generation)} + [location.dummy] + (is synthesis.Synthesis))))))) (def my_generation Analysis @@ -113,7 +119,10 @@ (let [! phase.monad] (|> parameters (monad.each ! (phase archive)) - (at ! each (|>> {analysis.#Extension (symbol ..my_generation|synthesis)})))))) + (at ! each (|>> (is (List analysis.Analysis)) + {analysis.#Extension (symbol ..my_generation|synthesis)} + [location.dummy] + (is analysis.Analysis))))))) (def dummy_generation|generation Generation @@ -131,12 +140,14 @@ (def dummy_generation|synthesis Synthesis (synthesis (_ phase archive []) - (at phase.monad in {synthesis.#Extension (symbol ..dummy_generation|generation) (list)}))) + (at phase.monad in (is synthesis.Synthesis + [location.dummy {synthesis.#Extension (symbol ..dummy_generation|generation) (list)}])))) (def dummy_generation Analysis (analysis (_ phase archive []) - (at phase.monad in {analysis.#Extension (symbol ..dummy_generation|synthesis) (list)}))) + (at phase.monad in (is analysis.Analysis + [location.dummy {analysis.#Extension (symbol ..dummy_generation|synthesis) (list)}])))) ... Declaration (def my_declaration diff --git a/stdlib/source/test/lux/world/net.lux b/stdlib/source/test/lux/world/net.lux index 695308c40..ddcd8dcfd 100644 --- a/stdlib/source/test/lux/world/net.lux +++ b/stdlib/source/test/lux/world/net.lux @@ -12,15 +12,7 @@ ["[0]" / ["[1][0]" mime] ["[1][0]" uri] - ["[1][0]" http - ["[1]/[0]" client] - ["[1]/[0]" cookie] - ["[1]/[0]" header] - ["[1]/[0]" status] - ["[1]/[0]" version] - ["[1]/[0]" response] - ["[1]/[0]" request] - ["[1]/[0]" server]]]) + ["[1][0]" http]]) (def .public test Test @@ -36,15 +28,6 @@ true) /mime.test - - /http/client.test - /http/cookie.test - /http/header.test - /http/status.test - /http/version.test - /http/response.test - /http/request.test - /http/server.test - + /http.test /uri.test ))) diff --git a/stdlib/source/test/lux/world/net/http.lux b/stdlib/source/test/lux/world/net/http.lux new file mode 100644 index 000000000..457eb507e --- /dev/null +++ b/stdlib/source/test/lux/world/net/http.lux @@ -0,0 +1,45 @@ +(.require + [library + [lux (.except) + [abstract + [monad (.only do)]] + [math + ["[0]" random (.only Random)]] + [test + ["_" property (.only Test)]]]] + [\\library + ["[0]" /]] + ["[0]" / + ["[1][0]" client] + ["[1][0]" cookie] + ["[1][0]" header] + ["[1][0]" status] + ["[1][0]" version] + ["[1][0]" response] + ["[1][0]" request] + ["[1][0]" server]]) + +(def .public test + Test + (<| (_.covering /._) + (do [! random.monad] + []) + (all _.and + (_.coverage [/.Method + /.#Post /.#Get /.#Put /.#Patch /.#Delete /.#Head /.#Connect /.#Options /.#Trace] + true) + (_.coverage [/.Body] + true) + (_.coverage [/.Message + /.#headers /.#body] + true) + + /client.test + /cookie.test + /header.test + /status.test + /version.test + /response.test + /request.test + /server.test + ))) diff --git a/stdlib/source/test/lux/world/net/http/request.lux b/stdlib/source/test/lux/world/net/http/request.lux index 0d117920f..afc7e88ad 100644 --- a/stdlib/source/test/lux/world/net/http/request.lux +++ b/stdlib/source/test/lux/world/net/http/request.lux @@ -107,7 +107,7 @@ (let [it (is (/.Request Identity) ( (/.utf8 identity.monad expected_text)))] (and (|> it - (the [/.#protocol //.#scheme]) + (the [/.#protocol /.#scheme]) (scheme#= )) (|> it (the [/.#message //.#headers]) @@ -135,7 +135,7 @@ (let [it (is (/.Request Identity) ( (/.utf8 identity.monad expected_text)))] (and (|> it - (the [/.#resource //.#method]) + (the [/.#resource /.#method]) (|.when {} true @@ -174,7 +174,7 @@ (let [it (is (/.Request Identity) (/.uri expected_uri (/.utf8 identity.monad expected_text)))] (and (|> it - (the [/.#resource //.#uri]) + (the [/.#resource /.#uri]) (same? expected_uri)) (|> it (the [/.#message //.#headers]) diff --git a/stdlib/source/test/lux/world/net/http/server.lux b/stdlib/source/test/lux/world/net/http/server.lux index 63f0d76ed..92f57b953 100644 --- a/stdlib/source/test/lux/world/net/http/server.lux +++ b/stdlib/source/test/lux/world/net/http/server.lux @@ -58,14 +58,14 @@ )) (def identification - (Random //.Identification) + (Random request.Identification) (all random.and ..address ..address )) (def protocol - (Random //.Protocol) + (Random request.Protocol) (all random.and versionT.random schemeT.random @@ -86,7 +86,7 @@ )) (def resource - (Random //.Resource) + (Random request.Resource) (all random.and ..method (random.lower_cased 2) @@ -135,11 +135,11 @@ (`` (all _.and (,, (with_template [ ] [(in (do [! async.monad] - [good_response (let [expected_request (has [request.#protocol //.#scheme] expected_request)] + [good_response (let [expected_request (has [request.#protocol request.#scheme] expected_request)] ( expected_server ! expected_request)) good_body ((the [response.#message //.#body] good_response) {.#None}) - bad_response (let [expected_request (has [request.#protocol //.#scheme] scheme.file expected_request)] + bad_response (let [expected_request (has [request.#protocol request.#scheme] scheme.file expected_request)] ( expected_server ! expected_request))] (unit.coverage [] (and (n.= expected_status @@ -174,11 +174,11 @@ (`` (all _.and (,, (with_template [ ] [(in (do [! async.monad] - [good_response (let [expected_request (has [request.#resource //.#method] {} expected_request)] + [good_response (let [expected_request (has [request.#resource request.#method] {} expected_request)] ( expected_server ! expected_request)) good_body ((the [response.#message //.#body] good_response) {.#None}) - bad_response (let [expected_request (has [request.#resource //.#method] {} expected_request)] + bad_response (let [expected_request (has [request.#resource request.#method] {} expected_request)] ( expected_server ! expected_request))] (unit.coverage [] (and (n.= expected_status @@ -226,11 +226,11 @@ [bad_uri (random.upper_cased 2) good_uri (random.upper_cased 3)] (in (do [! async.monad] - [good_response (let [expected_request (has [request.#resource //.#uri] good_uri expected_request)] + [good_response (let [expected_request (has [request.#resource request.#uri] good_uri expected_request)] (/.uri good_uri expected_server ! expected_request)) good_body ((the [response.#message //.#body] good_response) {.#None}) - bad_response (let [expected_request (has [request.#resource //.#uri] bad_uri expected_request)] + bad_response (let [expected_request (has [request.#resource request.#uri] bad_uri expected_request)] (/.uri good_uri expected_server ! expected_request))] (unit.coverage [/.uri] (and (n.= expected_status @@ -250,13 +250,13 @@ [.let [server (is /.Server (/.or (/.http expected_server) (/.https expected_server)))] - http_response (server ! (has [request.#protocol //.#scheme] scheme.http expected_request)) + http_response (server ! (has [request.#protocol request.#scheme] scheme.http expected_request)) http_body ((the [response.#message //.#body] http_response) {.#None}) - https_response (server ! (has [request.#protocol //.#scheme] scheme.https expected_request)) + https_response (server ! (has [request.#protocol request.#scheme] scheme.https expected_request)) https_body ((the [response.#message //.#body] https_response) {.#None}) - bad_response (server ! (has [request.#protocol //.#scheme] scheme.file expected_request))] + bad_response (server ! (has [request.#protocol request.#scheme] scheme.file expected_request))] (unit.coverage [/.or] (let [correct_http_status! (n.= expected_status @@ -297,7 +297,7 @@ (in (do [! async.monad] [.let [server (is (/.Server Async) (/.static (response.content ! expected_status expected_mime expected_data)))] - response (server ! (has [request.#protocol //.#scheme] scheme.http expected_request)) + response (server ! (has [request.#protocol request.#scheme] scheme.http expected_request)) body ((the [response.#message //.#body] response) {.#None})] (unit.coverage [/.static] (and (n.= expected_status -- cgit v1.2.3