aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2020-08-14 17:32:01 +0200
committerDavid Robillard <d@drobilla.net>2021-03-08 23:23:05 -0500
commit0daee5d67f5924f260651556a46f0af354fca341 (patch)
tree2e000a4090e7d9ee2d57b1757e831942a70bc2c2 /test
parent2ab2b5f2c7bd4d26aa99eee959f0e5192b3813dc (diff)
downloadserd-0daee5d67f5924f260651556a46f0af354fca341.tar.gz
serd-0daee5d67f5924f260651556a46f0af354fca341.tar.bz2
serd-0daee5d67f5924f260651556a46f0af354fca341.zip
Add empty syntax type for suppressing output
Diffstat (limited to 'test')
-rw-r--r--test/meson.build8
-rwxr-xr-xtest/test_empty.py27
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