File: immutable-paragraphs.lua

package info (click to toggle)
wordgrinder 0.8-1
  • links: PTS
  • area: main
  • in suites: bookworm, bullseye, forky, sid, trixie
  • size: 2,100 kB
  • sloc: ansic: 3,880; makefile: 194; xml: 13; sh: 10
file content (16 lines) | stat: -rw-r--r-- 599 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
require "tests/testsuite"

local p = CreateParagraph("P", {"one"})
AssertTableEquals({"one"}, p)

local p = CreateParagraph("P", {"one", "two"}, {"three"})
AssertTableEquals({"one", "two", "three"}, p)

AssertTableEquals({"one"}, p:sub(1, 1))
AssertTableEquals({"one", "two"}, p:sub(1, 2))
AssertTableEquals({"one", "two", "three"}, p:sub(1, 3))
AssertTableEquals({"one", "two", "three"}, p:sub(1, 4))
AssertTableEquals({"one", "two", "three"}, p:sub(1))
AssertTableEquals({"two", "three"}, p:sub(2, 2))
AssertTableEquals({"two", "three"}, p:sub(2, 3))
AssertTableEquals({"two", "three"}, p:sub(2))