Skip to content
This repository has been archived by the owner on Feb 20, 2018. It is now read-only.

Commit

Permalink
add scanner test for end of template
Browse files Browse the repository at this point in the history
  • Loading branch information
mrtazz committed Dec 6, 2011
1 parent e834386 commit bc0ccf0
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions tests/test_chinstrap_scanner.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,20 @@ START_TEST (test_scanner_get_char_with_newline)
fail_unless(t.col == 1);
fail_unless(t.cargo == 'b');
}
END_TEST

#include<stdio.h>
START_TEST (test_scanner_reach_end_of_template)
{
const char foo[6] = { 'f', 'o', 'o', '\0', 7, 7};
scanner s = scanner_init(foo, 3);
get_char(&s);
get_char(&s);
get_char(&s);
get_char(&s);
scanner_token t = get_char(&s);
fail_unless(t.cargo == '\0');
}

END_TEST
Suite *
Expand All @@ -69,6 +83,7 @@ scanner_suite (void)
tcase_add_test (tc_core, test_scanner_init_without_length);
tcase_add_test (tc_core, test_scanner_get_char);
tcase_add_test (tc_core, test_scanner_get_char_with_newline);
tcase_add_test (tc_core, test_scanner_reach_end_of_template);
suite_add_tcase (s, tc_core);

return s;
Expand Down

0 comments on commit bc0ccf0

Please sign in to comment.