Skip to content

Commit

Permalink
add ci
Browse files Browse the repository at this point in the history
  • Loading branch information
windwp committed Apr 18, 2021
1 parent fd20894 commit ce60a10
Show file tree
Hide file tree
Showing 7 changed files with 51 additions and 286 deletions.
1 change: 1 addition & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
github:windwp
32 changes: 32 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Tests

on: [push, pull_request]

jobs:
x64-ubuntu:
name: X64-ubuntu
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- run: date +%F > todays-date
- name: Restore cache for today's nightly.
uses: actions/cache@v2
with:
path: |
_neovim
key: ${{ runner.os }}-x64-${{ hashFiles('todays-date') }}

- name: Prepare
run: |
mkdir -p ~/.local/share/nvim/site/pack/vendor/start
git clone --depth 1 https://github.com/nvim-lua/plenary.nvim ~/.local/share/nvim/site/pack/vendor/start/plenary.nvim
git clone --depth 1 https://github.com/nvim-lua/popup.nvim ~/.local/share/nvim/site/pack/vendor/start/popup.nvim
git clone --depth 1 https://github.com/nvim-treesitter/nvim-treesitter ~/.local/share/nvim/site/pack/vendor/start/nvim-treesitter
git clone --depth 1 https://github.com/nvim-treesitter/playground ~/.local/share/nvim/site/pack/vendor/start/playground
ln -s $(pwd) ~/.local/share/nvim/site/pack/vendor/start
- name: Run tests
run: |
curl -OL https://raw.githubusercontent.com/norcalli/bot-ci/master/scripts/github-actions-setup.sh
source github-actions-setup.sh nightly-x64
nvim --headless -u tests/minimal.vim -c "TSInstallSync all" -c "q"
make test
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ npairs.add_rule({
})
-- you can use some builtin condition

local cond = require('nvim-autopairs.cond')
local cond = require('nvim-autopairs.conds')
print(vim.inspect(cond))

npairs.add_rules({
Expand Down
2 changes: 0 additions & 2 deletions lua/nvim-autopairs.lua
Original file line number Diff line number Diff line change
Expand Up @@ -93,15 +93,13 @@ M.autopairs_bs = function(bufnr)
line = line
})
then
log.debug('delete')
local input = ""
for _ = 1, (#rule.start_pair), 1 do
input = input .. utils.key.bs
end
for _ = 1, #rule.end_pair, 1 do
input = input .. utils.key.right .. utils.key.bs
end
log.debug(input)
return utils.esc("<c-g>U" .. input)
end
end
Expand Down
259 changes: 0 additions & 259 deletions lua/nvim-autopairs.old.lua

This file was deleted.

1 change: 0 additions & 1 deletion lua/nvim-autopairs/rule.lua
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ end
function Rule:with_pair(cond)
if self.pair_cond == nil then self.pair_cond = {}end
table.insert(self.pair_cond, cond)
if self=="dafs" the
return self
end

Expand Down
40 changes: 17 additions & 23 deletions tests/nvim-autopairs_spec.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
local helpers = {}
local npairs = require('nvim-autopairs')
local Rule = require('nvim-autopairs.rule')
local cond = require('nvim-autopairs.conds')
local log = require('nvim-autopairs._log')
_G.npairs = npairs;
local eq=_G.eq
Expand All @@ -17,7 +19,6 @@ end

local data = {
{

name = "add normal bracket" ,
key = [[{]],
before = [[x| ]],
Expand Down Expand Up @@ -165,14 +166,6 @@ local data = {
before = [[aaa(|) ]],
after = [[aaa| ]]
},
-- {
-- only = true,
-- name = "delete bracket",
-- filetype="python",
-- key = [[<bs>]],
-- before = [[a"""|"""" ]],
-- after = [[a| ]]
-- },
{
name = "breakline on {" ,
filetype="javascript",
Expand Down Expand Up @@ -253,19 +246,20 @@ end
describe('autopairs ', function()
Test(run_data)
if isOnly then return end
-- run_data = {
-- {
-- name = "nil breakline_file_type " ,
-- filetype="javascript",
-- key = [[<cr>]],
-- before = [[a[|] ]],
-- after = "] "
-- },
-- }

-- npairs.setup({
-- break_line_filetype = nil
-- })
npairs.add_rules({
Rule("$$", "$$",{"tex", "latex"})
-- don't add a pair if the next character is %
:with_pair(cond.not_after_regex_check("%%"))
})
run_data = {
{
name = "test add_rules" ,
filetype = "latex",
key = [[$]],
before = [[asdas$| ]],
after = [[asdas$$|$$ ]],
},
}
Test(run_data)

-- Test(run_data)
end)

0 comments on commit ce60a10

Please sign in to comment.