annotate src/testdir/test_reltime.vim @ 15062:3a94f7918980 v8.1.0542

patch 8.1.0542: shiftwidth() does not take 'vartabstop' into account commit https://github.com/vim/vim/commit/f951416a8396a54bbbe21de1a8b16716428549f2 Author: Bram Moolenaar <Bram@vim.org> Date: Thu Nov 22 03:08:29 2018 +0100 patch 8.1.0542: shiftwidth() does not take 'vartabstop' into account Problem: shiftwidth() does not take 'vartabstop' into account. Solution: Use the cursor position or a position explicitly passed. Also make >> and << work better with 'vartabstop'. (Christian Brabandt)
author Bram Moolenaar <Bram@vim.org>
date Thu, 22 Nov 2018 03:15:10 +0100
parents ea504064c996
children f38fcbf343ce
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
7981
a5f1bdd2007b commit https://github.com/vim/vim/commit/cb00f039332d3188931035e9d07144546fdea78a
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1 " Tests for reltime()
a5f1bdd2007b commit https://github.com/vim/vim/commit/cb00f039332d3188931035e9d07144546fdea78a
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
2
a5f1bdd2007b commit https://github.com/vim/vim/commit/cb00f039332d3188931035e9d07144546fdea78a
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
3 if !has('reltime') || !has('float')
a5f1bdd2007b commit https://github.com/vim/vim/commit/cb00f039332d3188931035e9d07144546fdea78a
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
4 finish
a5f1bdd2007b commit https://github.com/vim/vim/commit/cb00f039332d3188931035e9d07144546fdea78a
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
5 endif
a5f1bdd2007b commit https://github.com/vim/vim/commit/cb00f039332d3188931035e9d07144546fdea78a
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6
a5f1bdd2007b commit https://github.com/vim/vim/commit/cb00f039332d3188931035e9d07144546fdea78a
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
7 func Test_reltime()
a5f1bdd2007b commit https://github.com/vim/vim/commit/cb00f039332d3188931035e9d07144546fdea78a
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
8 let now = reltime()
a5f1bdd2007b commit https://github.com/vim/vim/commit/cb00f039332d3188931035e9d07144546fdea78a
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
9 sleep 10m
a5f1bdd2007b commit https://github.com/vim/vim/commit/cb00f039332d3188931035e9d07144546fdea78a
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
10 let later = reltime()
a5f1bdd2007b commit https://github.com/vim/vim/commit/cb00f039332d3188931035e9d07144546fdea78a
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
11 let elapsed = reltime(now)
a5f1bdd2007b commit https://github.com/vim/vim/commit/cb00f039332d3188931035e9d07144546fdea78a
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
12 call assert_true(reltimestr(elapsed) =~ '0\.0')
a5f1bdd2007b commit https://github.com/vim/vim/commit/cb00f039332d3188931035e9d07144546fdea78a
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
13 call assert_true(reltimestr(elapsed) != '0.0')
a5f1bdd2007b commit https://github.com/vim/vim/commit/cb00f039332d3188931035e9d07144546fdea78a
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
14 call assert_true(reltimefloat(elapsed) < 0.1)
a5f1bdd2007b commit https://github.com/vim/vim/commit/cb00f039332d3188931035e9d07144546fdea78a
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
15 call assert_true(reltimefloat(elapsed) > 0.0)
a5f1bdd2007b commit https://github.com/vim/vim/commit/cb00f039332d3188931035e9d07144546fdea78a
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
16
a5f1bdd2007b commit https://github.com/vim/vim/commit/cb00f039332d3188931035e9d07144546fdea78a
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
17 let same = reltime(now, now)
a5f1bdd2007b commit https://github.com/vim/vim/commit/cb00f039332d3188931035e9d07144546fdea78a
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
18 call assert_equal('0.000', split(reltimestr(same))[0][:4])
a5f1bdd2007b commit https://github.com/vim/vim/commit/cb00f039332d3188931035e9d07144546fdea78a
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
19 call assert_equal(0.0, reltimefloat(same))
a5f1bdd2007b commit https://github.com/vim/vim/commit/cb00f039332d3188931035e9d07144546fdea78a
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
20
a5f1bdd2007b commit https://github.com/vim/vim/commit/cb00f039332d3188931035e9d07144546fdea78a
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
21 let differs = reltime(now, later)
a5f1bdd2007b commit https://github.com/vim/vim/commit/cb00f039332d3188931035e9d07144546fdea78a
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
22 call assert_true(reltimestr(differs) =~ '0\.0')
a5f1bdd2007b commit https://github.com/vim/vim/commit/cb00f039332d3188931035e9d07144546fdea78a
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
23 call assert_true(reltimestr(differs) != '0.0')
a5f1bdd2007b commit https://github.com/vim/vim/commit/cb00f039332d3188931035e9d07144546fdea78a
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
24 call assert_true(reltimefloat(differs) < 0.1)
a5f1bdd2007b commit https://github.com/vim/vim/commit/cb00f039332d3188931035e9d07144546fdea78a
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
25 call assert_true(reltimefloat(differs) > 0.0)
a5f1bdd2007b commit https://github.com/vim/vim/commit/cb00f039332d3188931035e9d07144546fdea78a
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
26 endfunc