summaryrefslogtreecommitdiffstats
path: root/lib/bb/tests
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2015-05-26 16:18:43 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-05-29 10:14:39 +0100
commited5a8954ac923eda9750a636c5bb5b95ffce664f (patch)
treefc018d2aaf5d16d31b4f0e415fe50517d114106c /lib/bb/tests
parentb30ee0aba51a35a194a4338b988f93ece1ed281c (diff)
downloadbitbake-contrib-ed5a8954ac923eda9750a636c5bb5b95ffce664f.tar.gz
tests/data: Add key expansion unit test
This ensures basic key expansion works and that overlapping keys generate a log message. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'lib/bb/tests')
-rw-r--r--lib/bb/tests/data.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/bb/tests/data.py b/lib/bb/tests/data.py
index b4e90e032..e285c223d 100644
--- a/lib/bb/tests/data.py
+++ b/lib/bb/tests/data.py
@@ -325,6 +325,20 @@ class TestOverrides(unittest.TestCase):
bb.data.update_data(self.d)
self.assertEqual(self.d.getVar("TEST", True), "testvalue3")
+class TestKeyExpansion(unittest.TestCase):
+ def setUp(self):
+ self.d = bb.data.init()
+ self.d.setVar("FOO", "foo")
+ self.d.setVar("BAR", "foo")
+
+ def test_keyexpand(self):
+ self.d.setVar("VAL_${FOO}", "A")
+ self.d.setVar("VAL_${BAR}", "B")
+ with LogRecord() as logs:
+ bb.data.expandKeys(self.d)
+ self.assertTrue(logContains("Variable key VAL_${FOO} (A) replaces original key VAL_foo (B)", logs))
+ self.assertEqual(self.d.getVar("VAL_foo", True), "A")
+
class TestFlags(unittest.TestCase):
def setUp(self):
self.d = bb.data.init()