feat: Adds stack separators, removes some unused nodes from cli-doc module
All checks were successful
CI / Run tests. (push) Successful in 52s
All checks were successful
CI / Run tests. (push) Successful in 52s
This commit is contained in:
@@ -33,16 +33,20 @@ struct CliDocCoreTests {
|
||||
}
|
||||
#expect(stack.render() == "foo bar")
|
||||
|
||||
let tabStack = HStack(separator: .tab()) {
|
||||
let tabStack = HStack {
|
||||
"foo"
|
||||
"bar"
|
||||
}
|
||||
.separator(.tab())
|
||||
|
||||
#expect(tabStack.render() == "foo\tbar")
|
||||
|
||||
let customStack = HStack(separator: .custom(":blob:")) {
|
||||
let customStack = HStack {
|
||||
"foo"
|
||||
"bar"
|
||||
}
|
||||
.separator(.custom(":blob:"))
|
||||
|
||||
#expect(customStack.render() == "foo:blob:bar")
|
||||
}
|
||||
|
||||
@@ -58,10 +62,12 @@ struct CliDocCoreTests {
|
||||
bar
|
||||
""")
|
||||
|
||||
let customStack = VStack(separator: .custom("\n\t")) {
|
||||
let customStack = VStack {
|
||||
"foo"
|
||||
"bar"
|
||||
}
|
||||
.separator(.custom("\n\t"))
|
||||
|
||||
#expect(customStack.render() == """
|
||||
foo
|
||||
\tbar
|
||||
|
||||
@@ -12,16 +12,6 @@ struct CliDocTests {
|
||||
return true
|
||||
}()
|
||||
|
||||
@Test
|
||||
func testNote() {
|
||||
#expect(setupRainbow)
|
||||
let note = Note(content: "Some note.")
|
||||
let expected = """
|
||||
\("NOTE:".yellow.bold) Some note.
|
||||
"""
|
||||
#expect(note.render() == expected)
|
||||
}
|
||||
|
||||
@Test
|
||||
func testExamples() {
|
||||
#expect(setupRainbow)
|
||||
@@ -95,7 +85,7 @@ extension ExampleSectionStyle where Self == DefaultExampleSectionStyle<CustomExa
|
||||
|
||||
struct CustomExampleOnlyStyle: ExampleStyle {
|
||||
func render(content: ExampleConfiguration) -> some TextNode {
|
||||
VStack(separator: .newLine(count: 2)) {
|
||||
VStack {
|
||||
content.examples.map { example in
|
||||
VStack {
|
||||
example.label.red
|
||||
@@ -103,5 +93,6 @@ struct CustomExampleOnlyStyle: ExampleStyle {
|
||||
}
|
||||
}
|
||||
}
|
||||
.separator(.newLine(count: 2))
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user