From 8474b3208a8b72d47bce670ed46d356ca39ae4bc Mon Sep 17 00:00:00 2001 From: Thomas White Date: Sat, 7 Sep 2013 02:04:23 +0200 Subject: Fix handling of SC blocks at end of text --- tests/storycode_test.c | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) (limited to 'tests') 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; +} -- cgit v1.2.3