diff options
| -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; | 
