seq: fix selecting subthreads at the end of sequences and add test cases

pull/25/head
Duncaen 7 years ago
parent b960d5e3cc
commit 537282d6af

@ -266,8 +266,10 @@ parse_subthread(char *map, long a, long *stopo)
for (s = map, line = 0; s; s = t+1) {
t = strchr(s, '\n');
if (!t)
if (!t) {
minindent = -1;
break;
}
line++;
int indent = 0;
while (*s && iswsp(*s)) {

@ -1,7 +1,7 @@
#!/bin/sh -e
cd ${0%/*}
. ./lib.sh
plan 8
plan 10
rm -rf test.dir
mkdir test.dir
@ -32,4 +32,13 @@ check_test 'subthread' -eq 2 'mseq 7_ | wc -l'
check 'parent' 'mseq 6^ | grep "inbox/cur/5_1:2,"'
check_test 'range' -eq 3 'mseq 1:3 | wc -l'
cat <<! >seq
inbox/cur/1:2,
inbox/cur/2:2,
inbox/cur/3:2,
!
check_test 'whole thread at the end' -eq 3 'mseq 2= | wc -l'
check_test 'subthread at the end' -eq 2 'mseq 2_ | wc -l'
)

Loading…
Cancel
Save