diff options
author | Ton Voon <tonvoon@users.sourceforge.net> | 2006-03-29 16:33:36 +0000 |
---|---|---|
committer | Ton Voon <tonvoon@users.sourceforge.net> | 2006-03-29 16:33:36 +0000 |
commit | f5c1cf6dd406be0b795f7388617d5469c6a358be (patch) | |
tree | 841b908d652b621846457a1e46f12c397a315286 /plugins/tests | |
parent | a0f387467691292fe62c66e56fbc8476c7ecbb2d (diff) | |
download | monitoring-plugins-f5c1cf6dd406be0b795f7388617d5469c6a358be.tar.gz |
New function to for escaped strings from command line for send/quit.
Adapted from Sebastian Wiesinger's patch (1292404)
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1365 f882894a-f735-0410-b71e-b25c423dba1c
Diffstat (limited to 'plugins/tests')
-rw-r--r-- | plugins/tests/test_utils.c | 31 |
1 files changed, 30 insertions, 1 deletions
diff --git a/plugins/tests/test_utils.c b/plugins/tests/test_utils.c index 27e28c75..5aa0028a 100644 --- a/plugins/tests/test_utils.c +++ b/plugins/tests/test_utils.c @@ -34,7 +34,7 @@ main (int argc, char **argv) thresholds *thresholds = NULL; int rc; - plan_tests(66); + plan_tests(73); range = parse_range_string("6"); ok( range != NULL, "'6' is valid range"); @@ -136,6 +136,35 @@ main (int argc, char **argv) ok( get_status(30.0001, thresholds) == STATE_WARNING, "30.0001 - warning"); ok( get_status(69, thresholds) == STATE_CRITICAL, "69 - critical"); + char *test; + test = np_escaped_string("bob\\n"); + ok( strcmp(test, "bob\n") == 0, "bob\\n ok"); + free(test); + + test = np_escaped_string("rhuba\\rb"); + ok( strcmp(test, "rhuba\rb") == 0, "rhuba\\rb okay"); + free(test); + + test = np_escaped_string("ba\\nge\\r"); + ok( strcmp(test, "ba\nge\r") == 0, "ba\\nge\\r okay"); + free(test); + + test = np_escaped_string("\\rabbi\\t"); + ok( strcmp(test, "\rabbi\t") == 0, "\\rabbi\\t okay"); + free(test); + + test = np_escaped_string("and\\\\or"); + ok( strcmp(test, "and\\or") == 0, "and\\\\or okay"); + free(test); + + test = np_escaped_string("bo\\gus"); + ok( strcmp(test, "bogus") == 0, "bo\\gus okay"); + free(test); + + test = np_escaped_string("everything"); + ok( strcmp(test, "everything") == 0, "everything okay"); + free(test); + return exit_status(); } |