view src/testdir/test_mzscheme.vim @ 35165:d0498ef60b5b default tip

ftplugin(python): E16 fix, async keyword support for define (#14751) Commit: https://github.com/vim/vim/commit/86f6e2c2eed7df2bf5c60cc74d08d7a8d3c75f45 Author: Tom Picton <tom@tompicton.com> Date: Sat May 11 14:26:06 2024 -0400 ftplugin(python): E16 fix, async keyword support for define (https://github.com/vim/vim/issues/14751) This change includes the following changes: - Fix "E16: Invalid range" when using a count with jump to start/end of class/method - Update define with optional async keyword - Update maintainer email Signed-off-by: Tom Picton <tom@tompicton.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
author Christian Brabandt <cb@256bit.org>
date Sat, 11 May 2024 20:30:08 +0200
parents 31cb78014fe4
children
line wrap: on
line source

" Test for MzScheme interface and mzeval() function

source check.vim
CheckFeature mzscheme

func MzRequire()
  redir => l:mzversion
  mz (version)
  redir END
  if strpart(l:mzversion, 1, 1) < "4"
    " MzScheme versions < 4.x:
    mz (require (prefix vim- vimext))
  else
    " newer versions:
    mz (require (prefix-in vim- 'vimext))
    mz (require r5rs)
  endif
endfunc

func Test_mzscheme()
  new
  let lines =<< trim END
    1 line 1
    2 line 2
    3 line 3
  END
  call setline(1, lines)

  call MzRequire()
  mz (define l '("item0" "dictionary with list OK" "item2"))
  mz (define h (make-hash))
  mz (hash-set! h "list" l)

  call cursor(1, 1)
  " change buffer contents
  mz (vim-set-buff-line (vim-eval "line('.')") "1 changed line 1")
  call assert_equal('1 changed line 1', getline(1))

  " scalar test
  let tmp_string = mzeval('"string"')
  let tmp_1000 = '1000'->mzeval()
  call assert_equal('string1000', tmp_string .. tmp_1000)

  " dictionary containing a list
  call assert_equal('dictionary with list OK', mzeval("h")["list"][1])

  call cursor(2, 1)
  " circular list (at the same time test lists containing lists)
  mz (set-car! (cddr l) l)
  let l2 = mzeval("h")["list"]
  call assert_equal(l2[2], l2)

  " funcrefs
  mz (define vim:max (vim-eval "function('max')"))
  mz (define m (vim:max '(1 100 8)))
  let m = mzeval('m')
  call assert_equal(100, m)

  close!
endfunc

" vim: shiftwidth=2 sts=2 expandtab