... This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. ... If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/. (.require [library [lux (.except) [abstract [monad (.only do)]] [control ["[0]" try (.only Try)] [concurrency ["[0]" async (.only Async)]]] [data [text ["%" \\format] [encoding ["[0]" utf8]]] [collection ["[0]" set (.only Set)]]] [math ["[0]" random]] [world ["[0]" file]] [test ["[0]" unit] ["_" property (.only Test)]]]] [// ["$[0]" profile]] [\\program ["[0]" / (.only) ["/[1]" // ["[1]" profile (.only Profile)] ["[1][0]" project] ["[1][0]" action] ["[1][0]" format] [repository [remote (.only Address)]]]]]) (def (with_default_source sources) (-> (Set //.Source) (Set //.Source)) (if (set.empty? sources) (set.has //.default_source sources) sources)) (def with_default_repository (-> (Set Address) (Set Address)) (set.has //.default_repository)) (def with_defaults (-> Profile Profile) (|>> (revised //.#sources ..with_default_source) (revised //.#repositories ..with_default_repository))) (def .public test Test (<| (_.covering /._) (do [! random.monad] [expected (of ! each (has //.#parents (list)) $profile.random) .let [fs (is (file.System Async) (file.mock (of file.default separator)))]] (in (do async.monad [verdict (do //action.monad [.let [profile (|> expected (//project.project //.default) //format.project %.code (of utf8.codec encoded))] _ (of fs write //project.file profile) actual (is (Async (Try Profile)) (/.read async.monad fs (list)))] (in (of //.equivalence = (with_defaults expected) actual)))] (unit.coverage [/.read] (try.else false verdict)))))))