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") } }