Fix comment fixup in pro2cmake

Comments should be removed before line continuations, otherwise
the semantics of an assignment change.
Found this during reconversion of qtimageformats.

Adjust test to specifically test for all the expected values.

Amends 76f5b784ce.

Change-Id: Iaa46bbc9cbd7b2390fe9b5f0078ac33d225a9258
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
This commit is contained in:
Alexandru Croitor 2019-06-06 10:31:03 +02:00
parent 89b7f76719
commit 4e907f1f62
2 changed files with 20 additions and 1 deletions

View File

@ -870,8 +870,8 @@ class QmakeParser:
contents = file_fd.read()
old_contents = contents
contents = fixup_linecontinuation(contents)
contents = fixup_comments(contents)
contents = fixup_linecontinuation(contents)
if old_contents != contents:
print('Warning: Fixed line continuation in .pro-file!\n'

View File

@ -308,6 +308,25 @@ def test_realworld_lc():
def test_realworld_lc_with_comment_in_between():
result = parse_file(_tests_path + '/data/lc_with_comment.pro')
my_var = result[1]['value'][0]
assert my_var == 'foo'
my_var = result[2]['value'][0]
assert my_var == 'foo2'
my_var = result[3]['value'][0]
assert my_var == 'foo3'
my_var = result[4]['value'][0]
assert my_var == 'foo4'
my_var = result[5]['value'][0]
assert my_var == 'foo5'
sub_dirs = result[0]['value']
assert sub_dirs[0] == 'tga'
assert sub_dirs[1] == 'wbmp'
assert len(result) == 6