diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/meson.build | 43 | ||||
-rwxr-xr-x | test/run_suite.py | 3 | ||||
-rw-r--r-- | test/serd_test_util/__init__.py | 13 | ||||
-rwxr-xr-x | test/test_stdin.py | 2 | ||||
-rw-r--r-- | test/trig_no_extension | 11 | ||||
-rw-r--r-- | test/trig_unknown_extension.n3 | 11 |
6 files changed, 57 insertions, 26 deletions
diff --git a/test/meson.build b/test/meson.build index 0e887ccb..43fc7211 100644 --- a/test/meson.build +++ b/test/meson.build @@ -181,32 +181,27 @@ simple_command_tests = { 'bad': [ ['-B', 'nonuriorpath'], ['-B'], - ['-I', 'turtle'], ['-I', 'unknown'], ['-I'], ['-O', 'unknown'], ['-O'], + ['-R'], ['-b', '-1'], ['-b', '1024junk'], - ['-b', '9223372036854775807'], ['-b'], - ['-k', '-1'], - ['-k', '1024junk'], ['-k', '9223372036854775807'], ['-k'], ['-qi'], - ['-r'], ['-s', '<foo> a <Bar> .'], ['-s'], - ['-w'], ['-z'], ], 'good': [ ['--help'], ['--version'], + ['-V'], ['-h'], ['-k', '512', '-s', '<go:>a<go:> .'], - ['-v'], ], }, } @@ -236,17 +231,30 @@ if is_variable('serd_pipe') endforeach endforeach - test('none', serd_pipe, env: test_env, should_fail: true, suite: cmd_suite) - # Base URI options test( + 'bad_rebase', + serd_pipe, + args: ['-B', 'rebase', serd_ttl], + env: test_env, + should_fail: true, + suite: cmd_suite, + ) + test( 'base', files('test_base.py'), args: pipe_script_args, env: test_env, suite: cmd_suite, ) + test( + 'dir_base', + serd_pipe, + args: ['-B', serd_src_root / '', serd_ttl], + env: test_env, + suite: cmd_suite, + ) # Log @@ -286,6 +294,21 @@ if is_variable('serd_pipe') input_suite = ['tools', 'pipe', 'input'] + good_input_tests = { + 'unknown_extension': [files('trig_unknown_extension.n3')], + 'no_extension': [files('trig_no_extension')], + } + + foreach name, args : good_input_tests + test( + name, + serd_pipe, + args: args, + env: test_env, + suite: input_suite, + ) + endforeach + bad_input_tests = { 'string': ['-s', '<foo> a <Bar> .'], 'no_such_file': ['no_such_file'], @@ -513,7 +536,7 @@ test_suites = { files('extra/root/manifest.ttl'), ns_serdtest + 'root/', '--', - ['-r', 'http://example.org/top/root/'], + ['-R', 'http://example.org/top/root/'], ], 'terse': [ files('extra/terse/manifest.ttl'), diff --git a/test/run_suite.py b/test/run_suite.py index 16e527af..52a418ef 100755 --- a/test/run_suite.py +++ b/test/run_suite.py @@ -40,8 +40,7 @@ TEST_TYPES = [ def run_eval_test(command, in_path, good_path, out_path): """Run a positive eval test and return whether the output matches.""" - syntax = util.syntax_from_path(out_path) - command = command + ["-O", syntax, "-w", out_path, in_path] + command = command + ["-o", out_path, in_path] subprocess.check_call(command, encoding="utf-8") with open(good_path, "r", encoding="utf-8") as good: diff --git a/test/serd_test_util/__init__.py b/test/serd_test_util/__init__.py index f465a4b7..5f0e0033 100644 --- a/test/serd_test_util/__init__.py +++ b/test/serd_test_util/__init__.py @@ -110,19 +110,6 @@ def file_path(suite_dir, uri): return os.path.relpath(os.path.join(suite_dir, os.path.basename(uri))) -def syntax_from_path(path): - """Return the serd syntax name corresponding to a file path.""" - - extensions = { - ".ttl": "turtle", - ".nt": "ntriples", - ".trig": "trig", - ".nq": "nquads", - } - - return extensions[os.path.splitext(path)[1]] - - def earl_assertion(test, passed, asserter): """Return a Turtle description of an assertion for the test report.""" diff --git a/test/test_stdin.py b/test/test_stdin.py index 790d34ce..7a2ab34e 100755 --- a/test/test_stdin.py +++ b/test/test_stdin.py @@ -10,7 +10,7 @@ import serd_test_util as util args = util.wrapper_args(__doc__) -command = [args.tool, "-I", "ntriples", "-B", "http://example.org", "-"] +command = [args.tool, "-I", "ntriples", "-B", "http://example.org"] DOC = "<{0}s> <{0}p> <{0}o> .".format("http://example.org/") diff --git a/test/trig_no_extension b/test/trig_no_extension new file mode 100644 index 00000000..e1c292d9 --- /dev/null +++ b/test/trig_no_extension @@ -0,0 +1,11 @@ +# Copyright 2023 David Robillard <d@drobilla.net> +# SPDX-License-Identifier: 0BSD OR ISC + +@prefix eg: <http://example.org/> . + +eg:g { + eg:s + eg:p [ + a eg:Object + ] . +} diff --git a/test/trig_unknown_extension.n3 b/test/trig_unknown_extension.n3 new file mode 100644 index 00000000..e1c292d9 --- /dev/null +++ b/test/trig_unknown_extension.n3 @@ -0,0 +1,11 @@ +# Copyright 2023 David Robillard <d@drobilla.net> +# SPDX-License-Identifier: 0BSD OR ISC + +@prefix eg: <http://example.org/> . + +eg:g { + eg:s + eg:p [ + a eg:Object + ] . +} |