diff --git a/gn_helper.py b/gn_helper.py index fedc9e0ef..29e8e49b0 100644 --- a/gn_helper.py +++ b/gn_helper.py @@ -48,7 +48,7 @@ def lines(output_dir): yield line_without_comment -_gn_arg_pattern = re.compile(r"(^|\s)([^=\s]*)\s*=\s*(\S*)\s*$") +_gn_arg_pattern = re.compile(r"(^|\s*)([^=\s]*)\s*=\s*(\S*)\s*$") def args(output_dir): diff --git a/tests/gn_helper_test.py b/tests/gn_helper_test.py index 9c03f60eb..f85cce424 100644 --- a/tests/gn_helper_test.py +++ b/tests/gn_helper_test.py @@ -67,6 +67,21 @@ class GnHelperTest(trial_dir.TestCase): ('use_remoteexec', 'true'), ]) + def test_args_spaces(self): + out_dir = os.path.join('out', 'dir') + # Make sure nested import directives work. This is based on the + # reclient test. + write(os.path.join(out_dir, 'args.gn'), 'import("//out/common.gni")') + write(os.path.join('out', 'common.gni'), 'import("common_2.gni")') + write(os.path.join('out', 'common_2.gni'), ' use_remoteexec = true ') + + lines = list(gn_helper.args(out_dir)) + + # The test will only pass if both imports work and + # 'use_remoteexec=true' is seen. + self.assertListEqual(lines, [ + ('use_remoteexec', 'true'), + ]) if __name__ == '__main__': unittest.main()