view src/testdir/test_vim9_cmd.vim @ 20595:3609e842f822 v8.2.0851

patch 8.2.0851: can't distinguish <M-a> from accented "a" in the GUI Commit: https://github.com/vim/vim/commit/f4ae6b245a54f11dd967d06b80f30e5abf55fb82 Author: Bram Moolenaar <Bram@vim.org> Date: Sat May 30 19:52:46 2020 +0200 patch 8.2.0851: can't distinguish <M-a> from accented "a" in the GUI Problem: Can't distinguish <M-a> from accented "a" in the GUI. Solution: Use another way to make mapping <C-bslash> work. (closes https://github.com/vim/vim/issues/6163)
author Bram Moolenaar <Bram@vim.org>
date Sat, 30 May 2020 20:00:03 +0200
parents a8a76fd967ab
children 524fa1d42e1e
line wrap: on
line source

" Test commands that are not compiled in a :def function

source check.vim
source vim9.vim

def Test_edit_wildcards()
  let filename = 'Xtest'
  edit `=filename`
  assert_equal('Xtest', bufname())

  let filenr = 123
  edit Xtest`=filenr`
  assert_equal('Xtest123', bufname())

  filenr = 77
  edit `=filename``=filenr`
  assert_equal('Xtest77', bufname())

  edit X`=filename`xx`=filenr`yy
  assert_equal('XXtestxx77yy', bufname())
enddef

def Test_hardcopy_wildcards()
  CheckUnix
  CheckFeature postscript

  let outfile = 'print'
  hardcopy > X`=outfile`.ps
  assert_true(filereadable('Xprint.ps'))

  delete('Xprint.ps')
enddef

def Test_syn_include_wildcards()
  writefile(['syn keyword Found found'], 'Xthemine.vim')
  let save_rtp = &rtp
  &rtp = '.'

  let fname = 'mine'
  syn include @Group Xthe`=fname`.vim
  assert_match('Found.* contained found', execute('syn list Found'))

  &rtp = save_rtp
  delete('Xthemine.vim')
enddef

def Test_assign_list()
  let l: list<string> = []
  l[0] = 'value'
  assert_equal('value', l[0])

  l[1] = 'asdf'
  assert_equal('value', l[0])
  assert_equal('asdf', l[1])
  assert_equal('asdf', l[-1])
  assert_equal('value', l[-2])

  let nrl: list<number> = []
  for i in range(5)
    nrl[i] = i
  endfor
  assert_equal([0, 1, 2, 3, 4], nrl)
enddef

def Test_assign_dict()
  let d: dict<string> = {}
  d['key'] = 'value'
  assert_equal('value', d['key'])

  d[123] = 'qwerty'
  assert_equal('qwerty', d[123])
  assert_equal('qwerty', d['123'])

  let nrd: dict<number> = {}
  for i in range(3)
    nrd[i] = i
  endfor
  assert_equal({'0': 0, '1': 1, '2': 2}, nrd)
enddef


" vim: ts=8 sw=2 sts=2 expandtab tw=80 fdm=marker