Skip to content

Commit

Permalink
test: Adopted tests for tmp_fname.
Browse files Browse the repository at this point in the history
  • Loading branch information
odkr committed May 30, 2021
1 parent 0bb4340 commit 32ed9c8
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions test/scripts/unit-tests.lua
Original file line number Diff line number Diff line change
Expand Up @@ -498,11 +498,9 @@ function test_tmp_fname ()

local tests = {
[{nil, nil}] = '^tmp_%w%w%w%w%w%w$',
[{nil, 'dada'}] = '^dada$',
[{nil, 'test_XXX'}] = '^test_%w%w%w$',
[{nil, 'test_XXXXXXXXX'}] = '^test_%w%w%w%w%w%w%w%w%w$',
[{'/tmp', nil}] = '^/tmp' .. M.PATH_SEP .. 'tmp_%w%w%w%w%w%w$',
[{'/tmp', 'dada'}] = '^/tmp' .. M.PATH_SEP .. 'dada$',
[{'/tmp', 'test_XXX'}] = '^/tmp' .. M.PATH_SEP .. 'test_%w%w%w$'
[{'/tmp', 'XXXXXX'}] = '^/tmp' .. M.PATH_SEP .. '%w%w%w%w%w%w$'
}

for k, v in pairs(tests) do
Expand All @@ -514,11 +512,6 @@ function test_tmp_fname ()
local f1 = M.tmp_fname()
local f2 = M.tmp_fname()
lu.assert_not_equals(f1, f2)

-- Any filename without an 'X' that points to an existing file would do.
local fname, err = M.tmp_fname(DATA_DIR, 'bibliography.json')
lu.assert_nil(fname)
lu.assert_not_nil(err)
end

function test_tmp_file ()
Expand Down

0 comments on commit 32ed9c8

Please sign in to comment.