test/make/TestMakeBase.gmk
changeset 32553 418e3b5ff477
parent 30095 0034766ccb09
child 32807 20386e6d858f
--- a/test/make/TestMakeBase.gmk	Wed Jul 05 20:49:25 2017 +0200
+++ b/test/make/TestMakeBase.gmk	Tue Sep 15 18:00:21 2015 +0200
@@ -73,6 +73,37 @@
 TEST_TARGETS += $(ESCAPE_DOLLAR_DIR)/_escape_dollar
 
 ################################################################################
+# Test containing and not-containing
+
+CONT_LIST := foo bar baz foobar foobaz
+
+# Param 1 - string to look for
+# Param 2 - expected result
+define TestContaining
+  value := $$(call containing, $1, $(CONT_LIST))
+  ifneq ($$(value), $2)
+    $$(info (call containing, $1, $(CONT_LIST)))
+    $$(error result >$$(value)<, expected >$2<)
+  endif
+endef
+
+$(eval $(call TestContaining,bar,bar foobar))
+$(eval $(call TestContaining,foo bar,foo bar foobar foobaz))
+
+# Param 1 - string to look for
+# Param 2 - expected result
+define TestNotContaining
+  value := $$(call not-containing, $1, $(CONT_LIST))
+  ifneq ($$(value), $2)
+    $$(info (call not-containing, $1, $(CONT_LIST)))
+    $$(error result >$$(value)<, expected >$2<)
+  endif
+endef
+
+$(eval $(call TestNotContaining,bar,foo baz foobaz))
+$(eval $(call TestNotContaining,foo bar,baz))
+
+################################################################################
 # Test Equals
 
 EQUALS_VALUE1 := value1$(SPACE)