Skip to content

Commit

Permalink
test(diff): add tests for not showing visualization
Browse files Browse the repository at this point in the history
  • Loading branch information
echasnovski committed Jan 25, 2025
1 parent e3f074f commit 7b4bcc1
Show file tree
Hide file tree
Showing 3 changed files with 70 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
--|---------|-----
01|AAA
02|uuu
03|BBB
04|CcC
05|DDD
06|FFF
07|~
08|~
09|<e] [+] 1,1 All
10|

--|---------|-----
01|000000000000000
02|000000000000000
03|000000000000000
04|000000000000000
05|000000000000000
06|000000000000000
07|111111111111111
08|111111111111111
09|222222222222222
10|333333333333333
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
--|---------|-----
01|AAA
02|uuu
03|BBB
04|CcC
05|DDD
06|FFF
07|~
08|~
09|<e] [+] 1,1 All
10|

--|---------|-----
01|000000000000000
02|000000000000000
03|000000000000000
04|000000000000000
05|000000000000000
06|000000000000000
07|111111111111111
08|111111111111111
09|222222222222222
10|333333333333333
24 changes: 24 additions & 0 deletions tests/test_diff.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1957,6 +1957,30 @@ T['Visualization']['works'] = function()
})
end

T['Visualization']['does not appear if there is no gutter'] = function()
child.o.signcolumn, child.o.number = 'no', false
disable()
enable()

set_lines({ 'AAA', 'uuu', 'BBB', 'CcC', 'DDD', 'FFF' })
set_ref_text(0, { 'AAA', 'BBB', 'CCC', 'DDD', 'EEE', 'FFF' })
-- Shouldn't force neither sign nor number column
child.expect_screenshot()
end

T['Visualization']['can be visually disabled'] = function()
child.lua('MiniDiff.config.view.style = "sign"')
child.lua('MiniDiff.config.view.signs = { add = "", change = "", delete = "" }')
disable()
enable()

set_lines({ 'AAA', 'uuu', 'BBB', 'CcC', 'DDD', 'FFF' })
set_ref_text(0, { 'AAA', 'BBB', 'CCC', 'DDD', 'EEE', 'FFF' })
-- Shouldn't show sign column, although extmarks are still placed
child.expect_screenshot()
eq(#get_viz_extmarks(0) > 0, true)
end

T['Visualization']['works with "add" hunks'] = function()
-- Every added line should be visualized as part of hunk
set_lines({ 'aaa', 'uuu', 'vvv', 'bbb', 'www', 'ccc' })
Expand Down

0 comments on commit 7b4bcc1

Please sign in to comment.