117 lines
3.3 KiB
Plaintext
117 lines
3.3 KiB
Plaintext
#schema test
|
|
|
|
describe LineData
|
|
it Handles a blank line at indent level 0
|
|
key linedata:basic
|
|
input \n
|
|
output
|
|
| level 0 | indent | offsetHead 0 | offsetTail 0 | line |
|
|
|
|
it Handles a blank line with a single space
|
|
key linedata:basic
|
|
input \s
|
|
output
|
|
| level 1 | indent | offsetHead 1 | offsetTail 1 | line |
|
|
|
|
it Handles a blank line with two spaces
|
|
key linedata:basic
|
|
input \s\s
|
|
output
|
|
| level 2 | indent | offsetHead 2 | offsetTail 2 | line |
|
|
|
|
it Handles a normal line at indent level 0
|
|
key linedata:basic
|
|
input
|
|
line 1
|
|
output
|
|
| level 0 | indent | offsetHead 0 | offsetTail 4 | line line 1 |
|
|
|
|
it Handles a normal line at indent level 1
|
|
key linedata:basic
|
|
input
|
|
line 1
|
|
output
|
|
| level 1 | indent | offsetHead 1 | offsetTail 5 | line line 1 |
|
|
|
|
it Handles a normal line at indent level 2
|
|
key linedata:basic
|
|
input
|
|
line 1
|
|
output
|
|
| level 2 | indent | offsetHead 2 | offsetTail 6 | line line 1 |
|
|
|
|
it Handles a normal line at indent level 1 indented with tabs
|
|
key linedata:tabs
|
|
input
|
|
\tline 1
|
|
output
|
|
| level 1 | indent \t | offsetHead 1 | offsetTail 5 | line \tline 1 |
|
|
|
|
it Handles a normal line at indent level 2 indented with tabs
|
|
key linedata:tabs
|
|
input
|
|
\t\tline 1
|
|
output
|
|
| level 2 | indent \t | offsetHead 2 | offsetTail 6 | line \t\tline 1 |
|
|
|
|
it Nests a normal line under a preceding normal line
|
|
key linedata:basic
|
|
input
|
|
line 1
|
|
line 2
|
|
output
|
|
| level 0 | indent | offsetHead 0 | offsetTail 4 | line line 1 |
|
|
| level 1 | indent | offsetHead 1 | offsetTail 5 | line line 2 |
|
|
|
|
it Nests multiple normal lines under a preceding normal line
|
|
key linedata:basic
|
|
input
|
|
line 1
|
|
line 2
|
|
line 3
|
|
line 4
|
|
output
|
|
| level 0 | indent | offsetHead 0 | offsetTail 4 | line line 1 |
|
|
| level 1 | indent | offsetHead 1 | offsetTail 5 | line line 2 |
|
|
| level 1 | indent | offsetHead 1 | offsetTail 5 | line line 3 |
|
|
| level 1 | indent | offsetHead 1 | offsetTail 5 | line line 4 |
|
|
|
|
it Does not nest an empty line under a preceding normal line
|
|
key linedata:basic
|
|
comment Two newlines are needed here. A single newline will look to readline as if the input is finished.
|
|
input line 1\n\n
|
|
output
|
|
| level 0 | indent | offsetHead 0 | offsetTail 4 | line line 1 |
|
|
| level 0 | indent | offsetHead 0 | offsetTail 0 | line |
|
|
|
|
it Does not nest multiple empty lines under a preceding normal line
|
|
key linedata:basic
|
|
comment Four newlines are needed here. A single newline will look to readline as if the input is finished.
|
|
input line 1\n\n\n\n
|
|
output
|
|
| level 0 | indent | offsetHead 0 | offsetTail 4 | line line 1 |
|
|
| level 0 | indent | offsetHead 0 | offsetTail 0 | line |
|
|
| level 0 | indent | offsetHead 0 | offsetTail 0 | line |
|
|
| level 0 | indent | offsetHead 0 | offsetTail 0 | line |
|
|
|
|
it Handles head and tail matching for lines with head and tail
|
|
key linedata:head-tail
|
|
input
|
|
head1 tail1 tail2 tail3
|
|
output
|
|
| head head1 | tail tail1 tail2 tail3 |
|
|
|
|
it Handles head and tail matching for lines with head but no tail
|
|
key linedata:head-tail
|
|
packages c js python
|
|
input
|
|
head1
|
|
output
|
|
| head head1 | tail |
|
|
|
|
it Handles head and tail matching for lines with head and trailing space
|
|
key linedata:head-tail
|
|
input head1 \n
|
|
output
|
|
| head head1 | tail |
|