From c4bbfea18d995948012f45a6afda7a6e6ba56f84 Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Tue, 24 Nov 2020 05:18:04 -0400 Subject: Better error messages when re-using a name when making a definition. --- stdlib/source/test/aedifex/package.lux | 37 +++++++++++++++++++--------------- 1 file changed, 21 insertions(+), 16 deletions(-) (limited to 'stdlib/source/test/aedifex/package.lux') diff --git a/stdlib/source/test/aedifex/package.lux b/stdlib/source/test/aedifex/package.lux index b85f6ce4a..5400d4953 100644 --- a/stdlib/source/test/aedifex/package.lux +++ b/stdlib/source/test/aedifex/package.lux @@ -31,31 +31,36 @@ ["#." pom] ["#." hash]]]}) +(def: #export random + (Random [//.Profile /.Package]) + (do {! random.monad} + [content-size (:: ! map (n.% 100) random.nat) + content (_binary.random content-size) + [profile pom] (random.one (function (_ profile) + (try.to-maybe + (do try.monad + [pom (//pom.write profile)] + (wrap [profile pom])))) + @profile.random)] + (wrap [profile (/.local pom content)]))) + (def: #export test Test (<| (_.covering /._) (_.with-cover [/.Package]) (do {! random.monad} - [content-size (:: ! map (n.% 100) random.nat) - content (_binary.random content-size) - [profile pom] (random.one (function (_ profile) - (try.to-maybe - (do try.monad - [pom (//pom.write profile)] - (wrap [profile pom])))) - @profile.random)] + [[profile package] ..random] ($_ _.and (_.cover [/.local] - (let [package (/.local pom content)] - (and (:: //hash.equivalence = - (//hash.sha-1 content) - (get@ #/.sha-1 package)) - (:: //hash.equivalence = - (//hash.md5 content) - (get@ #/.md5 package))))) + (and (:: //hash.equivalence = + (//hash.sha-1 (get@ #/.library package)) + (get@ #/.sha-1 package)) + (:: //hash.equivalence = + (//hash.md5 (get@ #/.library package)) + (get@ #/.md5 package)))) (_.cover [/.dependencies] (let [expected (get@ #//.dependencies profile)] - (case (/.dependencies (/.local pom content)) + (case (/.dependencies package) (#try.Success actual) (:: set.equivalence = expected actual) -- cgit v1.2.3