From 61b108d52789f20fb03c4f8a74719c1d53021c91 Mon Sep 17 00:00:00 2001 From: Albert Krewinkel Date: Wed, 27 Jan 2021 15:17:39 +0100 Subject: Lua: add module "pandoc.path" The module allows to work with file paths in a convenient and platform-independent manner. Closes: #6001 Closes: #6565 --- test/lua/module/pandoc-path.lua | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 test/lua/module/pandoc-path.lua (limited to 'test/lua') diff --git a/test/lua/module/pandoc-path.lua b/test/lua/module/pandoc-path.lua new file mode 100644 index 000000000..9a5a3f6c8 --- /dev/null +++ b/test/lua/module/pandoc-path.lua @@ -0,0 +1,17 @@ +local tasty = require 'tasty' +local path = require 'pandoc.path' + +local assert = tasty.assert +local test = tasty.test_case +local group = tasty.test_group + +return { + group 'path separator' { + test('is string', function () + assert.are_same(type(path.separator), 'string') + end), + test('is slash or backslash', function () + assert.is_truthy(path.separator:match '^[/\\]$') + end), + }, +} -- cgit v1.2.3 From e0bf4bfe82a2246b9ea04cfbb97dff072d42f3f6 Mon Sep 17 00:00:00 2001 From: Albert Krewinkel Date: Tue, 2 Feb 2021 22:52:32 +0100 Subject: Check that all documented functions are present. Rely on tests in the module package to check the correctness of each function. --- test/lua/module/pandoc-path.lua | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'test/lua') diff --git a/test/lua/module/pandoc-path.lua b/test/lua/module/pandoc-path.lua index 9a5a3f6c8..7f3b21fe2 100644 --- a/test/lua/module/pandoc-path.lua +++ b/test/lua/module/pandoc-path.lua @@ -14,4 +14,23 @@ return { assert.is_truthy(path.separator:match '^[/\\]$') end), }, + group 'module' { + test('check function existence', function () + local functions = { + 'directory', + 'filename', + 'is_absolute', + 'is_relative', + 'join', + 'make_relative', + 'normalize', + 'split', + 'split_extension', + 'split_search_path', + } + for _, f in ipairs(functions) do + assert.are_equal(type(path[f]), 'function') + end + end) + } } -- cgit v1.2.3 From 6f79042502851a1ac50c5c462f4121a1c659b511 Mon Sep 17 00:00:00 2001 From: Albert Krewinkel Date: Tue, 2 Feb 2021 22:57:16 +0100 Subject: Add tests for search_path_separator --- test/lua/module/pandoc-path.lua | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'test/lua') diff --git a/test/lua/module/pandoc-path.lua b/test/lua/module/pandoc-path.lua index 7f3b21fe2..81c11e7b7 100644 --- a/test/lua/module/pandoc-path.lua +++ b/test/lua/module/pandoc-path.lua @@ -14,6 +14,14 @@ return { assert.is_truthy(path.separator:match '^[/\\]$') end), }, + group 'search path separator' { + test('is string', function () + assert.are_same(type(path.search_path_separator), 'string') + end), + test('is colon or semicolon', function () + assert.is_truthy(path.search_path_separator:match '^[:;]$') + end) + }, group 'module' { test('check function existence', function () local functions = { -- cgit v1.2.3