diff --git a/tests.c b/tests.c index 82db8a5..7027801 100755 --- a/tests.c +++ b/tests.c @@ -26,7 +26,28 @@ Ensure(parse, simple_shortcode) char *input = "{{% shortcode %}}"; result = parse(input); chunk_s(input, result[0].name); + + // Only 1 shortcode + assert_that(result[1].name.len, is_equal_to(0)); + + // It's a simple one called shortcode, no args assert_that(s.s, is_equal_to_string("shortcode")); + assert_that(result[0].matching, is_equal_to(0)); + assert_that(result[0].argcount, is_equal_to(0)); +} + +Ensure(parse, matching_shortcode) +{ + char *input = "{{% shortcode %}}foo bar{{% /shortcode %}}"; + result = parse(input); + chunk_s(input, result[0].name); + + // Only 1 shortcode + // assert_that(result[1].name.len, is_equal_to(0)); + + // It's a matching one called shortcode, no args + assert_that(s.s, is_equal_to_string("shortcode")); + assert_that(result[0].matching, is_equal_to(1)); assert_that(result[0].argcount, is_equal_to(0)); } @@ -36,5 +57,6 @@ int main(int argc, char **argv) TestSuite *suite = create_test_suite(); add_test_with_context(suite, parse, empty_string); add_test_with_context(suite, parse, simple_shortcode); + add_test_with_context(suite, parse, matching_shortcode); return run_test_suite(suite, create_text_reporter()); }