hurl/integration/test_echo.py
Fabrice Reix a85170998f Migrate integration scripts to python
so that they can be executed then in windows
2021-01-14 20:40:37 +01:00

29 lines
626 B
Python
Executable File

#!/usr/bin/env python3
# echo hurl file
# The file is parsed and output exactly as the input
#
import sys
import subprocess
def test(hurl_file):
cmd = ['hurlfmt', '--no-format', hurl_file]
print(' '.join(cmd))
result = subprocess.run(cmd, stdout=subprocess.PIPE)
expected = open(hurl_file).read()
actual = result.stdout.decode("utf-8")
if actual != expected:
print('>>> error in stdout')
print(f'actual: <{actual}>\nexpected: <{expected}>')
sys.exit(1)
def main():
for hurl_file in sys.argv[1:]:
test(hurl_file)
if __name__ == '__main__':
main()