view src/testdir/test_reltime.vim @ 10611:6bff81438f27 v8.0.0195

patch 8.0.0195: fail to jump to static tag in current file commit https://github.com/vim/vim/commit/a9d23c20879d0dcb289a4db54b3c7df060f87c3c Author: Bram Moolenaar <Bram@vim.org> Date: Mon Jan 16 20:53:34 2017 +0100 patch 8.0.0195: fail to jump to static tag in current file Problem: Jumping to a tag that is a static item in the current file fails. (Kazunobu Kuriyama) Solution: Make sure the first byte of the tag key is not NUL. (Suggested by James McCoy, closes #1387)
author Christian Brabandt <cb@256bit.org>
date Mon, 16 Jan 2017 21:00:04 +0100
parents ea504064c996
children f38fcbf343ce
line wrap: on
line source

" Tests for reltime()

if !has('reltime') || !has('float')
  finish
endif

func Test_reltime()
  let now = reltime()
  sleep 10m
  let later = reltime()
  let elapsed = reltime(now)
  call assert_true(reltimestr(elapsed) =~ '0\.0')
  call assert_true(reltimestr(elapsed) != '0.0')
  call assert_true(reltimefloat(elapsed) < 0.1)
  call assert_true(reltimefloat(elapsed) > 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)
endfunc