feat: Working on node builder

This commit is contained in:
2024-12-01 15:25:42 -05:00
parent ff49b12198
commit 96a1fac07b
11 changed files with 357 additions and 21 deletions

View File

@@ -13,10 +13,9 @@ final class CliDocTests: XCTestCase {
func testStringChecks() {
let expected = "Foo".green.bold
let notexpected = "Foo"
XCTAssert("Foo".green.bold == expected)
XCTAssert("Foo".green.bold != notexpected)
XCTAssert(expected != "Foo")
}
func testRepeatingModifier() {
@@ -96,4 +95,35 @@ final class CliDocTests: XCTestCase {
"""
XCTAssert(node.render() == expected)
}
func testShellCommand() {
let node = ShellCommand {
"ls -lah"
}
let expected = " $ ls -lah"
XCTAssert(node.render() == expected)
}
func testDiscussion() {
let node = Discussion {
Group(separator: "\n") {
LabeledContent(separator: " ") {
"NOTE:".yellow.bold
} content: {
"Foo"
}
}
}
let expected = """
\("NOTE:".yellow.bold) Foo
"""
XCTAssert(node.render() == expected)
}
func testFooNode() {
let foo = Foo()
XCTAssertNotNil(foo.body as? LabeledContent)
}
}