[Nagiosplug-checkins] nagiosplug/plugins/tests test_utils.c,1.3,1.4

Ton Voon tonvoon at users.sourceforge.net
Wed Mar 29 08:34:08 CEST 2006


Update of /cvsroot/nagiosplug/nagiosplug/plugins/tests
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16894/plugins/tests

Modified Files:
	test_utils.c 
Log Message:
New function to for escaped strings from command line for send/quit.
Adapted from Sebastian Wiesinger's patch (1292404)


Index: test_utils.c
===================================================================
RCS file: /cvsroot/nagiosplug/nagiosplug/plugins/tests/test_utils.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- test_utils.c	31 Jan 2006 14:36:23 -0000	1.3
+++ test_utils.c	29 Mar 2006 16:33:36 -0000	1.4
@@ -34,7 +34,7 @@
 	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 @@
 	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();
 }
 





More information about the Commits mailing list