summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorDodji <dodji@gnome.org>2004-03-06 22:49:56 +0000
committerDodji Seketeli <dodji@src.gnome.org>2004-03-06 22:49:56 +0000
commit9fd0686e5a84f3c62e3a3ce4c11777e4f2050cb7 (patch)
tree95ec9181b898929edb2f561ac6e71a000b9a21a6 /tests
parent406526f52125bbf6dbf95eee6f01655544a70b24 (diff)
downloadlibcroco-9fd0686e5a84f3c62e3a3ce4c11777e4f2050cb7.tar.gz
when you reach an EOF, don't assume it's an error. Return the already
2004-03-06 Dodji <dodji@gnome.org> * src/cr-tknzr.c: (cr_tknzr_parse_num): when you reach an EOF, don't assume it's an error. Return the already parsed part of the number. Next attempt of parsing will result in an * tests/test4-main.c: udpated this test the fix made above. CR_END_OF_INPUT_ERROR.
Diffstat (limited to 'tests')
-rw-r--r--tests/test4-main.c59
1 files changed, 42 insertions, 17 deletions
diff --git a/tests/test4-main.c b/tests/test4-main.c
index 4d0b68e..997e2ec 100644
--- a/tests/test4-main.c
+++ b/tests/test4-main.c
@@ -35,6 +35,8 @@
CRDocHandler * gv_test_handler = {0} ;
+const guchar * gv_term_buf= "106" ;
+
const guchar * gv_decl_buf =
"toto: tutu, tata" ;
@@ -149,6 +151,32 @@ test_cr_parser_parse (guchar * a_file_uri)
return status ;
}
+
+static enum CRStatus
+test_cr_term_parse_expression_from_buf (void)
+{
+ guchar * tmp_str = NULL ;
+ CRTerm * term = NULL ;
+
+ term = cr_term_parse_expression_from_buf (gv_term_buf,
+ CR_UTF_8) ;
+
+ if (!term)
+ return CR_ERROR ;
+ tmp_str = cr_term_to_string (term) ;
+ if (term)
+ {
+ cr_term_destroy (term) ;
+ term = NULL ;
+ }
+ if (tmp_str)
+ {
+ g_free (tmp_str) ;
+ tmp_str = NULL ;
+ }
+ return CR_OK ;
+}
+
static enum CRStatus
test_cr_declaration_parse (void)
{
@@ -397,66 +425,63 @@ main (int argc, char ** argv)
struct Options options ;
enum CRStatus status = CR_OK ;
+ status = test_cr_term_parse_expression_from_buf() ;
+ if (status != CR_OK)
+ {
+ g_print ("\ntest \"cr_term_parse_expression_from_buf failed\"") ;
+ }
status = test_cr_declaration_parse () ;
if (status != CR_OK)
{
- g_print ("\nKO\n") ;
- return 0 ;
+ g_print ("\n test \"cr_declaration_parse() failed\"\n") ;
}
status = test_cr_declaration_parse_list () ;
if (status != CR_OK)
{
- g_print ("\nKO\n") ;
- return 0 ;
+ g_print ("\ntest cr_declaration_parse_list() failed\n") ;
}
status = test_cr_statement_ruleset_parse () ;
if (status != CR_OK)
{
- g_print ("\nKO\n") ;
- return 0 ;
+ g_print ("\ntest cr_statement_ruleset_parse() failed\n") ;
}
status = test_cr_statement_at_media_rule_parse () ;
if (status != CR_OK)
{
- g_print ("\nKO\n") ;
- return 0 ;
+ g_print ("\ntest cr_statement_at_media_rule_parse() failed\n") ;
}
test_cr_statement_at_page_rule_parse () ;
if (status != CR_OK)
{
- g_print ("\nKO\n") ;
+ g_print ("\ntest cr_statement_at_page_rule_parse() failed\n") ;
return 0 ;
}
status = test_cr_statement_at_charset_rule_parse () ;
if (status != CR_OK)
{
- g_print ("\nKO\n") ;
- return 0 ;
+ g_print ("\ntest cr_statement_at_charset_rule_parse() failed\n") ;
}
status = test_cr_statement_font_face_rule_parse_from_buf () ;
if (status != CR_OK)
{
- g_print ("\nKO\n") ;
- return 0 ;
+ g_print ("\ntest cr_statement_font_face_rule_parse_from_buf() failed\n") ;
}
test_cr_statement_at_import_rule_parse_from_buf () ;
if (status != CR_OK)
{
- g_print ("\nKO\n") ;
- return 0 ;
+ g_print ("\ntest cr_statement_at_import_rule() failed\n") ;
}
status = test_cr_statement_parse_from_buf () ;
if (status != CR_OK)
{
- g_print ("\nKO\n") ;
- return 0 ;
+ g_print ("\ntest cr_statement_parse_from_buf() failed\n") ;
}
cr_test_utils_parse_cmd_line (argc, argv, &options) ;