feat: rename everything
This commit is contained in:
parent
8f7442eaa2
commit
67116f38bc
16 changed files with 172 additions and 165 deletions
|
|
@ -1,5 +1,5 @@
|
|||
require('spec.helpers')
|
||||
local highlight = require('fugitive-ts.highlight')
|
||||
local highlight = require('diffs.highlight')
|
||||
|
||||
describe('highlight', function()
|
||||
describe('highlight_hunk', function()
|
||||
|
|
@ -9,8 +9,8 @@ describe('highlight', function()
|
|||
ns = vim.api.nvim_create_namespace('fugitive_ts_test')
|
||||
local diff_add = vim.api.nvim_get_hl(0, { name = 'DiffAdd' })
|
||||
local diff_delete = vim.api.nvim_get_hl(0, { name = 'DiffDelete' })
|
||||
vim.api.nvim_set_hl(0, 'FugitiveTsAdd', { bg = diff_add.bg })
|
||||
vim.api.nvim_set_hl(0, 'FugitiveTsDelete', { bg = diff_delete.bg })
|
||||
vim.api.nvim_set_hl(0, 'DiffsAdd', { bg = diff_add.bg })
|
||||
vim.api.nvim_set_hl(0, 'DiffsDelete', { bg = diff_delete.bg })
|
||||
end)
|
||||
|
||||
local function create_buffer(lines)
|
||||
|
|
@ -325,7 +325,7 @@ describe('highlight', function()
|
|||
local extmarks = get_extmarks(bufnr)
|
||||
local has_diff_add = false
|
||||
for _, mark in ipairs(extmarks) do
|
||||
if mark[4] and mark[4].line_hl_group == 'FugitiveTsAdd' then
|
||||
if mark[4] and mark[4].line_hl_group == 'DiffsAdd' then
|
||||
has_diff_add = true
|
||||
break
|
||||
end
|
||||
|
|
@ -358,7 +358,7 @@ describe('highlight', function()
|
|||
local extmarks = get_extmarks(bufnr)
|
||||
local has_diff_delete = false
|
||||
for _, mark in ipairs(extmarks) do
|
||||
if mark[4] and mark[4].line_hl_group == 'FugitiveTsDelete' then
|
||||
if mark[4] and mark[4].line_hl_group == 'DiffsDelete' then
|
||||
has_diff_delete = true
|
||||
break
|
||||
end
|
||||
|
|
@ -523,7 +523,7 @@ describe('highlight', function()
|
|||
local extmarks = get_extmarks(bufnr)
|
||||
local has_diff_add = false
|
||||
for _, mark in ipairs(extmarks) do
|
||||
if mark[4] and mark[4].line_hl_group == 'FugitiveTsAdd' then
|
||||
if mark[4] and mark[4].line_hl_group == 'DiffsAdd' then
|
||||
has_diff_add = true
|
||||
break
|
||||
end
|
||||
|
|
@ -554,7 +554,7 @@ describe('highlight', function()
|
|||
|
||||
local hunk = {
|
||||
filename = 'test.lua',
|
||||
ft = 'lua',
|
||||
ft = 'abap',
|
||||
lang = nil,
|
||||
start_line = 1,
|
||||
lines = { ' local x = 1', '+local y = 2' },
|
||||
|
|
@ -587,7 +587,7 @@ describe('highlight', function()
|
|||
|
||||
local hunk = {
|
||||
filename = 'test.lua',
|
||||
ft = 'lua',
|
||||
ft = 'abap',
|
||||
lang = nil,
|
||||
start_line = 1,
|
||||
lines = { ' local x = 1', '+local y = 2' },
|
||||
|
|
@ -618,7 +618,7 @@ describe('highlight', function()
|
|||
local bufnr = create_buffer(lines)
|
||||
local hunk = {
|
||||
filename = 'test.lua',
|
||||
ft = 'lua',
|
||||
ft = 'abap',
|
||||
lang = nil,
|
||||
start_line = 1,
|
||||
lines = hunk_lines,
|
||||
|
|
@ -645,7 +645,7 @@ describe('highlight', function()
|
|||
|
||||
local hunk = {
|
||||
filename = 'test.lua',
|
||||
ft = 'lua',
|
||||
ft = 'abap',
|
||||
lang = nil,
|
||||
start_line = 1,
|
||||
lines = { ' local x = 1', '+local y = 2' },
|
||||
|
|
@ -661,7 +661,7 @@ describe('highlight', function()
|
|||
local extmarks = get_extmarks(bufnr)
|
||||
local has_diff_add = false
|
||||
for _, mark in ipairs(extmarks) do
|
||||
if mark[4] and mark[4].line_hl_group == 'FugitiveTsAdd' then
|
||||
if mark[4] and mark[4].line_hl_group == 'DiffsAdd' then
|
||||
has_diff_add = true
|
||||
break
|
||||
end
|
||||
|
|
@ -692,7 +692,7 @@ describe('highlight', function()
|
|||
|
||||
local hunk = {
|
||||
filename = 'test.lua',
|
||||
ft = 'lua',
|
||||
ft = 'abap',
|
||||
lang = nil,
|
||||
start_line = 1,
|
||||
lines = { ' local x = 1', '+local y = 2' },
|
||||
|
|
|
|||
|
|
@ -1,23 +1,23 @@
|
|||
require('spec.helpers')
|
||||
local fugitive_ts = require('fugitive-ts')
|
||||
local diffs = require('diffs')
|
||||
|
||||
describe('fugitive-ts', function()
|
||||
describe('diffs', function()
|
||||
describe('setup', function()
|
||||
it('accepts empty config', function()
|
||||
assert.has_no.errors(function()
|
||||
fugitive_ts.setup({})
|
||||
diffs.setup({})
|
||||
end)
|
||||
end)
|
||||
|
||||
it('accepts nil config', function()
|
||||
assert.has_no.errors(function()
|
||||
fugitive_ts.setup()
|
||||
diffs.setup()
|
||||
end)
|
||||
end)
|
||||
|
||||
it('accepts full config', function()
|
||||
assert.has_no.errors(function()
|
||||
fugitive_ts.setup({
|
||||
diffs.setup({
|
||||
enabled = false,
|
||||
debug = true,
|
||||
debounce_ms = 100,
|
||||
|
|
@ -40,7 +40,7 @@ describe('fugitive-ts', function()
|
|||
|
||||
it('accepts partial config', function()
|
||||
assert.has_no.errors(function()
|
||||
fugitive_ts.setup({
|
||||
diffs.setup({
|
||||
debounce_ms = 25,
|
||||
})
|
||||
end)
|
||||
|
|
@ -61,13 +61,13 @@ describe('fugitive-ts', function()
|
|||
end
|
||||
|
||||
before_each(function()
|
||||
fugitive_ts.setup({ enabled = true })
|
||||
diffs.setup({ enabled = true })
|
||||
end)
|
||||
|
||||
it('does not error on empty buffer', function()
|
||||
local bufnr = create_buffer({})
|
||||
assert.has_no.errors(function()
|
||||
fugitive_ts.attach(bufnr)
|
||||
diffs.attach(bufnr)
|
||||
end)
|
||||
delete_buffer(bufnr)
|
||||
end)
|
||||
|
|
@ -80,7 +80,7 @@ describe('fugitive-ts', function()
|
|||
'+local y = 2',
|
||||
})
|
||||
assert.has_no.errors(function()
|
||||
fugitive_ts.attach(bufnr)
|
||||
diffs.attach(bufnr)
|
||||
end)
|
||||
delete_buffer(bufnr)
|
||||
end)
|
||||
|
|
@ -88,9 +88,9 @@ describe('fugitive-ts', function()
|
|||
it('is idempotent', function()
|
||||
local bufnr = create_buffer({})
|
||||
assert.has_no.errors(function()
|
||||
fugitive_ts.attach(bufnr)
|
||||
fugitive_ts.attach(bufnr)
|
||||
fugitive_ts.attach(bufnr)
|
||||
diffs.attach(bufnr)
|
||||
diffs.attach(bufnr)
|
||||
diffs.attach(bufnr)
|
||||
end)
|
||||
delete_buffer(bufnr)
|
||||
end)
|
||||
|
|
@ -110,22 +110,22 @@ describe('fugitive-ts', function()
|
|||
end
|
||||
|
||||
before_each(function()
|
||||
fugitive_ts.setup({ enabled = true })
|
||||
diffs.setup({ enabled = true })
|
||||
end)
|
||||
|
||||
it('does not error on unattached buffer', function()
|
||||
local bufnr = create_buffer({})
|
||||
assert.has_no.errors(function()
|
||||
fugitive_ts.refresh(bufnr)
|
||||
diffs.refresh(bufnr)
|
||||
end)
|
||||
delete_buffer(bufnr)
|
||||
end)
|
||||
|
||||
it('does not error on attached buffer', function()
|
||||
local bufnr = create_buffer({})
|
||||
fugitive_ts.attach(bufnr)
|
||||
diffs.attach(bufnr)
|
||||
assert.has_no.errors(function()
|
||||
fugitive_ts.refresh(bufnr)
|
||||
diffs.refresh(bufnr)
|
||||
end)
|
||||
delete_buffer(bufnr)
|
||||
end)
|
||||
|
|
@ -133,7 +133,7 @@ describe('fugitive-ts', function()
|
|||
|
||||
describe('config options', function()
|
||||
it('enabled=false prevents highlighting', function()
|
||||
fugitive_ts.setup({ enabled = false })
|
||||
diffs.setup({ enabled = false })
|
||||
local bufnr = vim.api.nvim_create_buf(false, true)
|
||||
vim.api.nvim_buf_set_lines(bufnr, 0, -1, false, {
|
||||
'M test.lua',
|
||||
|
|
@ -141,9 +141,9 @@ describe('fugitive-ts', function()
|
|||
' local x = 1',
|
||||
'+local y = 2',
|
||||
})
|
||||
fugitive_ts.attach(bufnr)
|
||||
diffs.attach(bufnr)
|
||||
|
||||
local ns = vim.api.nvim_create_namespace('fugitive_ts')
|
||||
local ns = vim.api.nvim_create_namespace('diffs')
|
||||
local extmarks = vim.api.nvim_buf_get_extmarks(bufnr, ns, 0, -1, {})
|
||||
assert.are.equal(0, #extmarks)
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
require('spec.helpers')
|
||||
local parser = require('fugitive-ts.parser')
|
||||
local parser = require('diffs.parser')
|
||||
|
||||
describe('parser', function()
|
||||
describe('parse_buffer', function()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue