diff options
| author | Ruben Beltran del Rio <jj@r.bdr.sh> | 2026-06-15 14:35:36 +0200 |
|---|---|---|
| committer | Ruben Beltran del Rio <jj@r.bdr.sh> | 2026-06-16 14:47:30 +0200 |
| commit | 657aa83a5ca24dc35572c040df64a0abb85e8612 (patch) | |
| tree | fe0b6fd425d8cad9dc6a28ada4ad8600e42b367e /Tests/NorgUITests/RenderingSmokeTests.swift | |
Initial extraction from Norganize
Diffstat (limited to 'Tests/NorgUITests/RenderingSmokeTests.swift')
| -rw-r--r-- | Tests/NorgUITests/RenderingSmokeTests.swift | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/Tests/NorgUITests/RenderingSmokeTests.swift b/Tests/NorgUITests/RenderingSmokeTests.swift new file mode 100644 index 0000000..39c9eb5 --- /dev/null +++ b/Tests/NorgUITests/RenderingSmokeTests.swift @@ -0,0 +1,51 @@ +import NorgKit +import Testing + +@testable import NorgUI + +@Suite struct RenderingSmokeTests { + @Test func rangeableBlockExposesBodyForRecursion() { + let doc = NorgParser.parse("$ Norg\nA structured note format.") + guard case .definition(_, _, let body, _) = doc.blocks.first else { + Issue.record("Expected a definition") + return + } + #expect(!body.isEmpty) + } + + @Test func headingNestsContentAsTreeChildren() { + let nodes = NorgParser.parse("* Title\nbody text below").tree() + guard let heading = nodes.first, case .heading = heading.block else { + Issue.record("Expected a heading root") + return + } + #expect(!heading.children.isEmpty) + } + + @Test func nestedListNestsAsTreeChildren() { + let nodes = NorgParser.parse("- one\n-- nested").tree() + guard let item = nodes.first else { + Issue.record("Expected a list item") + return + } + #expect(item.children.count == 1) + } + + @Test func nonCodeRangedTagIsRouted() { + let doc = NorgParser.parse("@math\nx^2 + y^2 = z^2\n@end") + guard case .rangedTag(let name, _, _, _) = doc.blocks.first else { + Issue.record("Expected a ranged tag") + return + } + #expect(name == ["math"]) + } + + @Test func codeFenceBecomesCodeBlock() { + let doc = NorgParser.parse("@code swift\nlet x = 1\n@end") + guard case .codeBlock(let language, _, _) = doc.blocks.first else { + Issue.record("Expected a code block") + return + } + #expect(language == "swift") + } +} |