Basic tests passing
This commit is contained in:
parent
5110de2042
commit
64053c3f37
22
tests.c
22
tests.c
@ -26,7 +26,28 @@ Ensure(parse, simple_shortcode)
|
|||||||
char *input = "{{% shortcode %}}";
|
char *input = "{{% shortcode %}}";
|
||||||
result = parse(input);
|
result = parse(input);
|
||||||
chunk_s(input, result[0].name);
|
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(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));
|
assert_that(result[0].argcount, is_equal_to(0));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -36,5 +57,6 @@ int main(int argc, char **argv)
|
|||||||
TestSuite *suite = create_test_suite();
|
TestSuite *suite = create_test_suite();
|
||||||
add_test_with_context(suite, parse, empty_string);
|
add_test_with_context(suite, parse, empty_string);
|
||||||
add_test_with_context(suite, parse, simple_shortcode);
|
add_test_with_context(suite, parse, simple_shortcode);
|
||||||
|
add_test_with_context(suite, parse, matching_shortcode);
|
||||||
return run_test_suite(suite, create_text_reporter());
|
return run_test_suite(suite, create_text_reporter());
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user