mirror of
https://gitlab.gnome.org/jwestman/blueprint-compiler.git
synced 2025-05-04 15:59:08 -04:00
Separate output into its own module
This commit is contained in:
parent
8cf793023d
commit
a24f16109f
33 changed files with 407 additions and 291 deletions
|
@ -1,6 +1,8 @@
|
|||
import os, sys
|
||||
from pythonfuzz.main import PythonFuzz
|
||||
|
||||
from blueprintcompiler.outputs.xml import XmlOutput
|
||||
|
||||
sys.path.insert(0, os.path.dirname(os.path.dirname(__file__)))
|
||||
|
||||
from blueprintcompiler import tokenizer, parser, decompiler, gir
|
||||
|
@ -17,8 +19,9 @@ def fuzz(buf):
|
|||
tokens = tokenizer.tokenize(blueprint)
|
||||
ast, errors, warnings = parser.parse(tokens)
|
||||
|
||||
xml = XmlOutput()
|
||||
if errors is None and len(ast.errors) == 0:
|
||||
actual = ast.generate()
|
||||
xml.emit(ast)
|
||||
except CompilerBugError as e:
|
||||
raise e
|
||||
except PrintableError:
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<signal name="activate" handler="click" object="button"/>
|
||||
</object>
|
||||
<object class="GtkButton" id="button">
|
||||
<signal name="clicked" handler="on_button_clicked" swapped="true"/>
|
||||
<signal name="clicked" handler="on_button_clicked" swapped="True"/>
|
||||
<signal name="notify::visible" handler="on_button_notify_visible"/>
|
||||
</object>
|
||||
</interface>
|
||||
|
|
|
@ -28,6 +28,7 @@ from blueprintcompiler.completions import complete
|
|||
from blueprintcompiler.errors import PrintableError, MultipleErrors, CompileError
|
||||
from blueprintcompiler.tokenizer import Token, TokenType, tokenize
|
||||
from blueprintcompiler import utils
|
||||
from blueprintcompiler.outputs.xml import XmlOutput
|
||||
|
||||
|
||||
class TestSamples(unittest.TestCase):
|
||||
|
@ -56,7 +57,8 @@ class TestSamples(unittest.TestCase):
|
|||
if len(warnings):
|
||||
raise MultipleErrors(warnings)
|
||||
|
||||
actual = ast.generate()
|
||||
xml = XmlOutput()
|
||||
actual = xml.emit(ast)
|
||||
if actual.strip() != expected.strip(): # pragma: no cover
|
||||
diff = difflib.unified_diff(expected.splitlines(), actual.splitlines())
|
||||
print("\n".join(diff))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue