-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #10 from ram02z/feat/tests
- Loading branch information
Showing
6 changed files
with
94 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
name: ci | ||
|
||
on: | ||
pull_request: | ||
push: | ||
branches: [master] | ||
|
||
jobs: | ||
stylua: | ||
name: formatting | ||
runs-on: ubuntu-20.04 | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: JohnnyMorganz/[email protected] | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
# CLI arguments | ||
args: --color always --check . | ||
busted: | ||
name: tests | ||
runs-on: ubuntu-20.04 | ||
steps: | ||
- uses: actions/checkout@v2 | ||
with: | ||
path: dev-comments.nvim | ||
- uses: actions/checkout@v2 | ||
with: | ||
repository: nvim-lua/plenary.nvim | ||
path: plenary.nvim | ||
- uses: rhysd/action-setup-vim@v1 | ||
with: | ||
neovim: true | ||
version: nightly | ||
- run: make test | ||
working-directory: dev-comments.nvim | ||
timeout-minutes: 1 |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.PHONY: test | ||
test: | ||
nvim --headless --noplugin -u test/minimal.vim -c "lua require(\"plenary.test_harness\").test_directory_command('test {minimal_init = \"test/minimal.vim\"}')" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
local utils = require("dev_comments.utils") | ||
local mock = require("luassert.mock") | ||
|
||
describe("utils", function() | ||
local notify | ||
local config = require("dev_comments").config | ||
before_each(function() | ||
notify = mock(vim.notify, true) | ||
end) | ||
|
||
after_each(function() | ||
mock.revert(notify) | ||
end) | ||
|
||
it("does not notify if not debug", function() | ||
config.debug = false | ||
utils.notify() | ||
assert.stub(notify).was_not_called() | ||
end) | ||
|
||
it("gets filename from default buffer", function() | ||
local get_filename = utils.get_filename_fn() | ||
local api = mock(vim.api, true) | ||
|
||
get_filename() | ||
|
||
assert.stub(api.nvim_buf_get_name).was_called_with(0) | ||
|
||
mock.revert(api) | ||
end) | ||
|
||
it("returns empty string with invalid node", function() | ||
local node = nil | ||
local text = utils.get_node_text(node) | ||
assert.equals("", text) | ||
end) | ||
|
||
it("gets fallback highlight from config if tag and fallback are not found", function() | ||
local fallback = config.highlight.fallback | ||
local hlname = utils.get_highlight_by_tag(nil, nil) | ||
assert(hlname, fallback) | ||
end) | ||
|
||
it("gets fallback highlight from param if tag is not found", function() | ||
local fallback = "test" | ||
local hlname = utils.get_highlight_by_tag(nil, fallback) | ||
assert(hlname, fallback) | ||
end) | ||
end) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
set hidden | ||
set noswapfile | ||
|
||
set rtp+=../plenary.nvim | ||
set rtp+=../dev-comments.nvim | ||
runtime! plugin/plenary.vim |