view src/testdir/test_reltime.vim @ 33654:a3616b5f5b25 v9.0.2066

patch 9.0.2066: xxd: corrupting files when reversing bit dumps Commit: https://github.com/vim/vim/commit/1c14030aff238abef03bdf87e6b33c7e5d7ffd51 Author: OldWorldOrdr <joey.t.reinhart@gmail.com> Date: Wed Oct 25 20:57:30 2023 +0200 patch 9.0.2066: xxd: corrupting files when reversing bit dumps Problem: xxd: corrupting files when reversing bit dumps Solution: handle reversing bit dump slightly differently fixes: #13410 closes: #13415 Co-authored-by: OldWorldOrdr <joey.t.reinhart@gmail.com> Co-authored-by: K.Takata <kentkt@csc.jp> Signed-off-by: Christian Brabandt <cb@256bit.org> Signed-off-by: K.Takata <kentkt@csc.jp> Signed-off-by: tristhaus <tristhaus@yahoo.de>
author Christian Brabandt <cb@256bit.org>
date Wed, 25 Oct 2023 21:30:03 +0200
parents 029c59bf78f1
children
line wrap: on
line source

" Tests for reltime()

source check.vim
CheckFeature reltime

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