annotate src/testdir/test_reltime.vim @ 18469:66964658cc3c v8.1.2228

patch 8.1.2228: screenpos() returns wrong values when 'number' is set Commit: https://github.com/vim/vim/commit/38ba4dce4a8574e60f6ddb111922880b0c7affdc Author: Bram Moolenaar <Bram@vim.org> Date: Sun Oct 27 21:39:09 2019 +0100 patch 8.1.2228: screenpos() returns wrong values when 'number' is set Problem: screenpos() returns wrong values when 'number' is set. (Ben Jackson) Solution: Compare the column with the window width. (closes #5133)
author Bram Moolenaar <Bram@vim.org>
date Sun, 27 Oct 2019 21:45:03 +0100
parents 2029737e6a22
children 2fb397573541
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
17089
8e9e9124c7a2 patch 8.1.1544: some balloon tests don't run when they can
Bram Moolenaar <Bram@vim.org>
parents: 17049
diff changeset
3 source check.vim
8e9e9124c7a2 patch 8.1.1544: some balloon tests don't run when they can
Bram Moolenaar <Bram@vim.org>
parents: 17049
diff changeset
4 CheckFeature reltime
8e9e9124c7a2 patch 8.1.1544: some balloon tests don't run when they can
Bram Moolenaar <Bram@vim.org>
parents: 17049
diff changeset
5 CheckFeature float
7981
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()
17982
2029737e6a22 patch 8.1.1987: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
11 let elapsed = now->reltime()
7981
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')
17982
2029737e6a22 patch 8.1.1987: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
13 call assert_true(elapsed->reltimestr() != '0.0')
7981
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)
17982
2029737e6a22 patch 8.1.1987: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
15 call assert_true(elapsed->reltimefloat() > 0.0)
7981
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