diff options
| author | adelon <22380201+adelon@users.noreply.github.com> | 2026-07-31 22:43:16 +0200 |
|---|---|---|
| committer | adelon <22380201+adelon@users.noreply.github.com> | 2026-07-31 22:43:16 +0200 |
| commit | 91cea9ad8e320138ddffdbdcdc94edc789f1c14e (patch) | |
| tree | 38f2d912c02ab1f9ec288f6efeb271ab514dfcef /source/Test/Unit/CommandLine.hs | |
| parent | b4dac1818cdfddd11a0d75e2dfca4946bfc9cc4f (diff) | |
Restore precise verification diagnostics
Diffstat (limited to 'source/Test/Unit/CommandLine.hs')
| -rw-r--r-- | source/Test/Unit/CommandLine.hs | 38 |
1 files changed, 36 insertions, 2 deletions
diff --git a/source/Test/Unit/CommandLine.hs b/source/Test/Unit/CommandLine.hs index 0a49fc4..6d00936 100644 --- a/source/Test/Unit/CommandLine.hs +++ b/source/Test/Unit/CommandLine.hs @@ -5,7 +5,9 @@ module Test.Unit.CommandLine (unitTests) where import Base import Api (VerificationReport(..), VerificationRoute(..)) import CommandLine +import Felix.Source (safeRelativePath) import Felix.Store qualified as Store +import Render.Html.Output qualified as HtmlOutput import Report.Location (pattern Nowhere) import Control.Exception (bracket) @@ -37,6 +39,8 @@ unitTests = for_ outcomeCases \(outcome, expectedExitCode) -> commandOutcomeExitCode outcome `shouldBe` expectedExitCode + , testCase "reports the committed HTML prefix" + reportsCommittedHtmlPrefix , testGroup "process boundary" [ testCase "version needs no input or store" versionNeedsNoInputOrStore @@ -206,7 +210,9 @@ malformedSourceHasStableFailure = ["input.tex", "--parseonly"] exitCode `shouldBe` ExitFailure 1 stdout `shouldBe` "" - stderr `shouldContain` "Parsing failed." + stderr `shouldContain` "Parsing failed: project:input.tex" + stderr `shouldContain` "input.tex 2:5" + stderr `shouldContain` "unconsumed word" assertBool "does not print an internal error constructor" (not ("SourceParseError" `List.isInfixOf` stderr)) assertNoDefaultStore fixture @@ -222,9 +228,37 @@ invalidOutputPrecedesStoreStartup = ["input.tex", "--dump", "dump"] exitCode `shouldBe` ExitFailure 2 stdout `shouldBe` "" - stderr `shouldContain` "Verification output preflight failed." + stderr `shouldContain` "Verification output preflight failed:" + stderr `shouldContain` (Text.pack (show dump)) + stderr `shouldContain` "choose an absent or empty directory" + stderr `shouldContain` "stale.p" assertNoDefaultStore fixture +reportsCommittedHtmlPrefix :: Assertion +reportsCommittedHtmlPrefix = do + first <- checkedRelative "a.html" + second <- checkedRelative "nested/b.html" + failed <- checkedRelative "nested/c.html" + assertEqual + "deterministic committed prefix" + [ "HTML publication failed at \"nested/c.html\": disk full" + , "HTML files published before the failure: \"a.html\", \"nested/b.html\"" + ] + (HtmlOutput.renderHtmlPublicationError + (HtmlOutput.IncompleteHtmlPublication + [first, second] + failed + "disk full")) + where + checkedRelative path = + case safeRelativePath path of + Left problem -> + assertFailure + ("invalid test route " <> show path <> ": " <> show problem) + >> fail "unreachable" + Right relative -> + pure relative + dumpsExactExecutedRequest :: Assertion dumpsExactExecutedRequest = withCliFixture cliSource \fixture -> do |
