diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2014-03-25 22:22:45 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2014-03-25 22:28:42 +0000 |
commit | 7ae43dcefa316bccf293233cdbd994f97796ab88 (patch) | |
tree | 9a4147a7394006944450edf1cac7e8a7de6cbc15 /bitbake/lib/bb/tests | |
parent | 7fa51314bdac0afccf2ddd6f57581eec7d78d57f (diff) | |
download | poky-7ae43dcefa316bccf293233cdbd994f97796ab88.tar.gz |
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>
Diffstat (limited to 'bitbake/lib/bb/tests')
-rw-r--r-- | bitbake/lib/bb/tests/data.py | 41 |
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 | ||
216 | class 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 | |||
216 | class TestOverrides(unittest.TestCase): | 257 | class TestOverrides(unittest.TestCase): |
217 | def setUp(self): | 258 | def setUp(self): |
218 | self.d = bb.data.init() | 259 | self.d = bb.data.init() |