diff options
author | Eduardo Julian | 2020-12-11 22:40:31 -0400 |
---|---|---|
committer | Eduardo Julian | 2020-12-11 22:40:31 -0400 |
commit | dff517cbdb9a1c80028782c62ad91c71ddb34909 (patch) | |
tree | f69b4005e8b6dc9699a410554ce4571f60d9e0ee /stdlib/source/test/aedifex | |
parent | 9af671a34728b35c48bff2ba163c371dc5084946 (diff) |
Improved parsing speed for Lux code.
Diffstat (limited to 'stdlib/source/test/aedifex')
-rw-r--r-- | stdlib/source/test/aedifex/command/deploy.lux | 2 | ||||
-rw-r--r-- | stdlib/source/test/aedifex/command/pom.lux | 2 | ||||
-rw-r--r-- | stdlib/source/test/aedifex/dependency/resolution.lux | 30 | ||||
-rw-r--r-- | stdlib/source/test/aedifex/input.lux | 2 | ||||
-rw-r--r-- | stdlib/source/test/aedifex/metadata/artifact.lux | 69 |
5 files changed, 87 insertions, 18 deletions
diff --git a/stdlib/source/test/aedifex/command/deploy.lux b/stdlib/source/test/aedifex/command/deploy.lux index eafd1f968..ef08ba39e 100644 --- a/stdlib/source/test/aedifex/command/deploy.lux +++ b/stdlib/source/test/aedifex/command/deploy.lux @@ -123,7 +123,7 @@ deployed-pom! (\ binary.equivalence = - (|> expected-pom (\ xml.codec encode) encoding.to-utf8) + (|> expected-pom (\ xml.codec encode) (\ encoding.utf8 encode)) actual-pom) deployed-sha-1! diff --git a/stdlib/source/test/aedifex/command/pom.lux b/stdlib/source/test/aedifex/command/pom.lux index d63641e04..d179031ea 100644 --- a/stdlib/source/test/aedifex/command/pom.lux +++ b/stdlib/source/test/aedifex/command/pom.lux @@ -46,7 +46,7 @@ (do ! [verdict (do ///action.monad [expected (|> (///pom.write sample) - (try\map (|>> (\ xml.codec encode) encoding.to-utf8)) + (try\map (|>> (\ xml.codec encode) (\ encoding.utf8 encode))) (\ ! wrap)) file (: (Promise (Try (File Promise))) (file.get-file promise.monad fs path)) diff --git a/stdlib/source/test/aedifex/dependency/resolution.lux b/stdlib/source/test/aedifex/dependency/resolution.lux index 08bbaa4a4..c3e26f5bf 100644 --- a/stdlib/source/test/aedifex/dependency/resolution.lux +++ b/stdlib/source/test/aedifex/dependency/resolution.lux @@ -67,19 +67,19 @@ (#try.Success [state (|> package (get@ #///package.pom) (\ xml.codec encode) - encoding.to-utf8)]) + (\ encoding.utf8 encode))]) (text\= extension ///artifact/extension.sha-1) (#try.Success [state (|> package (get@ #///package.sha-1) (\ ///hash.sha-1-codec encode) - encoding.to-utf8)]) + (\ encoding.utf8 encode))]) (text\= extension ///artifact/extension.md5) (#try.Success [state (|> package (get@ #///package.md5) (\ ///hash.md5-codec encode) - encoding.to-utf8)]) + (\ encoding.utf8 encode))]) ## else (#try.Failure "NOPE")) @@ -109,19 +109,19 @@ (#try.Success [state (|> expected-package (get@ #///package.pom) (\ xml.codec encode) - encoding.to-utf8)]) + (\ encoding.utf8 encode))]) (text\= extension ///artifact/extension.sha-1) (#try.Success [state (|> dummy-package (get@ #///package.sha-1) (\ ///hash.sha-1-codec encode) - encoding.to-utf8)]) + (\ encoding.utf8 encode))]) (text\= extension ///artifact/extension.md5) (#try.Success [state (|> expected-package (get@ #///package.md5) (\ ///hash.md5-codec encode) - encoding.to-utf8)]) + (\ encoding.utf8 encode))]) ## else (#try.Failure "NOPE")) @@ -139,19 +139,19 @@ (#try.Success [state (|> expected-package (get@ #///package.pom) (\ xml.codec encode) - encoding.to-utf8)]) + (\ encoding.utf8 encode))]) (text\= extension ///artifact/extension.sha-1) (#try.Success [state (|> expected-package (get@ #///package.sha-1) (\ ///hash.sha-1-codec encode) - encoding.to-utf8)]) + (\ encoding.utf8 encode))]) (text\= extension ///artifact/extension.md5) (#try.Success [state (|> dummy-package (get@ #///package.md5) (\ ///hash.md5-codec encode) - encoding.to-utf8)]) + (\ encoding.utf8 encode))]) ## else (#try.Failure "NOPE")) @@ -214,19 +214,19 @@ (#try.Success [state (|> expected-package (get@ #///package.pom) (\ xml.codec encode) - encoding.to-utf8)]) + (\ encoding.utf8 encode))]) (text\= extension ///artifact/extension.sha-1) (#try.Success [state (|> dummy-package (get@ #///package.sha-1) (\ ///hash.sha-1-codec encode) - encoding.to-utf8)]) + (\ encoding.utf8 encode))]) (text\= extension ///artifact/extension.md5) (#try.Success [state (|> expected-package (get@ #///package.md5) (\ ///hash.md5-codec encode) - encoding.to-utf8)]) + (\ encoding.utf8 encode))]) ## else (#try.Failure "NOPE")) @@ -244,19 +244,19 @@ (#try.Success [state (|> expected-package (get@ #///package.pom) (\ xml.codec encode) - encoding.to-utf8)]) + (\ encoding.utf8 encode))]) (text\= extension ///artifact/extension.sha-1) (#try.Success [state (|> expected-package (get@ #///package.sha-1) (\ ///hash.sha-1-codec encode) - encoding.to-utf8)]) + (\ encoding.utf8 encode))]) (text\= extension ///artifact/extension.md5) (#try.Success [state (|> dummy-package (get@ #///package.md5) (\ ///hash.md5-codec encode) - encoding.to-utf8)]) + (\ encoding.utf8 encode))]) ## else (#try.Failure "NOPE")) diff --git a/stdlib/source/test/aedifex/input.lux b/stdlib/source/test/aedifex/input.lux index dc424afc8..a0db21ba6 100644 --- a/stdlib/source/test/aedifex/input.lux +++ b/stdlib/source/test/aedifex/input.lux @@ -50,7 +50,7 @@ _ (|> expected //format.profile %.code - encoding.to-utf8 + (\ encoding.utf8 encode) (!.use (\ file over-write))) actual (: (Promise (Try Profile)) (/.read promise.monad fs //.default))] diff --git a/stdlib/source/test/aedifex/metadata/artifact.lux b/stdlib/source/test/aedifex/metadata/artifact.lux new file mode 100644 index 000000000..bb105f305 --- /dev/null +++ b/stdlib/source/test/aedifex/metadata/artifact.lux @@ -0,0 +1,69 @@ +(.module: + [lux #* + ["_" test (#+ Test)] + [abstract + [monad (#+ do)] + {[0 #spec] + [/ + ["$." equivalence]]}] + [control + ["." try ("#\." functor)] + [parser + ["<.>" xml]]] + [data + [number + ["n" nat]]] + ["." time + ["." date] + ["." year] + ["." month] + ["." instant] + ["." duration]] + [math + ["." random (#+ Random)]] + [macro + ["." code]]] + {#program + ["." /]}) + +(def: #export random + (Random /.Metadata) + ($_ random.and + (random.ascii/alpha 5) + (random.ascii/alpha 5) + (random.list 5 (random.ascii/alpha 5)) + (do {! random.monad} + [year (\ ! map (|>> (n.% 10,000) .int) random.nat) + month (\ ! map (n.% 13) random.nat) + day-of-month (\ ! map (n.% 29) random.nat) + hour (\ ! map (n.% 24) random.nat) + minute (\ ! map (n.% 60) random.nat) + second (\ ! map (n.% 60) random.nat)] + (wrap (try.assume + (do try.monad + [year (year.year year) + month (month.by-number month) + date (date.date year month day-of-month) + time (time.time + {#time.hour hour + #time.minute minute + #time.second second + #time.milli-second 0})] + (wrap (instant.from-date-time date time)))))))) + +(def: #export test + Test + (<| (_.covering /._) + (_.for [/.Metadata]) + ($_ _.and + (_.for [/.equivalence] + ($equivalence.spec /.equivalence ..random)) + (do random.monad + [expected ..random] + (_.cover [/.write /.parser] + (|> expected + /.write + (<xml>.run /.parser) + (try\map (\ /.equivalence = expected)) + (try.default false)))) + ))) |