Init Commit: Moved bproto to seperate repo
This commit is contained in:
32
test/compiler/backend/test_compiler_txt.py
Normal file
32
test/compiler/backend/test_compiler_txt.py
Normal file
@@ -0,0 +1,32 @@
|
||||
import sys
|
||||
from compiler import BprotoCompiler
|
||||
sys.path.append('src/')
|
||||
|
||||
from errors import BprotoCompilerError
|
||||
from backend.rendering.txtBackend import TxtBackendRenderer
|
||||
from backend.fsOutput import BackendFileSystemOutput
|
||||
|
||||
|
||||
def test_compiler_txt_against_ref():
|
||||
with open("test/test_protocol.bproto") as f:
|
||||
source_text = f.read()
|
||||
|
||||
# Comile Stuff
|
||||
compiler = BprotoCompiler([
|
||||
TxtBackendRenderer(".")
|
||||
], "template")
|
||||
|
||||
try:
|
||||
output: BackendFileSystemOutput = compiler.compile(source_text, ".")
|
||||
except BprotoCompilerError:
|
||||
assert False, "This should run througth"
|
||||
|
||||
string_output = output.toString()
|
||||
output.saveToDisk("test/backend_output/txt")
|
||||
|
||||
# Load Refernces
|
||||
with open("test/reference/txt/protocolSummary.txt") as f:
|
||||
expected_output = f.read()
|
||||
|
||||
assert isinstance(string_output.get("protocolSummary.txt"), str)
|
||||
assert string_output.get("protocolSummary.txt") == expected_output
|
||||
Reference in New Issue
Block a user