Basic tests passing

This commit is contained in:
Roberto Alsina 2023-07-12 16:49:46 -03:00
parent 5110de2042
commit 64053c3f37
1 changed files with 22 additions and 0 deletions

22
tests.c
View File

@ -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());
}