diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2015-05-26 16:18:43 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2015-05-29 10:17:16 +0100 |
commit | 553267d8d9a732dd1d382cc25077b49caae29af6 (patch) | |
tree | a6b0163c983ca180a23c0cc45bde66746693c8cb /bitbake/lib/bb/tests | |
parent | bde0f60971c3c9b758b31fae7cf243e70b3833ff (diff) | |
download | poky-553267d8d9a732dd1d382cc25077b49caae29af6.tar.gz |
bitbake: tests/data: Add key expansion unit test
This ensures basic key expansion works and that overlapping
keys generate a log message.
(Bitbake rev: ed5a8954ac923eda9750a636c5bb5b95ffce664f)
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 | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/bitbake/lib/bb/tests/data.py b/bitbake/lib/bb/tests/data.py index b4e90e0327..e285c223dc 100644 --- a/bitbake/lib/bb/tests/data.py +++ b/bitbake/lib/bb/tests/data.py | |||
@@ -325,6 +325,20 @@ class TestOverrides(unittest.TestCase): | |||
325 | bb.data.update_data(self.d) | 325 | bb.data.update_data(self.d) |
326 | self.assertEqual(self.d.getVar("TEST", True), "testvalue3") | 326 | self.assertEqual(self.d.getVar("TEST", True), "testvalue3") |
327 | 327 | ||
328 | class TestKeyExpansion(unittest.TestCase): | ||
329 | def setUp(self): | ||
330 | self.d = bb.data.init() | ||
331 | self.d.setVar("FOO", "foo") | ||
332 | self.d.setVar("BAR", "foo") | ||
333 | |||
334 | def test_keyexpand(self): | ||
335 | self.d.setVar("VAL_${FOO}", "A") | ||
336 | self.d.setVar("VAL_${BAR}", "B") | ||
337 | with LogRecord() as logs: | ||
338 | bb.data.expandKeys(self.d) | ||
339 | self.assertTrue(logContains("Variable key VAL_${FOO} (A) replaces original key VAL_foo (B)", logs)) | ||
340 | self.assertEqual(self.d.getVar("VAL_foo", True), "A") | ||
341 | |||
328 | class TestFlags(unittest.TestCase): | 342 | class TestFlags(unittest.TestCase): |
329 | def setUp(self): | 343 | def setUp(self): |
330 | self.d = bb.data.init() | 344 | self.d = bb.data.init() |