legacy tests: migrate test51

This commit is contained in:
Rainer Borene
2014-11-09 18:54:33 -02:00
committed by Thiago de Arruda
parent c9159586b8
commit a93d370c75
3 changed files with 70 additions and 56 deletions

View File

@@ -1,36 +0,0 @@
Tests for ":highlight". vim: set ft=vim :
STARTTEST
:so small.vim
:" basic test if ":highlight" doesn't crash
:highlight
:hi Search
:" test setting colors.
:" test clearing one color and all doesn't generate error or warning
:hi NewGroup term=bold cterm=italic ctermfg=DarkBlue ctermbg=Grey gui= guifg=#00ff00 guibg=Cyan
:hi Group2 term= cterm=
:hi Group3 term=underline cterm=bold
:redir! >test.out
:hi NewGroup
:hi Group2
:hi Group3
:hi clear NewGroup
:hi NewGroup
:hi Group2
:hi Group2 NONE
:hi Group2
:hi clear
:hi Group3
:hi Crash term='asdf
:redir END
:" filter ctermfg and ctermbg, the numbers depend on the terminal
:e test.out
:%s/ctermfg=\d*/ctermfg=2/
:%s/ctermbg=\d*/ctermbg=3/
:" filter out possibly translated error message
:%s/E475: [^:]*:/E475:/
:" fix the fileformat
:set ff&
:wq!
ENDTEST

View File

@@ -1,20 +0,0 @@
NewGroup xxx term=bold cterm=italic ctermfg=2 ctermbg=3
Group2 xxx cleared
Group3 xxx term=underline cterm=bold
NewGroup xxx cleared
Group2 xxx cleared
Group2 xxx cleared
Group3 xxx cleared
E475: term='asdf

View File

@@ -0,0 +1,70 @@
-- vim: set foldmethod=marker foldmarker=[[,]] :
-- Tests for ":highlight".
local helpers = require('test.functional.helpers')
local clear, feed, insert = helpers.clear, helpers.feed, helpers.insert
local execute, expect = helpers.execute, helpers.expect
describe(':highlight', function()
setup(clear)
it('is working', function()
-- Basic test if ":highlight" doesn't crash
execute('highlight')
execute('hi Search')
-- Test setting colors.
-- Test clearing one color and all doesn't generate error or warning
execute('hi NewGroup term=bold cterm=italic ctermfg=DarkBlue ctermbg=Grey gui= guifg=#00ff00 guibg=Cyan')
execute('hi Group2 term= cterm=')
execute('hi Group3 term=underline cterm=bold')
execute('redir! @a')
execute('hi NewGroup')
execute('hi Group2')
execute('hi Group3')
execute('hi clear NewGroup')
execute('hi NewGroup')
execute('hi Group2')
execute('hi Group2 NONE')
execute('hi Group2')
execute('hi clear')
execute('hi Group3')
execute([[hi Crash term='asdf]])
execute('redir END')
-- Filter ctermfg and ctermbg, the numbers depend on the terminal
execute('0put a')
execute([[%s/ctermfg=\d*/ctermfg=2/]])
execute([[%s/ctermbg=\d*/ctermbg=3/]])
-- Filter out possibly translated error message
execute('%s/E475: [^:]*:/E475:/')
-- Fix the fileformat
execute('set ff&')
execute('$d')
-- Assert buffer contents.
expect([[
NewGroup xxx term=bold cterm=italic ctermfg=2 ctermbg=3
Group2 xxx cleared
Group3 xxx term=underline cterm=bold
NewGroup xxx cleared
Group2 xxx cleared
Group2 xxx cleared
Group3 xxx cleared
E475: term='asdf]])
end)
end)