mirror of
https://github.com/vim/vim.git
synced 2025-10-12 06:44:06 -04:00
patch 8.2.3398: html text objects are not fully tested
Problem: Html text objects are not fully tested. Solution: Add tests for dbcs encoding and different number of backslashes. (Dominique Pellé, closes #8831)
This commit is contained in:
committed by
Bram Moolenaar
parent
03d257998b
commit
af631f61bc
@@ -88,101 +88,107 @@ endfunc
|
|||||||
|
|
||||||
" Tests for string and html text objects
|
" Tests for string and html text objects
|
||||||
func Test_string_html_objects()
|
func Test_string_html_objects()
|
||||||
|
|
||||||
|
for e in ['utf-8', 'latin1', 'cp932']
|
||||||
enew!
|
enew!
|
||||||
|
exe 'set enc=' .. e
|
||||||
|
|
||||||
let t = '"wo\"rd\\" foo'
|
let t = '"wo\"rd\\" foo'
|
||||||
put =t
|
put =t
|
||||||
normal! da"
|
normal! da"
|
||||||
call assert_equal('foo', getline('.'))
|
call assert_equal('foo', getline('.'), e)
|
||||||
|
|
||||||
let t = "'foo' 'bar' 'piep'"
|
let t = "'foo' 'bar' 'piep'"
|
||||||
put =t
|
put =t
|
||||||
normal! 0va'a'rx
|
normal! 0va'a'rx
|
||||||
call assert_equal("xxxxxxxxxxxx'piep'", getline('.'))
|
call assert_equal("xxxxxxxxxxxx'piep'", getline('.'), e)
|
||||||
|
|
||||||
let t = "bla bla `quote` blah"
|
let t = "bla bla `quote` blah"
|
||||||
put =t
|
put =t
|
||||||
normal! 02f`da`
|
normal! 02f`da`
|
||||||
call assert_equal("bla bla blah", getline('.'))
|
call assert_equal("bla bla blah", getline('.'), e)
|
||||||
|
|
||||||
let t = 'out " in "noXno"'
|
let t = 'out " in "noXno"'
|
||||||
put =t
|
put =t
|
||||||
normal! 0fXdi"
|
normal! 0fXdi"
|
||||||
call assert_equal('out " in ""', getline('.'))
|
call assert_equal('out " in ""', getline('.'), e)
|
||||||
|
|
||||||
let t = "\"'\" 'blah' rep 'buh'"
|
let t = "\"'\" 'blah' rep 'buh'"
|
||||||
put =t
|
put =t
|
||||||
normal! 03f'vi'ry
|
normal! 03f'vi'ry
|
||||||
call assert_equal("\"'\" 'blah'yyyyy'buh'", getline('.'))
|
call assert_equal("\"'\" 'blah'yyyyy'buh'", getline('.'), e)
|
||||||
|
|
||||||
set quoteescape=+*-
|
set quoteescape=+*-
|
||||||
let t = "bla `s*`d-`+++`l**` b`la"
|
let t = "bla `s*`d-`+++`l**` b`la"
|
||||||
put =t
|
put =t
|
||||||
normal! di`
|
normal! di`
|
||||||
call assert_equal("bla `` b`la", getline('.'))
|
call assert_equal("bla `` b`la", getline('.'), e)
|
||||||
|
|
||||||
let t = 'voo "nah" sdf " asdf" sdf " sdf" sd'
|
let t = 'voo "nah" sdf " asdf" sdf " sdf" sd'
|
||||||
put =t
|
put =t
|
||||||
normal! $F"va"oha"i"rz
|
normal! $F"va"oha"i"rz
|
||||||
call assert_equal('voo "zzzzzzzzzzzzzzzzzzzzzzzzzzzzsd', getline('.'))
|
call assert_equal('voo "zzzzzzzzzzzzzzzzzzzzzzzzzzzzsd', getline('.'), e)
|
||||||
|
|
||||||
let t = "-<b>asdf<i>Xasdf</i>asdf</b>-"
|
let t = "-<b>asdf<i>Xasdf</i>asdf</b>-"
|
||||||
put =t
|
put =t
|
||||||
normal! fXdit
|
normal! fXdit
|
||||||
call assert_equal('-<b>asdf<i></i>asdf</b>-', getline('.'))
|
call assert_equal('-<b>asdf<i></i>asdf</b>-', getline('.'), e)
|
||||||
|
|
||||||
let t = "-<b>asdX<i>a<i />sdf</i>asdf</b>-"
|
let t = "-<b>asdX<i>a<i />sdf</i>asdf</b>-"
|
||||||
put =t
|
put =t
|
||||||
normal! 0fXdit
|
normal! 0fXdit
|
||||||
call assert_equal('-<b></b>-', getline('.'))
|
call assert_equal('-<b></b>-', getline('.'), e)
|
||||||
|
|
||||||
let t = "-<b>asdf<i>Xasdf</i>asdf</b>-"
|
let t = "-<b>asdf<i>Xasdf</i>asdf</b>-"
|
||||||
put =t
|
put =t
|
||||||
normal! fXdat
|
normal! fXdat
|
||||||
call assert_equal('-<b>asdfasdf</b>-', getline('.'))
|
call assert_equal('-<b>asdfasdf</b>-', getline('.'), e)
|
||||||
|
|
||||||
let t = "-<b>asdX<i>as<b />df</i>asdf</b>-"
|
let t = "-<b>asdX<i>as<b />df</i>asdf</b>-"
|
||||||
put =t
|
put =t
|
||||||
normal! 0fXdat
|
normal! 0fXdat
|
||||||
call assert_equal('--', getline('.'))
|
call assert_equal('--', getline('.'), e)
|
||||||
|
|
||||||
let t = "-<b>\ninnertext object\n</b>"
|
let t = "-<b>\ninnertext object\n</b>"
|
||||||
put =t
|
put =t
|
||||||
normal! dit
|
normal! dit
|
||||||
call assert_equal('-<b></b>', getline('.'))
|
call assert_equal('-<b></b>', getline('.'), e)
|
||||||
|
|
||||||
" copy the tag block from leading indentation before the start tag
|
" copy the tag block from leading indentation before the start tag
|
||||||
let t = " <b>\ntext\n</b>"
|
let t = " <b>\ntext\n</b>"
|
||||||
$put =t
|
$put =t
|
||||||
normal! 2kvaty
|
normal! 2kvaty
|
||||||
call assert_equal("<b>\ntext\n</b>", @")
|
call assert_equal("<b>\ntext\n</b>", @", e)
|
||||||
|
|
||||||
" copy the tag block from the end tag
|
" copy the tag block from the end tag
|
||||||
let t = "<title>\nwelcome\n</title>"
|
let t = "<title>\nwelcome\n</title>"
|
||||||
$put =t
|
$put =t
|
||||||
normal! $vaty
|
normal! $vaty
|
||||||
call assert_equal("<title>\nwelcome\n</title>", @")
|
call assert_equal("<title>\nwelcome\n</title>", @", e)
|
||||||
|
|
||||||
" copy the outer tag block from a tag without an end tag
|
" copy the outer tag block from a tag without an end tag
|
||||||
let t = "<html>\n<title>welcome\n</html>"
|
let t = "<html>\n<title>welcome\n</html>"
|
||||||
$put =t
|
$put =t
|
||||||
normal! k$vaty
|
normal! k$vaty
|
||||||
call assert_equal("<html>\n<title>welcome\n</html>", @")
|
call assert_equal("<html>\n<title>welcome\n</html>", @", e)
|
||||||
|
|
||||||
" nested tag that has < in a different line from >
|
" nested tag that has < in a different line from >
|
||||||
let t = "<div><div\n></div></div>"
|
let t = "<div><div\n></div></div>"
|
||||||
$put =t
|
$put =t
|
||||||
normal! k0vaty
|
normal! k0vaty
|
||||||
call assert_equal("<div><div\n></div></div>", @")
|
call assert_equal("<div><div\n></div></div>", @", e)
|
||||||
|
|
||||||
" nested tag with attribute that has < in a different line from >
|
" nested tag with attribute that has < in a different line from >
|
||||||
let t = "<div><div\nattr=\"attr\"\n></div></div>"
|
let t = "<div><div\nattr=\"attr\"\n></div></div>"
|
||||||
$put =t
|
$put =t
|
||||||
normal! 2k0vaty
|
normal! 2k0vaty
|
||||||
call assert_equal("<div><div\nattr=\"attr\"\n></div></div>", @")
|
call assert_equal("<div><div\nattr=\"attr\"\n></div></div>", @", e)
|
||||||
|
|
||||||
set quoteescape&
|
set quoteescape&
|
||||||
enew!
|
endfor
|
||||||
|
|
||||||
|
set enc=utf-8
|
||||||
|
bwipe!
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func Test_empty_html_tag()
|
func Test_empty_html_tag()
|
||||||
@@ -561,6 +567,20 @@ func Test_textobj_quote()
|
|||||||
normal 0ya'
|
normal 0ya'
|
||||||
call assert_equal(" 'special'", @")
|
call assert_equal(" 'special'", @")
|
||||||
|
|
||||||
|
" quoted string with odd or even number of backslashes.
|
||||||
|
call setline(1, 'char *s = "foo\"bar"')
|
||||||
|
normal $hhyi"
|
||||||
|
call assert_equal('foo\"bar', @")
|
||||||
|
call setline(1, 'char *s = "foo\\"bar"')
|
||||||
|
normal $hhyi"
|
||||||
|
call assert_equal('bar', @")
|
||||||
|
call setline(1, 'char *s = "foo\\\"bar"')
|
||||||
|
normal $hhyi"
|
||||||
|
call assert_equal('foo\\\"bar', @")
|
||||||
|
call setline(1, 'char *s = "foo\\\\"bar"')
|
||||||
|
normal $hhyi"
|
||||||
|
call assert_equal('bar', @")
|
||||||
|
|
||||||
close!
|
close!
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
|
@@ -755,6 +755,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
3398,
|
||||||
/**/
|
/**/
|
||||||
3397,
|
3397,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user