diff options
Diffstat (limited to 'spec/text_spec.lua')
-rw-r--r-- | spec/text_spec.lua | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/spec/text_spec.lua b/spec/text_spec.lua index d50624f..095afb8 100644 --- a/spec/text_spec.lua +++ b/spec/text_spec.lua @@ -66,6 +66,11 @@ end ]], text.indent("easy\n\nenough!", 2 ,'*')) end) + it("indent() appends a newline if not present", function() + assert.equal(" hello\n world\n", text.indent("hello\nworld", 2)) + assert.equal(" hello\n world\n", text.indent("hello\nworld\n", 2)) + end) + it("dedent() removes prefixed whitespace", function() assert.equal([[ @@ -79,6 +84,27 @@ three ]]) end) + it("dedent() removes prefixed whitespace, retains structure", function() + assert.equal([[ + one + + two + +three +]], text.dedent [[ + one + + two + + three +]]) + end) + + it("dedent() appends a newline if not present", function() + assert.equal("hello\nworld\n", text.dedent(" hello\n world")) + assert.equal("hello\nworld\n", text.dedent(" hello\n world\n")) + end) + it("fill()/wrap() word-wraps a text", function() assert.equal([[ |