wafsamba: Add tests for dict_concat.
authorJelmer Vernooij <jelmer@samba.org>
Sun, 12 Feb 2012 17:42:17 +0000 (18:42 +0100)
committerJelmer Vernooij <jelmer@samba.org>
Sun, 12 Feb 2012 19:17:54 +0000 (20:17 +0100)
Autobuild-User: Jelmer Vernooij <jelmer@samba.org>
Autobuild-Date: Sun Feb 12 20:17:54 CET 2012 on sn-devel-104

buildtools/wafsamba/tests/test_utils.py

index c40f71e..a9578e2 100644 (file)
@@ -18,6 +18,7 @@ from wafsamba.tests import TestCase
 
 from wafsamba.samba_utils import (
     TO_LIST,
+    dict_concat,
     subst_vars_error,
     unique_list,
     )
@@ -50,8 +51,26 @@ class UniqueListTests(TestCase):
 class SubstVarsErrorTests(TestCase):
 
     def test_valid(self):
-        self.assertEquals("", subst_vars_error(""))
+        self.assertEquals("", subst_vars_error("", {}))
         self.assertEquals("FOO bar", subst_vars_error("${F} bar", {"F": "FOO"}))
 
     def test_invalid(self):
         self.assertRaises(KeyError, subst_vars_error, "${F}", {})
+
+
+class DictConcatTests(TestCase):
+
+    def test_empty(self):
+        ret = {}
+        dict_concat(ret, {})
+        self.assertEquals({}, ret)
+
+    def test_same(self):
+        ret = {"foo": "bar"}
+        dict_concat(ret, {"foo": "bla"})
+        self.assertEquals({"foo": "bar"}, ret)
+
+    def test_simple(self):
+        ret = {"foo": "bar"}
+        dict_concat(ret, {"blie": "bla"})
+        self.assertEquals({"foo": "bar", "blie": "bla"}, ret)