diff options
| author | adelon <22380201+adelon@users.noreply.github.com> | 2026-08-03 19:22:03 +0200 |
|---|---|---|
| committer | adelon <22380201+adelon@users.noreply.github.com> | 2026-08-03 19:22:03 +0200 |
| commit | 8883dc76b25bf276280ee23b57e1ae6d99f24918 (patch) | |
| tree | 2f18bab579db19e3df9c5a9ef8f7aaedc6a68dd2 /source/Test/Unit/Module.hs | |
| parent | 456eea158c74ea18e773675cd4b076302bc96477 (diff) | |
Render final-prelude diagnostics
Diffstat (limited to 'source/Test/Unit/Module.hs')
| -rw-r--r-- | source/Test/Unit/Module.hs | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/source/Test/Unit/Module.hs b/source/Test/Unit/Module.hs index cdc89b0..fa3f6f9 100644 --- a/source/Test/Unit/Module.hs +++ b/source/Test/Unit/Module.hs @@ -33,6 +33,7 @@ import Paths_felix qualified as Paths import Syntax.Abstract qualified as Raw import Syntax.Internal qualified as Internal import Syntax.Interface qualified as Syntax +import Syntax.Pragma qualified as Pragma import Bound.Scope (fromScope) import Bound.Var (Var(..)) @@ -68,6 +69,8 @@ unitTests = identifiesCommentOnlyInput , testCase "loads and parses the packaged final prelude" parsesPackagedFinalPrelude + , testCase "renders packaged final-prelude failures" + rendersPackagedPreludeFailures , testCase "confines exact foundation-leaf completion" confinesFoundationLeafCompletion , testCase "builds the confined final prelude" @@ -291,6 +294,30 @@ parsesPackagedFinalPrelude = do (Syntax.moduleSyntaxAssertedId (Parse.identifiedParsedModuleSyntaxInterface secondParsed)) +rendersPackagedPreludeFailures :: Assertion +rendersPackagedPreludeFailures = do + assertEqual "load failure" + "/missing/felix-prelude.tex: unable to read packaged final prelude: not found" + (Prelude.renderPreludeLoadError + (Prelude.PreludeSourceReadFailed + "/missing/felix-prelude.tex" + "not found")) + assertEqual "located syntax failure" + "<felix-prelude>: syntax pragma location is out of range at 7:3" + (Prelude.renderPreludeParseError parseFailure) + assertEqual "authority-free API presentation" + ("packaged final prelude parsing failed: " + <> "<felix-prelude>: syntax pragma location is out of range at 7:3") + (Api.renderAuthorityFreeParseError + (Api.AuthorityFreePreludeParseFailed parseFailure)) + where + parseFailure = + Prelude.PreludeSyntaxPragmaFailed + (Pragma.SyntaxPragmaLocationOutOfRange + Prelude.preludeDiagnosticLabel + 7 + 3) + confinesFoundationLeafCompletion :: Assertion confinesFoundationLeafCompletion = do foundation <- expectRight Foundation.checkedFoundation |
