test/harness/testcaseio.c
changeset 105 2d48e8cdda24
parent 101 f44c530f80da
     1.1 --- a/test/harness/testcaseio.c	Sat Oct 26 18:47:33 2013 +0100
     1.2 +++ b/test/harness/testcaseio.c	Wed Oct 02 09:14:33 2013 +0100
     1.3 @@ -5,6 +5,7 @@
     1.4  #include <bl/bl.h>
     1.5  #include "testcaseparser.h"
     1.6  #include "testcaseinput.h"
     1.7 +#include "testcaseoutput.h"
     1.8  #include "testcaseio.h"
     1.9  #include "warningsparser.h"
    1.10  
    1.11 @@ -70,6 +71,25 @@
    1.12  	else if (!testcase->expected && !testcase->warnings &&
    1.13  	  !strcmp(tag,"EXPECTED"))
    1.14  	    testcase->expected=g_strdup(text);
    1.15 +	else if (g_str_has_prefix(tag,"EXPECTED(") && tag[strlen(tag)-1]==')')
    1.16 +	{
    1.17 +	    arg=g_strndup(tag+9,strlen(tag)-10);
    1.18 +	    s=g_path_get_dirname(arg);
    1.19 +	    if (strcmp(s,"."))
    1.20 +	    {
    1.21 +		g_printerr("%s: Expected files may not have a "
    1.22 +		  "directory component\n",arg);
    1.23 +		g_free(s);
    1.24 +		g_free(arg);
    1.25 +		testcase_free(testcase);
    1.26 +		testcase_parser_free(parser);
    1.27 +		return NULL;
    1.28 +	    }
    1.29 +	    g_free(s);
    1.30 +	    testcase->outputs=g_slist_prepend(testcase->outputs,
    1.31 +	      testcase_output_new(arg,text));
    1.32 +	    g_free(arg);
    1.33 +	}
    1.34  	else if (!testcase->expected && !testcase->warnings &&
    1.35  	  !strcmp(tag,"WARNINGS"))
    1.36  	{
    1.37 @@ -108,11 +128,14 @@
    1.38  	    }
    1.39  	    g_free(s);
    1.40  	}
    1.41 -	else if (!testcase->encoding && !strcmp(tag,"OPTIONS"))
    1.42 +	else if (!testcase->options && !strcmp(tag,"OPTIONS"))
    1.43  	{
    1.44  	    testcase->options=g_strsplit(text,"\n",0);
    1.45 -	    g_free(testcase->options[g_strv_length(testcase->options)-1]);
    1.46 -	    testcase->options[g_strv_length(testcase->options)-1]=NULL;
    1.47 +	    if (testcase->options && g_strv_length(testcase->options)>0)
    1.48 +	    {
    1.49 +		g_free(testcase->options[g_strv_length(testcase->options)-1]);
    1.50 +		testcase->options[g_strv_length(testcase->options)-1]=NULL;
    1.51 +	    }
    1.52  	}
    1.53  	else
    1.54  	{