feat(diff): third, regular diff mode
This commit is contained in:
parent
7d51fc2931
commit
ff20efca71
6 changed files with 126 additions and 12 deletions
|
|
@ -12,10 +12,10 @@ describe('cp.diff', function()
|
|||
end)
|
||||
|
||||
describe('get_available_backends', function()
|
||||
it('returns vim and git backends', function()
|
||||
it('returns none, vim and git backends', function()
|
||||
local backends = diff.get_available_backends()
|
||||
table.sort(backends)
|
||||
assert.same({ 'git', 'vim' }, backends)
|
||||
assert.same({ 'git', 'none', 'vim' }, backends)
|
||||
end)
|
||||
end)
|
||||
|
||||
|
|
@ -32,6 +32,12 @@ describe('cp.diff', function()
|
|||
assert.equals('git', backend.name)
|
||||
end)
|
||||
|
||||
it('returns none backend by name', function()
|
||||
local backend = diff.get_backend('none')
|
||||
assert.is_not_nil(backend)
|
||||
assert.equals('none', backend.name)
|
||||
end)
|
||||
|
||||
it('returns nil for invalid name', function()
|
||||
local backend = diff.get_backend('invalid')
|
||||
assert.is_nil(backend)
|
||||
|
|
@ -95,6 +101,19 @@ describe('cp.diff', function()
|
|||
end)
|
||||
end)
|
||||
|
||||
describe('none backend', function()
|
||||
it('returns both expected and actual content', function()
|
||||
local backend = diff.get_backend('none')
|
||||
local result = backend.render('expected\nline2', 'actual\nline2')
|
||||
|
||||
assert.same({
|
||||
expected = { 'expected', 'line2' },
|
||||
actual = { 'actual', 'line2' },
|
||||
}, result.content)
|
||||
assert.same({}, result.highlights)
|
||||
end)
|
||||
end)
|
||||
|
||||
describe('vim backend', function()
|
||||
it('returns content as-is', function()
|
||||
local backend = diff.get_backend('vim')
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue