Mercurial > vim
view src/testdir/test_reltime.vim @ 9151:d0f69d0bea7a v7.4.1859
commit https://github.com/vim/vim/commit/ef3abc6442260e9a0314970a532400b05571d3fe
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun May 29 16:44:26 2016 +0200
patch 7.4.1859
Problem: Cannot use a function reference for "exit_cb".
Solution: Use get_callback(). (Yegappan Lakshmanan)
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Sun, 29 May 2016 16:45:05 +0200 |
parents | a5f1bdd2007b |
children | ea504064c996 |
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