diff options
| author | Rafael G. Martins <rafael@rafaelmartins.eng.br> | 2015-04-16 00:03:22 -0300 | 
|---|---|---|
| committer | Rafael G. Martins <rafael@rafaelmartins.eng.br> | 2015-04-16 00:03:22 -0300 | 
| commit | ba0fc1f4f30856a45307a12a985f6a5b1de3204a (patch) | |
| tree | cb9b73e45fad3e9f425870c7d164baa267ee6be9 /tests | |
| parent | 63602a4fcf3e811e529ed5b7ba670764d29fc96b (diff) | |
| download | blogc-ba0fc1f4f30856a45307a12a985f6a5b1de3204a.tar.gz blogc-ba0fc1f4f30856a45307a12a985f6a5b1de3204a.tar.bz2 blogc-ba0fc1f4f30856a45307a12a985f6a5b1de3204a.zip  | |
added source test
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/check_source_grammar.c | 25 | 
1 files changed, 25 insertions, 0 deletions
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);  }  | 
