test/harness/testcaseio.c
changeset 39 bee41e04db85
parent 11 4a80c6053a66
child 101 f44c530f80da
     1.1 --- a/test/harness/testcaseio.c	Mon Jan 30 23:32:47 2012 +0000
     1.2 +++ b/test/harness/testcaseio.c	Sun Feb 26 09:52:49 2012 +0000
     1.3 @@ -6,6 +6,7 @@
     1.4  #include "testcaseparser.h"
     1.5  #include "testcaseinput.h"
     1.6  #include "testcaseio.h"
     1.7 +#include "warningsparser.h"
     1.8  
     1.9  /*
    1.10   * Read a testcase in from a file.
    1.11 @@ -17,6 +18,8 @@
    1.12      Testcase *testcase;
    1.13      TestcaseParser *parser;
    1.14      TestcaseInput *input=NULL;
    1.15 +    GMarkupParseContext *context;
    1.16 +    GError *err=NULL;
    1.17      char *s,*arg;
    1.18      const char *tag,*text;
    1.19      gboolean found_tag=FALSE;
    1.20 @@ -64,8 +67,25 @@
    1.21  		testcase->flags|=TESTCASE_TMP_DIR;
    1.22  	    g_free(arg);
    1.23  	}
    1.24 -	else if (!testcase->expected && !strcmp(tag,"EXPECTED"))
    1.25 +	else if (!testcase->expected && !testcase->warnings &&
    1.26 +	  !strcmp(tag,"EXPECTED"))
    1.27  	    testcase->expected=g_strdup(text);
    1.28 +	else if (!testcase->expected && !testcase->warnings &&
    1.29 +	  !strcmp(tag,"WARNINGS"))
    1.30 +	{
    1.31 +	    context=warnings_parse_context_new(testcase);
    1.32 +	    if (!g_markup_parse_context_parse(context,text,-1,&err) ||
    1.33 +	      !g_markup_parse_context_end_parse(context,&err))
    1.34 +	    {
    1.35 +		g_markup_parse_context_free(context);
    1.36 +		g_printerr("%s\n",err->message);
    1.37 +		g_clear_error(&err);
    1.38 +		testcase_free(testcase);
    1.39 +		testcase_parser_free(parser);
    1.40 +		return NULL;
    1.41 +	    }
    1.42 +	    g_markup_parse_context_free(context);
    1.43 +	}
    1.44  	else if (!testcase->encoding && !strcmp(tag,"ENCODING"))
    1.45  	    testcase->encoding=g_strchomp(g_strdup(text));
    1.46  	else if (!testcase->encoding && !strcmp(tag,"OPTIONS"))