diff options
Diffstat (limited to 'bitbake/lib/bb')
-rw-r--r-- | bitbake/lib/bb/tests/utils.py | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/bitbake/lib/bb/tests/utils.py b/bitbake/lib/bb/tests/utils.py index 6ded4dfd13..2f4ccf3c62 100644 --- a/bitbake/lib/bb/tests/utils.py +++ b/bitbake/lib/bb/tests/utils.py | |||
@@ -23,6 +23,7 @@ import unittest | |||
23 | import bb | 23 | import bb |
24 | import os | 24 | import os |
25 | import tempfile | 25 | import tempfile |
26 | import re | ||
26 | 27 | ||
27 | class VerCmpString(unittest.TestCase): | 28 | class VerCmpString(unittest.TestCase): |
28 | 29 | ||
@@ -377,6 +378,27 @@ do_functionname() { | |||
377 | self.assertTrue(updated, 'List should be updated but isn\'t') | 378 | self.assertTrue(updated, 'List should be updated but isn\'t') |
378 | self.assertEqual(newlines, newfile5.splitlines(True)) | 379 | self.assertEqual(newlines, newfile5.splitlines(True)) |
379 | 380 | ||
381 | # Make sure the orig value matches what we expect it to be | ||
382 | def test_edit_metadata_origvalue(self): | ||
383 | origfile = """ | ||
384 | MULTILINE = " stuff \\ | ||
385 | morestuff" | ||
386 | """ | ||
387 | expected_value = "stuff morestuff" | ||
388 | global value_in_callback | ||
389 | value_in_callback = "" | ||
390 | |||
391 | def handle_var(varname, origvalue, op, newlines): | ||
392 | global value_in_callback | ||
393 | value_in_callback = origvalue | ||
394 | return (origvalue, op, -1, False) | ||
395 | |||
396 | bb.utils.edit_metadata(origfile.splitlines(True), | ||
397 | ['MULTILINE'], | ||
398 | handle_var) | ||
399 | |||
400 | testvalue = re.sub('\s+', ' ', value_in_callback.strip()) | ||
401 | self.assertEqual(expected_value, testvalue) | ||
380 | 402 | ||
381 | class EditBbLayersConf(unittest.TestCase): | 403 | class EditBbLayersConf(unittest.TestCase): |
382 | 404 | ||