On 2020-06-01, Gary Johnson wrote:
> On 2020-05-28, Bram Moolenaar wrote:
> > Gary Johnson wrote:
> > 
> > > I discovered that some of the functions present in ":help functions"
> > > were missing from ":help function-list".  The attached patch:
> > > 
> > > -  Adds missing functions to ":help function-list".
> > > -  Puts the ":help functions" list in alphabetical order.
> > > -  Fixes some misspellings in doc/eval.txt.
> > > -  Cleans up some inconsistencies in function-list.
> > > 
> > > I didn't know exactly where to insert some of the functions into the
> > > function-list, so I took some reasonable guesses.
> > > 
> > > The patch is based on Vim 8.2.834.
> > 
> > Thanks.  It's easy to forge to add a function in all three places.
> > Perhaps we should have a test for that.
> 
> I've created a test, attached.  It checks that all three lists
> contain the same set of functions and that the lists in
> src/evalfunc.c and doc/eval.txt are sorted.
> 
> This is my first attempt at a test in the new format, so I thought
> I'd post it here before submitting a patch to see if anyone spotted
> anything I should change.
> 
> Also, the test will fail until the original patch of this thread is
> applied and another patch to doc/eval.txt is applied as well.  Or,
> if this test looks OK, I could just submit a new patch with
> everything included.

Darn!  Test file actually attached this time.

Regards,
Gary

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/20200601181724.GC10889%40phoenix.
" Test to verify that the three function lists,
"
"   global_functions[] in src/evalfunc.c
"   *functions* in runtime/doc/eval.txt
"   *function-list* in runtime/doc/usr_41.txt
"
" contain the same functions, that the global_functions list is in ASCII
" order, and that the list in ":help functions" is in alphabetical order.

func Test_function_lists()

  " Delete any files left over from an earlier run of this test.

  call delete("Xglobal_functions.diff")
  call delete("Xfunctions.diff")
  call delete("Xfunction-list.diff")

  " Create a file of the functions in evalfunc.c:global_functions[].

  enew!
  read ../evalfunc.c
  1,/^static funcentry_T global_functions\[\] =$/d
  call search('^};$')
  .,$d
  v/^    {/d
  %s/^    {"//
  %s/".*//
  w! Xglobal_functions

  " Verify that those functions are in ASCII order.

  sort u
  w! Xsorted_global_functions
  let l:unequal = assert_equalfile("Xsorted_global_functions", 
"Xglobal_functions")
  if l:unequal && executable("diff")
    call system("diff -u Xsorted_global_functions Xglobal_functions > 
Xglobal_functions.diff")
  endif

  " Create a file of the functions in evalfunc.c:global_functions[] that are
  " not obsolete, sorted alphabetically.

  enew!
  read ../evalfunc.c
  1,/^static funcentry_T global_functions\[\] =$/d
  call search('^};$')
  .,$d
  v/^    {/d
  g/\/\/ obsolete$/d
  %s/^    {"//
  %s/".*//
  sort ui
  w! Xsorted_current_global_functions

  " Verify that the ":help functions" list is complete and in alphabetical
  " order.

  enew!
  read ../../runtime/doc/eval.txt
  call search('\*functions\*$')
  call search('^USAGE')
  1,.d
  call search('\*\K\k*()\*$')
  .,$d
  v/^\S/d
  %s/(.*//
  let l:lines = getline(1, '$')
  call uniq(l:lines)
  call writefile(l:lines, "Xfunctions")
  let l:unequal = assert_equalfile("Xsorted_current_global_functions", 
"Xfunctions")
  if l:unequal && executable("diff")
    call system("diff -u Xsorted_current_global_functions Xfunctions > 
Xfunctions.diff")
  endif

  " Verify that the ":help function-list" list is complete.

  enew!
  read ../../runtime/doc/usr_41.txt
  call search('\*function-list\*$')
  1,.d
  call search('^==*$')
  .,$d
  v/^\t\S/d
  %s/(.*//
  %left
  sort ui
  w! Xfunction-list
  let l:unequal = assert_equalfile("Xsorted_current_global_functions", 
"Xfunction-list")
  if l:unequal && executable("diff")
    call system("diff -u Xsorted_current_global_functions Xfunction-list > 
Xfunction-list.diff")
  endif

  " Clean up.

  call delete("Xglobal_functions")
  call delete("Xsorted_global_functions")
  call delete("Xsorted_current_global_functions")
  call delete("Xfunctions")
  call delete("Xfunction-list")
  enew!

endfunc

" vim: shiftwidth=2 sts=2 expandtab

Raspunde prin e-mail lui