mirror of
https://gitlab.gnome.org/jwestman/blueprint-compiler.git
synced 2025-05-04 15:59:08 -04:00
fuzz: Test more of the code
This commit is contained in:
parent
78acb2fe51
commit
f5822898ca
1 changed files with 12 additions and 8 deletions
|
@ -7,15 +7,18 @@ from blueprintcompiler.outputs.xml import XmlOutput
|
||||||
|
|
||||||
sys.path.insert(0, os.path.dirname(os.path.dirname(__file__)))
|
sys.path.insert(0, os.path.dirname(os.path.dirname(__file__)))
|
||||||
|
|
||||||
from blueprintcompiler import decompiler, gir, parser, tokenizer, utils
|
from blueprintcompiler import gir, parser, tokenizer
|
||||||
from blueprintcompiler.completions import complete
|
from blueprintcompiler.completions import complete
|
||||||
from blueprintcompiler.errors import (
|
from blueprintcompiler.errors import CompilerBugError, PrintableError
|
||||||
CompileError,
|
from blueprintcompiler.lsp import LanguageServer
|
||||||
CompilerBugError,
|
|
||||||
MultipleErrors,
|
|
||||||
PrintableError,
|
def assert_ast_doesnt_crash(text, tokens, ast):
|
||||||
)
|
for i in range(len(text)):
|
||||||
from blueprintcompiler.tokenizer import Token, TokenType, tokenize
|
ast.get_docs(i)
|
||||||
|
for i in range(len(text)):
|
||||||
|
list(complete(LanguageServer(), ast, tokens, i))
|
||||||
|
ast.get_document_symbols()
|
||||||
|
|
||||||
|
|
||||||
@PythonFuzz
|
@PythonFuzz
|
||||||
|
@ -29,6 +32,7 @@ def fuzz(buf):
|
||||||
xml = XmlOutput()
|
xml = XmlOutput()
|
||||||
if errors is None and ast is not None:
|
if errors is None and ast is not None:
|
||||||
xml.emit(ast)
|
xml.emit(ast)
|
||||||
|
assert_ast_doesnt_crash(blueprint, tokens, ast)
|
||||||
except CompilerBugError as e:
|
except CompilerBugError as e:
|
||||||
raise e
|
raise e
|
||||||
except PrintableError:
|
except PrintableError:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue