diff options
-rw-r--r-- | src/storycode.c | 6 | ||||
-rw-r--r-- | tests/storycode_test.c | 19 |
2 files changed, 16 insertions, 9 deletions
diff --git a/src/storycode.c b/src/storycode.c index 66bed60..9e58092 100644 --- a/src/storycode.c +++ b/src/storycode.c @@ -217,12 +217,6 @@ static size_t read_block(const char *sc, char **pname, char **options, } while ( !done && (i<l) ); name[j] = '\0'; - - if ( !done ) { - *err = 1; - printf("Couldn't find end of block beginning '%s'\n", sc); - return 0; - } *pname = name; if ( sc[i] == '[' ) { diff --git a/tests/storycode_test.c b/tests/storycode_test.c index 5fbde5a..c927777 100644 --- a/tests/storycode_test.c +++ b/tests/storycode_test.c @@ -30,13 +30,11 @@ #include "../src/storycode.h" -int main(int argc, char *argv[]) +static int test_sc(const char *tt) { SCBlockList *bl; SCBlockListIterator *iter; struct scblock *b; - const char *tt = "\\bg[a=b]{wibble \\f{wobble}}\\bg{rwawr}\\muhu Wobble" - "\\wibble{}\\f{wibble \\bg[muhu]{wobble}}\\frib[\\f] f"; printf("'%s' ->\n", tt); bl = sc_find_blocks(tt, "bg"); @@ -72,3 +70,18 @@ int main(int argc, char *argv[]) return 0; } + +int main(int argc, char *argv[]) +{ + int v = 0; + int r; + + r = test_sc("\\bg[a=b]{wibble \\f{wobble}}\\bg{rwawr}\\muhu Wobble" + "\\wibble{}\\f{wibble \\bg[muhu]{wobble}}\\frib[\\f] f"); + if ( r ) v = 1; + + r = test_sc("A B C \\wibble"); + if ( r ) v = 1; + + return v; +} |