mirror of
https://gitlab.gnome.org/jwestman/blueprint-compiler.git
synced 2025-05-04 15:59:08 -04:00
Simplify error & warning handling
This commit is contained in:
parent
122b049ce9
commit
b6ee649458
8 changed files with 38 additions and 21 deletions
|
@ -26,7 +26,7 @@ def fuzz(buf):
|
|||
ast, errors, warnings = parser.parse(tokens)
|
||||
|
||||
xml = XmlOutput()
|
||||
if errors is None and len(ast.errors) == 0:
|
||||
if errors is None and ast is not None:
|
||||
xml.emit(ast)
|
||||
except CompilerBugError as e:
|
||||
raise e
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
using Gtk 4.0;
|
||||
|
||||
menu {
|
||||
menu menu {
|
||||
not-allowed: true;
|
||||
}
|
|
@ -57,8 +57,6 @@ class TestSamples(unittest.TestCase):
|
|||
|
||||
if errors:
|
||||
raise errors
|
||||
if len(ast.errors):
|
||||
raise MultipleErrors(ast.errors)
|
||||
if len(warnings):
|
||||
raise MultipleErrors(warnings)
|
||||
|
||||
|
@ -94,8 +92,9 @@ class TestSamples(unittest.TestCase):
|
|||
tokens = tokenizer.tokenize(blueprint)
|
||||
ast, errors, warnings = parser.parse(tokens)
|
||||
|
||||
self.assert_docs_dont_crash(blueprint, ast)
|
||||
self.assert_completions_dont_crash(blueprint, ast, tokens)
|
||||
if ast is not None:
|
||||
self.assert_docs_dont_crash(blueprint, ast)
|
||||
self.assert_completions_dont_crash(blueprint, ast, tokens)
|
||||
|
||||
if errors:
|
||||
raise errors
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue