From ba0fc1f4f30856a45307a12a985f6a5b1de3204a Mon Sep 17 00:00:00 2001 From: "Rafael G. Martins" Date: Thu, 16 Apr 2015 00:03:22 -0300 Subject: added source test --- tests/check_source_grammar.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/tests/check_source_grammar.c b/tests/check_source_grammar.c index a80be8e..b2f581b 100644 --- a/tests/check_source_grammar.c +++ b/tests/check_source_grammar.c @@ -39,11 +39,36 @@ test_source_parse(void **state) } +static void +test_source_parse_with_spaces(void **state) +{ + blogc_source_t *source = blogc_source_parse( + "\n \n" + "VAR1: chunda \t \n" + "\n\n" + "BOLA: guda\n" + "----------\n" + "# This is a test\n" + "\n" + "bola\n"); + assert_non_null(source); + assert_int_equal(b_trie_size(source->config), 2); + assert_string_equal(b_trie_lookup(source->config, "VAR1"), "chunda"); + assert_string_equal(b_trie_lookup(source->config, "BOLA"), "guda"); + assert_string_equal(source->content, + "# This is a test\n" + "\n" + "bola\n"); + blogc_source_free(source); +} + + int main(void) { const UnitTest tests[] = { unit_test(test_source_parse), + unit_test(test_source_parse_with_spaces), }; return run_tests(tests); } -- cgit v1.2.3-18-g5258