view src/testdir/test_reltime.vim @ 27535:e2bb28237695 v8.2.4295

patch 8.2.4295: Vim9: concatenating two lists may result in wrong type Commit: https://github.com/vim/vim/commit/46950b225fab2e10245a04952b2c238e0362e1b7 Author: Bram Moolenaar <Bram@vim.org> Date: Fri Feb 4 11:36:51 2022 +0000 patch 8.2.4295: Vim9: concatenating two lists may result in wrong type Problem: Vim9: concatenating two lists may result in wrong type. Solution: Remove the type instead of using list<any>. (closes https://github.com/vim/vim/issues/9692)
author Bram Moolenaar <Bram@vim.org>
date Fri, 04 Feb 2022 12:45:03 +0100
parents a5a772dace5b
children 029c59bf78f1
line wrap: on
line source

" Tests for reltime()

source check.vim
CheckFeature reltime
CheckFeature float

func Test_reltime()
  let g:test_is_flaky = 1
  let now = reltime()
  sleep 10m
  let later = reltime()
  let elapsed = now->reltime()
  call assert_true(reltimestr(elapsed) =~ '0\.0')
  call assert_true(elapsed->reltimestr() != '0.0')
  call assert_true(reltimefloat(elapsed) < 0.1)
  call assert_true(elapsed->reltimefloat() > 0.0)

  let same = reltime(now, now)
  call assert_equal('0.000', split(reltimestr(same))[0][:4])
  call assert_equal(0.0, reltimefloat(same))

  let differs = reltime(now, later)
  call assert_true(reltimestr(differs) =~ '0\.0')
  call assert_true(reltimestr(differs) != '0.0')
  call assert_true(reltimefloat(differs) < 0.1)
  call assert_true(reltimefloat(differs) > 0.0)

  call assert_equal([], reltime({}))
  call assert_equal([], reltime({}, {}))
endfunc

" vim: shiftwidth=2 sts=2 expandtab