diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2013-09-21 10:44:16 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2013-09-22 12:19:45 +0100 |
commit | d4b9713ec6e37dd49658cbaa113379f4e11ca396 (patch) | |
tree | 6939a6200c48b5706e6cf65646c45537579d93e5 /bitbake/lib/bb/tests | |
parent | d9955a14fa8758c538caef5045faa96273126776 (diff) | |
download | poky-d4b9713ec6e37dd49658cbaa113379f4e11ca396.tar.gz |
bitbake: tests/data: Whitespace in key names is a really bad idea
The parser never has supported it, the datastore API did happen to work
but whitespace in key names is a really bad idea and not something I think we
should encourage or support.
Fix test case failures after excplitly ignoring it for variable expansion
purposes.
(Bitbake rev: a2074ddaba6f53962d6caf34dbd27bdbc259935b)
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 | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/bitbake/lib/bb/tests/data.py b/bitbake/lib/bb/tests/data.py index 516158661a..f281a353f4 100644 --- a/bitbake/lib/bb/tests/data.py +++ b/bitbake/lib/bb/tests/data.py | |||
@@ -27,21 +27,21 @@ import bb.data | |||
27 | class DataExpansions(unittest.TestCase): | 27 | class DataExpansions(unittest.TestCase): |
28 | def setUp(self): | 28 | def setUp(self): |
29 | self.d = bb.data.init() | 29 | self.d = bb.data.init() |
30 | self.d["foo"] = "value of foo" | 30 | self.d["foo"] = "value_of_foo" |
31 | self.d["bar"] = "value of bar" | 31 | self.d["bar"] = "value_of_bar" |
32 | self.d["value of foo"] = "value of 'value of foo'" | 32 | self.d["value_of_foo"] = "value_of_'value_of_foo'" |
33 | 33 | ||
34 | def test_one_var(self): | 34 | def test_one_var(self): |
35 | val = self.d.expand("${foo}") | 35 | val = self.d.expand("${foo}") |
36 | self.assertEqual(str(val), "value of foo") | 36 | self.assertEqual(str(val), "value_of_foo") |
37 | 37 | ||
38 | def test_indirect_one_var(self): | 38 | def test_indirect_one_var(self): |
39 | val = self.d.expand("${${foo}}") | 39 | val = self.d.expand("${${foo}}") |
40 | self.assertEqual(str(val), "value of 'value of foo'") | 40 | self.assertEqual(str(val), "value_of_'value_of_foo'") |
41 | 41 | ||
42 | def test_indirect_and_another(self): | 42 | def test_indirect_and_another(self): |
43 | val = self.d.expand("${${foo}} ${bar}") | 43 | val = self.d.expand("${${foo}} ${bar}") |
44 | self.assertEqual(str(val), "value of 'value of foo' value of bar") | 44 | self.assertEqual(str(val), "value_of_'value_of_foo' value_of_bar") |
45 | 45 | ||
46 | def test_python_snippet(self): | 46 | def test_python_snippet(self): |
47 | val = self.d.expand("${@5*12}") | 47 | val = self.d.expand("${@5*12}") |
@@ -49,11 +49,11 @@ class DataExpansions(unittest.TestCase): | |||
49 | 49 | ||
50 | def test_expand_in_python_snippet(self): | 50 | def test_expand_in_python_snippet(self): |
51 | val = self.d.expand("${@'boo ' + '${foo}'}") | 51 | val = self.d.expand("${@'boo ' + '${foo}'}") |
52 | self.assertEqual(str(val), "boo value of foo") | 52 | self.assertEqual(str(val), "boo value_of_foo") |
53 | 53 | ||
54 | def test_python_snippet_getvar(self): | 54 | def test_python_snippet_getvar(self): |
55 | val = self.d.expand("${@d.getVar('foo', True) + ' ${bar}'}") | 55 | val = self.d.expand("${@d.getVar('foo', True) + ' ${bar}'}") |
56 | self.assertEqual(str(val), "value of foo value of bar") | 56 | self.assertEqual(str(val), "value_of_foo value_of_bar") |
57 | 57 | ||
58 | def test_python_snippet_syntax_error(self): | 58 | def test_python_snippet_syntax_error(self): |
59 | self.d.setVar("FOO", "${@foo = 5}") | 59 | self.d.setVar("FOO", "${@foo = 5}") |
@@ -70,7 +70,7 @@ class DataExpansions(unittest.TestCase): | |||
70 | 70 | ||
71 | def test_value_containing_value(self): | 71 | def test_value_containing_value(self): |
72 | val = self.d.expand("${@d.getVar('foo', True) + ' ${bar}'}") | 72 | val = self.d.expand("${@d.getVar('foo', True) + ' ${bar}'}") |
73 | self.assertEqual(str(val), "value of foo value of bar") | 73 | self.assertEqual(str(val), "value_of_foo value_of_bar") |
74 | 74 | ||
75 | def test_reference_undefined_var(self): | 75 | def test_reference_undefined_var(self): |
76 | val = self.d.expand("${undefinedvar} meh") | 76 | val = self.d.expand("${undefinedvar} meh") |
@@ -109,7 +109,7 @@ class DataExpansions(unittest.TestCase): | |||
109 | 109 | ||
110 | def test_rename(self): | 110 | def test_rename(self): |
111 | self.d.renameVar("foo", "newfoo") | 111 | self.d.renameVar("foo", "newfoo") |
112 | self.assertEqual(self.d.getVar("newfoo"), "value of foo") | 112 | self.assertEqual(self.d.getVar("newfoo"), "value_of_foo") |
113 | self.assertEqual(self.d.getVar("foo"), None) | 113 | self.assertEqual(self.d.getVar("foo"), None) |
114 | 114 | ||
115 | def test_deletion(self): | 115 | def test_deletion(self): |
@@ -118,17 +118,17 @@ class DataExpansions(unittest.TestCase): | |||
118 | 118 | ||
119 | def test_keys(self): | 119 | def test_keys(self): |
120 | keys = self.d.keys() | 120 | keys = self.d.keys() |
121 | self.assertEqual(keys, ['value of foo', 'foo', 'bar']) | 121 | self.assertEqual(keys, ['value_of_foo', 'foo', 'bar']) |
122 | 122 | ||
123 | class TestNestedExpansions(unittest.TestCase): | 123 | class TestNestedExpansions(unittest.TestCase): |
124 | def setUp(self): | 124 | def setUp(self): |
125 | self.d = bb.data.init() | 125 | self.d = bb.data.init() |
126 | self.d["foo"] = "foo" | 126 | self.d["foo"] = "foo" |
127 | self.d["bar"] = "bar" | 127 | self.d["bar"] = "bar" |
128 | self.d["value of foobar"] = "187" | 128 | self.d["value_of_foobar"] = "187" |
129 | 129 | ||
130 | def test_refs(self): | 130 | def test_refs(self): |
131 | val = self.d.expand("${value of ${foo}${bar}}") | 131 | val = self.d.expand("${value_of_${foo}${bar}}") |
132 | self.assertEqual(str(val), "187") | 132 | self.assertEqual(str(val), "187") |
133 | 133 | ||
134 | #def test_python_refs(self): | 134 | #def test_python_refs(self): |
@@ -154,11 +154,11 @@ class TestNestedExpansions(unittest.TestCase): | |||
154 | # self.assertEqual(str(val), str(depth + 1)) | 154 | # self.assertEqual(str(val), str(depth + 1)) |
155 | 155 | ||
156 | def test_mixed(self): | 156 | def test_mixed(self): |
157 | val = self.d.expand("${value of ${@('${foo}'+'bar')[0:3]}${${@'BAR'.lower()}}}") | 157 | val = self.d.expand("${value_of_${@('${foo}'+'bar')[0:3]}${${@'BAR'.lower()}}}") |
158 | self.assertEqual(str(val), "187") | 158 | self.assertEqual(str(val), "187") |
159 | 159 | ||
160 | def test_runtime(self): | 160 | def test_runtime(self): |
161 | val = self.d.expand("${${@'value of' + ' f'+'o'+'o'+'b'+'a'+'r'}}") | 161 | val = self.d.expand("${${@'value_of' + '_f'+'o'+'o'+'b'+'a'+'r'}}") |
162 | self.assertEqual(str(val), "187") | 162 | self.assertEqual(str(val), "187") |
163 | 163 | ||
164 | class TestMemoize(unittest.TestCase): | 164 | class TestMemoize(unittest.TestCase): |