def test_raises_parse_error(self):
    self.add_to_build_file('BUILD', 'foo(name = = "baz")')
    build_file = BuildFile(FileSystemProjectTree(self.build_root), 'BUILD')
    with self.assertRaises(BuildFileParser.ParseError):
        self.build_file_parser.parse_build_file(build_file)
    build_file = self.add_to_build_file('begin/BUILD', dedent("\n      *?&INVALID! = 'foo'\n      target(\n        name='bar',\n        dependencies= [\n          ':baz',\n        ],\n      )\n      "))
    with self.assertRaises(BuildFileParser.ParseError):
        self.build_file_parser.parse_build_file(build_file)
    build_file = self.add_to_build_file('end/BUILD', dedent("\n      target(\n        name='bar',\n        dependencies= [\n          ':baz',\n        ],\n      )\n      *?&INVALID! = 'foo'\n      "))
    with self.assertRaises(BuildFileParser.ParseError):
        self.build_file_parser.parse_build_file(build_file)
    build_file = self.add_to_build_file('middle/BUILD', dedent("\n      target(\n        name='bar',\n\n              *?&INVALID! = 'foo'\n\n        dependencies = [\n          ':baz',\n        ],\n      )\n      "))
    with self.assertRaises(BuildFileParser.ParseError):
        self.build_file_parser.parse_build_file(build_file)
    build_file = self.add_to_build_file('short/BUILD', dedent("\n      target(name='bar', dependencies = [':baz'],) *?&INVALID! = 'foo'\n      "))
    with self.assertRaises(BuildFileParser.ParseError):
        self.build_file_parser.parse_build_file(build_file)
def test_raises_parse_error(self):
    self.add_to_build_file('BUILD', 'foo(name = = "baz")')
    build_file = BuildFile(FileSystemProjectTree(self.build_root), 'BUILD')
    with self.assertRaises(BuildFileParser.ParseError):
        self.build_file_parser.parse_build_file(build_file)
    build_file = self.add_to_build_file('begin/BUILD', dedent("\n      *?&INVALID! = 'foo'\n      target(\n        name='bar',\n        dependencies= [\n          ':baz',\n        ],\n      )\n      "))
    with self.assertRaises(BuildFileParser.ParseError):
        self.build_file_parser.parse_build_file(build_file)
    build_file = self.add_to_build_file('end/BUILD', dedent("\n      target(\n        name='bar',\n        dependencies= [\n          ':baz',\n        ],\n      )\n      *?&INVALID! = 'foo'\n      "))
    with self.assertRaises(BuildFileParser.ParseError):
        self.build_file_parser.parse_build_file(build_file)
    build_file = self.add_to_build_file('middle/BUILD', dedent("\n      target(\n        name='bar',\n\n              *?&INVALID! = 'foo'\n\n        dependencies = [\n          ':baz',\n        ],\n      )\n      "))
    with self.assertRaises(BuildFileParser.ParseError):
        self.build_file_parser.parse_build_file(build_file)
    build_file = self.add_to_build_file('short/BUILD', dedent("\n      target(name='bar', dependencies = [':baz'],) *?&INVALID! = 'foo'\n      "))
    with self.assertRaises(BuildFileParser.ParseError):
        self.build_file_parser.parse_build_file(build_file)