diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/meson.build | 8 | ||||
-rw-r--r-- | test/multifile/input1.ttl | 2 | ||||
-rw-r--r-- | test/multifile/input2.trig | 7 | ||||
-rw-r--r-- | test/multifile/output.nq | 3 | ||||
-rwxr-xr-x | test/test_multifile.py | 32 |
5 files changed, 52 insertions, 0 deletions
diff --git a/test/meson.build b/test/meson.build index fd8586a8..489a6ee5 100644 --- a/test/meson.build +++ b/test/meson.build @@ -18,6 +18,7 @@ simple_script_paths = [ 'run_suite.py', 'test_base.py', 'test_empty.py', + 'test_multifile.py', 'test_quiet.py', 'test_stdin.py', 'test_write_error.py', @@ -275,6 +276,13 @@ if is_variable('serd_pipe') env: test_env, suite: input_suite, ) + test( + 'multifile', + files('test_multifile.py'), + args: pipe_script_args + [meson.current_source_dir() / 'multifile'], + env: test_env, + suite: input_suite, + ) # Output diff --git a/test/multifile/input1.ttl b/test/multifile/input1.ttl new file mode 100644 index 00000000..88c3f8e9 --- /dev/null +++ b/test/multifile/input1.ttl @@ -0,0 +1,2 @@ +[] + a <http://example.org/Type> . diff --git a/test/multifile/input2.trig b/test/multifile/input2.trig new file mode 100644 index 00000000..260080a8 --- /dev/null +++ b/test/multifile/input2.trig @@ -0,0 +1,7 @@ +[] + a <http://example.org/Type> . + +<http://example.org/graph> { + [] + a <http://example.org/OtherType> . +} diff --git a/test/multifile/output.nq b/test/multifile/output.nq new file mode 100644 index 00000000..dd35dc4d --- /dev/null +++ b/test/multifile/output.nq @@ -0,0 +1,3 @@ +_:f0b1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example.org/Type> . +_:f1b1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example.org/Type> . +_:f1b2 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example.org/OtherType> <http://example.org/graph> . diff --git a/test/test_multifile.py b/test/test_multifile.py new file mode 100755 index 00000000..e8fa0775 --- /dev/null +++ b/test/test_multifile.py @@ -0,0 +1,32 @@ +#!/usr/bin/env python3 + +# Copyright 2019-2023 David Robillard <d@drobilla.net> +# SPDX-License-Identifier: ISC + +"""Test reading from several input files.""" + +# pylint: disable=duplicate-code + +import os +import shlex +import subprocess +import tempfile + +import serd_test_util as util + +args = util.wrapper_args(__doc__, True) +testdir = args.input +in1_path = os.path.join(testdir, "input1.ttl") +in2_path = os.path.join(testdir, "input2.trig") +check_path = os.path.join(testdir, "output.nq") +command = shlex.split(args.wrapper) + [args.tool, in1_path, in2_path] + + +with tempfile.TemporaryFile(mode="w+", encoding="utf-8") as out: + proc = subprocess.run(command, check=False, stdout=out) + + assert proc.returncode == 0 + + out.seek(0) + with open(check_path, "r", encoding="utf-8") as check: + assert util.lines_equal(list(check), list(out), check_path, "output") |