diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/meson.build | 8 | ||||
-rwxr-xr-x | test/test_empty.py | 27 |
2 files changed, 35 insertions, 0 deletions
diff --git a/test/meson.build b/test/meson.build index 3926888d..49a3fe0c 100644 --- a/test/meson.build +++ b/test/meson.build @@ -107,6 +107,14 @@ if get_option('utils') should_fail: true, suite: ['serdi', 'input']) + # Output + + test('empty', files('test_empty.py'), + args: script_args + [serd_ttl], + suite: 'output') + + # FIXME: Old base URI argument? + # IO errors test('read_dir', serdi, diff --git a/test/test_empty.py b/test/test_empty.py new file mode 100755 index 00000000..a7978e6c --- /dev/null +++ b/test/test_empty.py @@ -0,0 +1,27 @@ +#!/usr/bin/env python3 + +"""Test writing empty output.""" + +import argparse +import sys +import shlex +import subprocess +import tempfile + +parser = argparse.ArgumentParser(description=__doc__) + +parser.add_argument("--serdi", default="./serdi", help="path to serdi") +parser.add_argument("--wrapper", default="", help="executable wrapper") +parser.add_argument("input", help="valid input file") + +args = parser.parse_args(sys.argv[1:]) +command = shlex.split(args.wrapper) + [args.serdi, "-o", "empty", args.input] + +with tempfile.TemporaryFile() as out: + + proc = subprocess.run(command, check=False, stdout=out) + + out.seek(0, 2) # Seek to end + + assert proc.returncode == 0 + assert out.tell() == 0 |