aboutsummaryrefslogtreecommitdiff
path: root/test/functional/eval/reltime_spec.lua
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2021-09-17 09:16:40 -0700
committerGitHub <noreply@github.com>2021-09-17 09:16:40 -0700
commitd8de4eb685e35646c7d541e9a75bdc296127b7e2 (patch)
tree4bb05ec713856715ac9ba57e5d116eed344511b9 /test/functional/eval/reltime_spec.lua
parentd56002f7b722facd97b0958e141c8ed2d01495f7 (diff)
downloadrneovim-d8de4eb685e35646c7d541e9a75bdc296127b7e2.tar.gz
rneovim-d8de4eb685e35646c7d541e9a75bdc296127b7e2.tar.bz2
rneovim-d8de4eb685e35646c7d541e9a75bdc296127b7e2.zip
test: reorg #15698
Problem: Subdirectories like "visual", "insert", "normal" encourage people to separate *related* tests for no good reason. Typically the _mode_ is not the relevant topic of a test (and when it is, _then_ create an appropriate describe() or it()). Solution: - Delete the various `test/functional/<mode>/` subdirectories, move their tests to more meaningful topics. - Rename `…/normal/` to `…/editor/`. - Move or merge `…/visual/*` and `…/insert/*` tests into here where appropriate. - Rename `…/eval/` to `…/vimscript/`. - Move `…/viml/*` into here also. * test(reorg): insert/* => editor/mode_insert_spec.lua * test(reorg): cmdline/* => editor/mode_cmdline_spec.lua * test(reorg): eval core tests => eval_spec.lua
Diffstat (limited to 'test/functional/eval/reltime_spec.lua')
-rw-r--r--test/functional/eval/reltime_spec.lua53
1 files changed, 0 insertions, 53 deletions
diff --git a/test/functional/eval/reltime_spec.lua b/test/functional/eval/reltime_spec.lua
deleted file mode 100644
index d87943e485..0000000000
--- a/test/functional/eval/reltime_spec.lua
+++ /dev/null
@@ -1,53 +0,0 @@
-local helpers = require('test.functional.helpers')(after_each)
-local clear, eq, ok = helpers.clear, helpers.eq, helpers.ok
-local neq, command, funcs = helpers.neq, helpers.command, helpers.funcs
-local reltime, reltimestr, reltimefloat = funcs.reltime, funcs.reltimestr, funcs.reltimefloat
-
-describe('reltimestr(), reltimefloat()', function()
- before_each(clear)
-
- it('acceptance', function()
- local now = reltime()
- command('sleep 10m')
- local later = reltime()
- local elapsed = reltime(now)
-
- neq(reltimestr(elapsed), '0.0')
- ok(reltimefloat(elapsed) > 0.0)
- -- original vim test for < 0.1, but easily fails on travis
- ok(nil ~= string.match(reltimestr(elapsed), "0%."))
- ok(reltimefloat(elapsed) < 1.0)
-
- local same = reltime(now, now)
- local samestr = string.gsub(reltimestr(same), ' ', '')
- samestr = string.sub(samestr, 1, 5)
-
- eq('0.000', samestr)
- eq(0.0, reltimefloat(same))
-
- local differs = reltime(now, later)
- neq(reltimestr(differs), '0.0')
- ok(reltimefloat(differs) > 0.0)
- -- original vim test for < 0.1, but easily fails on travis
- ok(nil ~= string.match(reltimestr(differs), "0%."))
- ok(reltimefloat(differs) < 1.0)
- end)
-
- it('(start - end) returns negative #10452', function()
- local older_time = reltime()
- command('sleep 1m')
- local newer_time = reltime()
-
- -- Start/end swapped: should be something like -0.002123.
- local tm_s = tonumber(reltimestr(reltime(newer_time, older_time)))
- local tm_f = reltimefloat(reltime(newer_time, older_time))
- ok(tm_s < 0 and tm_s > -10)
- ok(tm_f < 0 and tm_f > -10)
-
- -- Not swapped: should be something like 0.002123.
- tm_s = tonumber(reltimestr(reltime(older_time, newer_time)))
- tm_f = reltimefloat(reltime(older_time, newer_time))
- ok(tm_s > 0 and tm_s < 10)
- ok(tm_f > 0 and tm_f < 10)
- end)
-end)