test/harness/testcaseio.c
changeset 101 f44c530f80da
parent 17 2c88fd553e5d
child 102 ff0aa9b1397a
     1.1 --- a/test/harness/testcaseio.c	Mon Feb 06 23:55:27 2012 +0000
     1.2 +++ b/test/harness/testcaseio.c	Sat Oct 26 18:47:33 2013 +0100
     1.3 @@ -22,7 +22,7 @@
     1.4      GError *err=NULL;
     1.5      char *s,*arg;
     1.6      const char *tag,*text;
     1.7 -    gboolean found_tag=FALSE;
     1.8 +    gboolean found_tag=FALSE,newlines_set=FALSE;
     1.9      parser=testcase_parser_new_from_file(filename);
    1.10      if (!parser)
    1.11  	return NULL;
    1.12 @@ -88,6 +88,26 @@
    1.13  	}
    1.14  	else if (!testcase->encoding && !strcmp(tag,"ENCODING"))
    1.15  	    testcase->encoding=g_strchomp(g_strdup(text));
    1.16 +	else if (!newlines_set && !strcmp(tag,"NEWLINES"))
    1.17 +	{
    1.18 +	    newlines_set=TRUE;
    1.19 +	    s=g_strdup(text);
    1.20 +	    g_strchomp(s);
    1.21 +	    if (!strcmp(s,"LF"))
    1.22 +		testcase->flags|=TESTCASE_UNIX_NEWLINES;
    1.23 +	    else if (!strcmp(s,"CR"))
    1.24 +		testcase->flags|=TESTCASE_OS9_NEWLINES;
    1.25 +	    else if (strcmp(s,"CRLF"))
    1.26 +	    {
    1.27 +		g_printerr(
    1.28 +		  "%s: Unrecognised style for newlines. Try CR or LF.\n",s);
    1.29 +		g_free(s);
    1.30 +		testcase_free(testcase);
    1.31 +		testcase_parser_free(parser);
    1.32 +		return NULL;
    1.33 +	    }
    1.34 +	    g_free(s);
    1.35 +	}
    1.36  	else if (!testcase->encoding && !strcmp(tag,"OPTIONS"))
    1.37  	{
    1.38  	    testcase->options=g_strsplit(text,"\n",0);