summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bitbake/lib/bb/tests/data.py41
1 files changed, 41 insertions, 0 deletions
diff --git a/bitbake/lib/bb/tests/data.py b/bitbake/lib/bb/tests/data.py
index 6ec27367e9..ee66b22e25 100644
--- a/bitbake/lib/bb/tests/data.py
+++ b/bitbake/lib/bb/tests/data.py
@@ -213,6 +213,47 @@ class TestConcat(unittest.TestCase):
213 self.d.appendVar("TEST", ":${BAR}") 213 self.d.appendVar("TEST", ":${BAR}")
214 self.assertEqual(self.d.getVar("TEST", True), "foo:val:val2:bar") 214 self.assertEqual(self.d.getVar("TEST", True), "foo:val:val2:bar")
215 215
216class TestConcatOverride(unittest.TestCase):
217 def setUp(self):
218 self.d = bb.data.init()
219 self.d.setVar("FOO", "foo")
220 self.d.setVar("VAL", "val")
221 self.d.setVar("BAR", "bar")
222
223 def test_prepend(self):
224 self.d.setVar("TEST", "${VAL}")
225 self.d.setVar("TEST_prepend", "${FOO}:")
226 bb.data.update_data(self.d)
227 self.assertEqual(self.d.getVar("TEST", True), "foo:val")
228
229 def test_append(self):
230 self.d.setVar("TEST", "${VAL}")
231 self.d.setVar("TEST_append", ":${BAR}")
232 bb.data.update_data(self.d)
233 self.assertEqual(self.d.getVar("TEST", True), "val:bar")
234
235 def test_multiple_append(self):
236 self.d.setVar("TEST", "${VAL}")
237 self.d.setVar("TEST_prepend", "${FOO}:")
238 self.d.setVar("TEST_append", ":val2")
239 self.d.setVar("TEST_append", ":${BAR}")
240 bb.data.update_data(self.d)
241 self.assertEqual(self.d.getVar("TEST", True), "foo:val:val2:bar")
242
243 def test_remove(self):
244 self.d.setVar("TEST", "${VAL} ${BAR}")
245 self.d.setVar("TEST_remove", "val")
246 bb.data.update_data(self.d)
247 self.assertEqual(self.d.getVar("TEST", True), "bar")
248
249 def test_doubleref_remove(self):
250 self.d.setVar("TEST", "${VAL} ${BAR}")
251 self.d.setVar("TEST_remove", "val")
252 self.d.setVar("TEST_TEST", "${TEST} ${TEST}")
253 bb.data.update_data(self.d)
254 self.assertEqual(self.d.getVar("TEST_TEST", True), "bar bar")
255
256
216class TestOverrides(unittest.TestCase): 257class TestOverrides(unittest.TestCase):
217 def setUp(self): 258 def setUp(self):
218 self.d = bb.data.init() 259 self.d = bb.data.init()