diff options
author | Steve Slaven <bpk@hoopajoo.net> | 2023-01-24 06:11:42 (GMT) |
---|---|---|
committer | Steve Slaven <bpk@hoopajoo.net> | 2023-01-24 06:11:42 (GMT) |
commit | e5419a02b2e84e2a792d8b385e099c85f1489cf4 (patch) | |
tree | b52e43fdb88bafa2fbac34d0e9c3383eac1ce587 | |
parent | 8f3f779bb96e1b8ee6a87ca13915eaa16ad754c8 (diff) | |
download | powwow-e5419a02b2e84e2a792d8b385e099c85f1489cf4.zip powwow-e5419a02b2e84e2a792d8b385e099c85f1489cf4.tar.gz powwow-e5419a02b2e84e2a792d8b385e099c85f1489cf4.tar.bz2 |
add tests for #substitute
-rw-r--r-- | src/prove.c | 41 |
1 files changed, 40 insertions, 1 deletions
diff --git a/src/prove.c b/src/prove.c index 38d6b7c..33757f3 100644 --- a/src/prove.c +++ b/src/prove.c @@ -265,7 +265,7 @@ static void TEST_mark_syntax_error() C_output_from_user_input_is( "#mark =bar", - "#marker must be non-null.\n", + "#marker must be non-empty.\n", "#mark - empty error"); C_output_from_user_input_is( @@ -394,6 +394,42 @@ static void TEST_mark() "#mark - all marks deleted"); } +static void TEST_substitute_syntax_error() +{ + C_output_from_user_input_contains( + "#substitute = ", + "#substitute must be non-empty.", + "#substitute - syntax error"); +} + +static void TEST_substitute() +{ + C_output_from_user_input_contains( + "#substitute foo=bar", + "#new substitution: foo=bar\n", + "#substitute - new substitute is created"); + + C_edit_from_user_input_is( + "#substitute foo", + "#substitute foo=bar", + "#substitute - substitute can be edited"); + + C_simulated_output_is( + "The word foo should be bar", + "The word bar should be bar", + "#substitute - foo should be bar"); + + C_output_from_user_input_is( + "#substitute foo=", + "#deleting substitution: foo=bar\n", + "#substitute - substitute is deleted"); + + C_simulated_output_is( + "The word foo should not be bar", + "The word foo should not be bar", + "#substitute - foo should not be bar"); +} + void prove() { _is_proving = 1; @@ -405,6 +441,9 @@ void prove() do_test(TEST_mark_reset_step2, "#mark reset step 2"); do_test(TEST_mark, "#mark usage"); + do_test(TEST_substitute_syntax_error, "#substitute syntax error"); + do_test(TEST_substitute, "#substitute usage"); + done_testing(); _is_proving = 0; |