Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tests: Don't print parsing errors during tests #107

Merged
merged 2 commits into from
Oct 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion libcomps/tests/check_comps.c
Original file line number Diff line number Diff line change
Expand Up @@ -595,7 +595,7 @@ START_TEST(test_doc_defaults) {
tmp = comps2xml_str(doc, NULL, NULL);
//printf("tmp %s\n", tmp);
parsed = comps_parse_parsed_create();
fail_if(comps_parse_parsed_init(parsed, "UTF-8", 1) == 0);
fail_if(comps_parse_parsed_init(parsed, "UTF-8", 0) == 0);
comps_parse_str(parsed, tmp, NULL);
doc2 = parsed->comps_doc;
groups = comps_doc_groups(doc2);
Expand Down
22 changes: 11 additions & 11 deletions libcomps/tests/check_parse.c
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,10 @@ START_TEST(test_comps_parse1)
char *tmpstr;

COMPS_ObjList * tmplist;
fprintf(stderr, "## Running test_parse1\n\n");
fprintf(stderr, "## Running test_parse1\n");

parsed = comps_parse_parsed_create();
fail_if(comps_parse_parsed_init(parsed, "UTF-8", 1) == 0);
fail_if(comps_parse_parsed_init(parsed, "UTF-8", 0) == 0);


fp = fopen("sample-comps.xml", "r");
Expand Down Expand Up @@ -171,7 +171,7 @@ START_TEST(test_comps_parse1)
comps_parse_parsed_destroy(parsed);

parsed = comps_parse_parsed_create();
fail_if(comps_parse_parsed_init(parsed, "UTF-8", 1) == 0);
fail_if(comps_parse_parsed_init(parsed, "UTF-8", 0) == 0);
comps_parse_file(parsed, fp, NULL);
ret = comps_parse_validate_dtd("sample-bad-elem.xml", "comps.dtd");
fail_if(ret >0, "XML shouldn't be valid. Validation returned: %d", ret);
Expand Down Expand Up @@ -244,7 +244,7 @@ START_TEST(test_comps_parse2)
//COMPS_ListItem *it;
int i;

fprintf(stderr, "## Running test_parse2\n\n");
fprintf(stderr, "## Running test_parse2\n");
COMPS_LogEntry* known_errors[10];
known_errors[0] = __log_entry_x(COMPS_ERR_NOCONTENT, 3,
comps_str("description"),
Expand Down Expand Up @@ -280,7 +280,7 @@ START_TEST(test_comps_parse2)
// COMPS_ERR_ELEM_REQUIRED, 1201, 2, 0);

parsed = comps_parse_parsed_create();
fail_if(comps_parse_parsed_init(parsed, "UTF-8", 1) == 0);
fail_if(comps_parse_parsed_init(parsed, "UTF-8", 0) == 0);
fp = fopen("sample_comps.xml", "r");
comps_parse_file(parsed, fp, NULL);

Expand All @@ -307,7 +307,7 @@ START_TEST(test_comps_parse3)
COMPS_LogEntry* known_errors[3];
COMPS_Object *tmpobj;

fprintf(stderr, "## Running test_parse3\n\n");
fprintf(stderr, "## Running test_parse3\n");

known_errors[0] = __log_entry_x(COMPS_ERR_ELEM_REQUIRED, 3,
comps_str("id"), comps_num(188),
Expand All @@ -320,7 +320,7 @@ START_TEST(test_comps_parse3)
comps_num(188), comps_num(2));

parsed = comps_parse_parsed_create();
fail_if(comps_parse_parsed_init(parsed, "UTF-8", 1) == 0);
fail_if(comps_parse_parsed_init(parsed, "UTF-8", 0) == 0);
fp = fopen("sample_comps_bad1.xml", "r");
comps_parse_file(parsed, fp, NULL);

Expand Down Expand Up @@ -363,7 +363,7 @@ START_TEST(test_comps_parse4)
int i;
//COMPS_List * tmplist;
COMPS_LogEntry* known_errors[15];
fprintf(stderr, "## Running test_parse4\n\n");
fprintf(stderr, "## Running test_parse4\n");

known_errors[0] = __log_entry_x(COMPS_ERR_NOPARENT, 3, comps_str("id"),
comps_num(4), comps_num(2));
Expand Down Expand Up @@ -413,7 +413,7 @@ START_TEST(test_comps_parse4)
comps_num(1244), comps_num(4));

parsed = comps_parse_parsed_create();
fail_if(comps_parse_parsed_init(parsed, "UTF-8", 1) == 0);
fail_if(comps_parse_parsed_init(parsed, "UTF-8", 0) == 0);
fp = fopen("sample_comps_bad2.xml", "r");
comps_parse_file(parsed, fp, NULL);

Expand All @@ -435,7 +435,7 @@ START_TEST(test_comps_parse5)
//COMPS_ListItem *it;
//int ret
int i;
fprintf(stderr, "## Running test_parse5\n\n");
fprintf(stderr, "## Running test_parse5\n");
COMPS_LogEntry* known_errors[2];

known_errors[0] = __log_entry_x(COMPS_ERR_TEXT_BETWEEN, 3,
Expand All @@ -446,7 +446,7 @@ START_TEST(test_comps_parse5)
comps_num(2));

parsed = comps_parse_parsed_create();
fail_if(comps_parse_parsed_init(parsed, "UTF-8", 1) == 0);
fail_if(comps_parse_parsed_init(parsed, "UTF-8", 0) == 0);
fp = fopen("sample_comps_bad3.xml", "r");
comps_parse_file(parsed, fp, NULL);
//comps_log_print(parsed->log);
Expand Down
Loading