diff options
Diffstat (limited to 'test/functional/ui')
-rw-r--r-- | test/functional/ui/decorations_spec.lua | 74 | ||||
-rw-r--r-- | test/functional/ui/output_spec.lua | 51 |
2 files changed, 116 insertions, 9 deletions
diff --git a/test/functional/ui/decorations_spec.lua b/test/functional/ui/decorations_spec.lua index 4182090732..781fdf7203 100644 --- a/test/functional/ui/decorations_spec.lua +++ b/test/functional/ui/decorations_spec.lua @@ -27,6 +27,7 @@ describe('decorations providers', function() [9] = {reverse = true}; [10] = {italic = true, background = Screen.colors.Magenta}; [11] = {foreground = Screen.colors.Red, background = tonumber('0x005028')}; + [12] = {foreground = tonumber('0x990000')}; } end) @@ -227,4 +228,77 @@ describe('decorations providers', function() ]]} end) + + it('can break an existing link', function() + insert(mulholland) + local ns1 = setup_provider() + + exec [[ + highlight OriginalGroup guifg='#990000' + highlight link LinkGroup OriginalGroup + ]] + + meths.buf_set_virtual_text(0, 0, 2, {{'- not red', 'LinkGroup'}}, {}) + screen:expect{grid=[[ + // just to see if there was an accident | + // on Mulholland Drive | + try_start(); {12:- not red} | + bufref_T save_buf; | + switch_buffer(&save_buf, buf); | + posp = getmark(mark, false); | + restore_buffer(&save_buf);^ | + | + ]]} + + meths.set_hl(ns1, 'LinkGroup', {fg = 'Blue'}) + meths.set_hl_ns(ns1) + + screen:expect{grid=[[ + // just to see if there was an accident | + // on Mulholland Drive | + try_start(); {4:- not red} | + bufref_T save_buf; | + switch_buffer(&save_buf, buf); | + posp = getmark(mark, false); | + restore_buffer(&save_buf);^ | + | + ]]} + end) + + it("with 'default': do not break an existing link", function() + insert(mulholland) + local ns1 = setup_provider() + + exec [[ + highlight OriginalGroup guifg='#990000' + highlight link LinkGroup OriginalGroup + ]] + + meths.buf_set_virtual_text(0, 0, 2, {{'- not red', 'LinkGroup'}}, {}) + screen:expect{grid=[[ + // just to see if there was an accident | + // on Mulholland Drive | + try_start(); {12:- not red} | + bufref_T save_buf; | + switch_buffer(&save_buf, buf); | + posp = getmark(mark, false); | + restore_buffer(&save_buf);^ | + | + ]]} + + meths.set_hl(ns1, 'LinkGroup', {fg = 'Blue', default=true}) + meths.set_hl_ns(ns1) + feed 'k' + + screen:expect{grid=[[ + // just to see if there was an accident | + // on Mulholland Drive | + try_start(); {12:- not red} | + bufref_T save_buf; | + switch_buffer(&save_buf, buf); | + posp = getmark(mark, false^); | + restore_buffer(&save_buf); | + | + ]]} + end) end) diff --git a/test/functional/ui/output_spec.lua b/test/functional/ui/output_spec.lua index d7dde6345f..3826707743 100644 --- a/test/functional/ui/output_spec.lua +++ b/test/functional/ui/output_spec.lua @@ -232,20 +232,53 @@ describe("shell command :!", function() if has_powershell() then it('powershell supports literal strings', function() set_shell_powershell() - local screen = Screen.new(30, 4) + local screen = Screen.new(45, 4) screen:attach() feed_command([[!'Write-Output $a']]) - screen:expect{any='\nWrite%-Output %$a', timeout=10000} + screen:expect([[ + :!'Write-Output $a' | + Write-Output $a | + | + Press ENTER or type command to continue^ | + ]]) feed_command([[!$a = 1; Write-Output '$a']]) - screen:expect{any='\n%$a', timeout=10000} + screen:expect([[ + :!$a = 1; Write-Output '$a' | + $a | + | + Press ENTER or type command to continue^ | + ]]) feed_command([[!"Write-Output $a"]]) - screen:expect{any='\nWrite%-Output', timeout=10000} + screen:expect([[ + :!"Write-Output $a" | + Write-Output | + | + Press ENTER or type command to continue^ | + ]]) feed_command([[!$a = 1; Write-Output "$a"]]) - screen:expect{any='\n1', timeout=10000} - feed_command(iswin() - and [[!& 'C:\\Windows\\system32\\cmd.exe' /c 'echo $a']] - or [[!& '/bin/sh' -c 'echo ''$a''']]) - screen:expect{any='\n%$a', timeout=10000} + screen:expect([[ + :!$a = 1; Write-Output "$a" | + 1 | + | + Press ENTER or type command to continue^ | + ]]) + if iswin() then + feed_command([[!& 'cmd.exe' /c 'echo $a']]) + screen:expect([[ + :!& 'cmd.exe' /c 'echo $a' | + $a | + | + Press ENTER or type command to continue^ | + ]]) + else + feed_command([[!& '/bin/sh' -c 'echo ''$a''']]) + screen:expect([[ + :!& '/bin/sh' -c 'echo ''$a''' | + $a | + | + Press ENTER or type command to continue^ | + ]]) + end end) end end) |