annotate src/testdir/test_reltime.vim @ 25969:a5a772dace5b v8.2.3518

patch 8.2.3518: Test_xrestore sometimes fails Commit: https://github.com/vim/vim/commit/f08b0eb8691ff09f98bc4beef986ece1c521655f Author: Bram Moolenaar <Bram@vim.org> Date: Sat Oct 16 13:00:14 2021 +0100 patch 8.2.3518: Test_xrestore sometimes fails Problem: Test_xrestore sometimes fails. Solution: Mark the test as flayky. Move marking test as flaky to the test instead of listing them in runtest.
author Bram Moolenaar <Bram@vim.org>
date Sat, 16 Oct 2021 14:15:04 +0200
parents acda780ffc3e
children 029c59bf78f1
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()
25969
a5a772dace5b patch 8.2.3518: Test_xrestore sometimes fails
Bram Moolenaar <Bram@vim.org>
parents: 25252
diff changeset
8 let g:test_is_flaky = 1
7981
a5f1bdd2007b commit https://github.com/vim/vim/commit/cb00f039332d3188931035e9d07144546fdea78a
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
9 let now = reltime()
a5f1bdd2007b commit https://github.com/vim/vim/commit/cb00f039332d3188931035e9d07144546fdea78a
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
10 sleep 10m
a5f1bdd2007b commit https://github.com/vim/vim/commit/cb00f039332d3188931035e9d07144546fdea78a
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
11 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
12 let elapsed = now->reltime()
7981
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')
17982
2029737e6a22 patch 8.1.1987: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
14 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
15 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
16 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
17
a5f1bdd2007b commit https://github.com/vim/vim/commit/cb00f039332d3188931035e9d07144546fdea78a
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
18 let same = reltime(now, now)
a5f1bdd2007b commit https://github.com/vim/vim/commit/cb00f039332d3188931035e9d07144546fdea78a
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
19 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
20 call assert_equal(0.0, reltimefloat(same))
a5f1bdd2007b commit https://github.com/vim/vim/commit/cb00f039332d3188931035e9d07144546fdea78a
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
21
a5f1bdd2007b commit https://github.com/vim/vim/commit/cb00f039332d3188931035e9d07144546fdea78a
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
22 let differs = reltime(now, later)
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(reltimestr(differs) != '0.0')
a5f1bdd2007b commit https://github.com/vim/vim/commit/cb00f039332d3188931035e9d07144546fdea78a
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
25 call assert_true(reltimefloat(differs) < 0.1)
a5f1bdd2007b commit https://github.com/vim/vim/commit/cb00f039332d3188931035e9d07144546fdea78a
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
26 call assert_true(reltimefloat(differs) > 0.0)
20178
2fb397573541 patch 8.2.0644: insufficient testing for invalid function arguments
Bram Moolenaar <Bram@vim.org>
parents: 17982
diff changeset
27
25252
acda780ffc3e patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents: 20178
diff changeset
28 call assert_equal([], reltime({}))
acda780ffc3e patch 8.2.3162: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents: 20178
diff changeset
29 call assert_equal([], reltime({}, {}))
7981
a5f1bdd2007b commit https://github.com/vim/vim/commit/cb00f039332d3188931035e9d07144546fdea78a
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
30 endfunc
20178
2fb397573541 patch 8.2.0644: insufficient testing for invalid function arguments
Bram Moolenaar <Bram@vim.org>
parents: 17982
diff changeset
31
2fb397573541 patch 8.2.0644: insufficient testing for invalid function arguments
Bram Moolenaar <Bram@vim.org>
parents: 17982
diff changeset
32 " vim: shiftwidth=2 sts=2 expandtab