-- SPDX-FileCopyrightText: 2020 Tocqueville Group -- -- SPDX-License-Identifier: LicenseRef-MIT-TQ -- | Tests on ordering of documentation items. module Test.Lorentz.Doc.Positions ( test_Errors ) where import Data.Typeable (typeRep) import Fmt (pretty) import Test.HUnit (Assertion, assertFailure) import Test.Tasty (TestTree) import Test.Tasty.HUnit (testCase) import Lorentz.Errors import Lorentz.Errors.Numeric import Michelson.Doc -- | Test that one doc item goes before another doc item in generated -- documentation. (<.) :: forall d1 d2. (DocItem d1, DocItem d2) => Proxy d1 -> Proxy d2 -> Assertion dp1 <. dp2 = unless (p1 < p2) $ assertFailure $ "Doc item " <> show (typeRep dp1) <> " with position " <> pretty p1 <> " \ \goes before doc item " <> show (typeRep dp2) <> " with position " <> pretty p2 where p1 = docItemPosition @d1 p2 = docItemPosition @d2 test_Errors :: [TestTree] test_Errors = [ testCase "Error tag mapping is described before errors" $ -- This is required because when @Errors@ section is modified -- to mention numeric error tags, it needs some clarification -- provided by @About error tag mapping@ section. Proxy @DDescribeErrorTagMap <. Proxy @DError ]