view src/testdir/test_spell.vim @ 11488:9473793c7bb5 v8.0.0627

patch 8.0.0627: "gn" selects only one character with 'nowrapscan' commit https://github.com/vim/vim/commit/add8dce38de65a0c64e8f54d6bdcadb45a8de2cf Author: Bram Moolenaar <Bram@vim.org> Date: Mon Jun 5 19:56:04 2017 +0200 patch 8.0.0627: "gn" selects only one character with 'nowrapscan' Problem: When 'wrapscan' is off "gn" does not select the whole pattern when it's the last one in the text. (KeyboardFire) Solution: Check if the search fails. (Christian Brabandt, closes #1683)
author Christian Brabandt <cb@256bit.org>
date Mon, 05 Jun 2017 20:00:04 +0200
parents b3815e491811
children 7798e9bcdb13
line wrap: on
line source

" Test spell checking
" TODO: move test58 tests here

if !has('spell')
  finish
endif

func Test_wrap_search()
  new
  call setline(1, ['The', '', 'A plong line with two zpelling mistakes', '', 'End'])
  set spell wrapscan
  normal ]s
  call assert_equal('plong', expand('<cword>'))
  normal ]s
  call assert_equal('zpelling', expand('<cword>'))
  normal ]s
  call assert_equal('plong', expand('<cword>'))
  bwipe!
  set nospell
endfunc

func Test_z_equal_on_invalid_utf8_word()
  split
  set spell
  call setline(1, "\xff")
  norm z=
  set nospell
  bwipe!
endfunc

func Test_spellreall()
  new
  set spell
  call assert_fails('spellrepall', 'E752:')
  call setline(1, ['A speling mistake. The same speling mistake.',
  \                'Another speling mistake.'])
  call feedkeys(']s1z=', 'tx')
  call assert_equal('A spelling mistake. The same speling mistake.', getline(1))
  call assert_equal('Another speling mistake.', getline(2))
  spellrepall
  call assert_equal('A spelling mistake. The same spelling mistake.', getline(1))
  call assert_equal('Another spelling mistake.', getline(2))
  call assert_fails('spellrepall', 'E753:')
  set spell&
  bwipe!
endfunc