mirror of
https://git.yoctoproject.org/poky
synced 2026-06-01 13:09:50 +00:00
bitbake: test/data: Add in test for append/prepend/remove override operations
We currently don't have test cases for _append, _prepend and _remove. This patch adds some basic tests and includes a test case for a recently reported issue with the _remove operator. (Bitbake rev: 93291bd90e18808c7a1c8c692949396bbc7e4348) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
@@ -213,6 +213,47 @@ class TestConcat(unittest.TestCase):
|
|||||||
self.d.appendVar("TEST", ":${BAR}")
|
self.d.appendVar("TEST", ":${BAR}")
|
||||||
self.assertEqual(self.d.getVar("TEST", True), "foo:val:val2:bar")
|
self.assertEqual(self.d.getVar("TEST", True), "foo:val:val2:bar")
|
||||||
|
|
||||||
|
class TestConcatOverride(unittest.TestCase):
|
||||||
|
def setUp(self):
|
||||||
|
self.d = bb.data.init()
|
||||||
|
self.d.setVar("FOO", "foo")
|
||||||
|
self.d.setVar("VAL", "val")
|
||||||
|
self.d.setVar("BAR", "bar")
|
||||||
|
|
||||||
|
def test_prepend(self):
|
||||||
|
self.d.setVar("TEST", "${VAL}")
|
||||||
|
self.d.setVar("TEST_prepend", "${FOO}:")
|
||||||
|
bb.data.update_data(self.d)
|
||||||
|
self.assertEqual(self.d.getVar("TEST", True), "foo:val")
|
||||||
|
|
||||||
|
def test_append(self):
|
||||||
|
self.d.setVar("TEST", "${VAL}")
|
||||||
|
self.d.setVar("TEST_append", ":${BAR}")
|
||||||
|
bb.data.update_data(self.d)
|
||||||
|
self.assertEqual(self.d.getVar("TEST", True), "val:bar")
|
||||||
|
|
||||||
|
def test_multiple_append(self):
|
||||||
|
self.d.setVar("TEST", "${VAL}")
|
||||||
|
self.d.setVar("TEST_prepend", "${FOO}:")
|
||||||
|
self.d.setVar("TEST_append", ":val2")
|
||||||
|
self.d.setVar("TEST_append", ":${BAR}")
|
||||||
|
bb.data.update_data(self.d)
|
||||||
|
self.assertEqual(self.d.getVar("TEST", True), "foo:val:val2:bar")
|
||||||
|
|
||||||
|
def test_remove(self):
|
||||||
|
self.d.setVar("TEST", "${VAL} ${BAR}")
|
||||||
|
self.d.setVar("TEST_remove", "val")
|
||||||
|
bb.data.update_data(self.d)
|
||||||
|
self.assertEqual(self.d.getVar("TEST", True), "bar")
|
||||||
|
|
||||||
|
def test_doubleref_remove(self):
|
||||||
|
self.d.setVar("TEST", "${VAL} ${BAR}")
|
||||||
|
self.d.setVar("TEST_remove", "val")
|
||||||
|
self.d.setVar("TEST_TEST", "${TEST} ${TEST}")
|
||||||
|
bb.data.update_data(self.d)
|
||||||
|
self.assertEqual(self.d.getVar("TEST_TEST", True), "bar bar")
|
||||||
|
|
||||||
|
|
||||||
class TestOverrides(unittest.TestCase):
|
class TestOverrides(unittest.TestCase):
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
self.d = bb.data.init()
|
self.d = bb.data.init()
|
||||||
|
|||||||
Reference in New Issue
Block a user