test suite test plain text
import ideal • machine • channels • string writer
static FOO : "foo"
static BAR : "bar"
static BAZ : "baz"
static WYZZY : "wyzzy"
test case test writer trivial()
the writer : string writer • new()
the formatter : plain formatter • new(the writer)
the formatter • write(base element • new(text library • P, FOO))
assert "foo\n" == the writer • elements()
test case test writer indent0()
the writer : string writer • new()
the formatter : plain formatter • new(the writer)
the formatter • write(base element • new(text library • P, FOO))
the formatter • write(base element • new(text library • INDENT, BAR))
assert "foo\n bar\n" == the writer • elements()
test case test writer indent1()
the writer : string writer • new()
the formatter : plain formatter • new(the writer)
the formatter • write(base element • new(text library • P, FOO))
bar : base element • new(text library • P, BAR)
baz : base element • new(text library • P, BAZ)
the formatter • write(base element • new(text library • INDENT, base list text node • make(bar, baz)))
the formatter • write(base element • new(text library • P, WYZZY))
assert "foo\n bar\n baz\nwyzzy\n" == the writer • elements()
test case test writer indent2()
the writer : string writer • new()
the formatter : plain formatter • new(the writer)
the formatter • write(base element • new(text library • P, FOO))
the formatter • write(base element • new(text library • INDENT, "bar\nbaz"))
the formatter • write(base element • new(text library • P, WYZZY))
assert "foo\n bar\n baz\nwyzzy\n" == the writer • elements()
test case test self closing tag()
the writer : string writer • new()
the formatter : plain formatter • new(the writer)
the formatter • write(FOO)
the formatter • write(base element • new(text library • BR, text library • CLEAR, "all", missing • instance))
the formatter • write("bar\n")
assert "foo\nbar\n" == the writer • elements()
test case test writer fragment()
the writer : string writer • new()
the formatter : plain formatter • new(the writer)
fragment : text entity • new(text library • IDEAL TEXT, "*", "middot")
the formatter • write("one")
the formatter • write(fragment)
the formatter • write("two")
assert "one*two" == the writer • elements()
test case test underline tag()
the writer : string writer • new()
the formatter : plain formatter • new(the writer)
the formatter • write("hello ")
world string : "world"
the formatter • write(base element • new(text library • U, base list text node • make(world string, br, FOO)))
the formatter • write(" bar")
the formatter • write(base element • new(text library • BR, missing • instance))
assert "hello world\n ^^^^^\nfoo bar\n^^^\n" == the writer • elements()
test case test underline2 tag()
the writer : string writer • new()
the formatter : plain formatter • new(the writer)
the formatter • write("hello ")
world string : "world"
the formatter • write(base element • new(text library • U2, base list text node • make(world string, br, FOO)))
the formatter • write(" bar")
the formatter • write(base element • new(text library • BR, missing • instance))
assert "hello world\n -----\nfoo bar\n---\n" == the writer • elements()
test case test two underlines()
the writer : string writer • new()
the formatter : plain formatter • new(the writer)
text element hi : base element • new(text library • U, "hi")
the formatter • write(text utilities • join("foo ", mid, " bar"))
the formatter • write(base element • new(text library • BR, missing • instance))
assert "foo start hi end bar\n ------^^----\n" == the writer • elements()
test case test blank line()
the writer : string writer • new()
the formatter : plain formatter • new(the writer)
the formatter • write(base element • new(text library • DIV, FOO))
the formatter • write(base element • new(text library • BR))
the formatter • write(base element • new(text library • DIV, "bar"))
assert "foo\n\nbar\n" == the writer • elements()