Skip to content

Commit

Permalink
add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mrjones2014 committed Sep 6, 2024
1 parent a875162 commit 6fac87a
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,13 @@ ensure-test-deps:
@mkdir -p vendor
@if test ! -d ./vendor/plenary.nvim; then git clone [email protected]:nvim-lua/plenary.nvim.git ./vendor/plenary.nvim/; fi
@if test ! -d ./vendor/luassert; then git clone [email protected]:Olivine-Labs/luassert.git ./vendor/luassert/; fi
@if test ! -d ./vendor/sqlite; then git clone [email protected]:kkharji/sqlite.lua.git ./vendor/sqlite/; fi

.PHONY: update-test-deps
update-test-deps: ensure-test-deps
@cd ./vendor/plenary.nvim/ && git pull && cd ..
@cd ./vendor/luassert/ && git pull && cd ..
@cd ./vendor/sqlite/ && git pull && cd ..

.PHONY: ensure-doc-deps
ensure-doc-deps:
Expand Down
16 changes: 16 additions & 0 deletions tests/legendary/to_bytes_spec.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
local assert = require('luassert')
local wrapper = require('legendary.api.db.wrapper')

describe('to_bytes function', function()
local test_data = {
['test string'] = '11610111511632115116114105110103',
['with icons 󰊢'] = '119105116104321059911111011532243176138162238158168238153135',
['with quote chars \'"'] = '11910511610432113117111116101329910497114115323934',
['with emoji 🦀'] = '1191051161043210110911110610532240159166128',
}
for input, output in pairs(test_data) do
it(string.format('for input `%s`, output should be "%s"', input, output), function()
assert.are.same(wrapper.to_bytes(input), output)
end)
end
end)
1 change: 1 addition & 0 deletions tests/testrc.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ vim.cmd([[
set rtp+=.
set rtp+=vendor/plenary.nvim
set rtp+=vendor/luassert
set rtp+=vendor/sqlite
runtime plugin/plenary.vim
]])
require('plenary.busted')

0 comments on commit 6fac87a

Please sign in to comment.