aboutsummaryrefslogtreecommitdiff
path: root/test/unit
diff options
context:
space:
mode:
authorThiago de Arruda <tpadilha84@gmail.com>2014-03-24 19:11:51 -0300
committerThiago de Arruda <tpadilha84@gmail.com>2014-03-24 19:25:07 -0300
commit32f118a47f108e4dc26fbea6afce9648ba610079 (patch)
treed0be52bddc14a617daf9313f6767093ac7a58483 /test/unit
parented42c808b61dd745e76d19c6ffb2612496a779a1 (diff)
downloadrneovim-32f118a47f108e4dc26fbea6afce9648ba610079.tar.gz
rneovim-32f118a47f108e4dc26fbea6afce9648ba610079.tar.bz2
rneovim-32f118a47f108e4dc26fbea6afce9648ba610079.zip
Implement `mch_delay` on top of libuv
Needed to temporarily move two static variables from os_unix.c to 'globals.h' as those are shared by other functions still in os_unix.
Diffstat (limited to 'test/unit')
-rw-r--r--test/unit/os/time.moon15
1 files changed, 15 insertions, 0 deletions
diff --git a/test/unit/os/time.moon b/test/unit/os/time.moon
new file mode 100644
index 0000000000..76ad86b799
--- /dev/null
+++ b/test/unit/os/time.moon
@@ -0,0 +1,15 @@
+{time: lua_time} = require 'os'
+{:cimport, :eq} = require 'test.unit.helpers'
+
+time = cimport './src/os/time.h'
+
+describe 'time function', ->
+ describe 'mch_delay', ->
+ mch_delay = (ms) ->
+ time.mch_delay ms, false
+
+ it 'sleeps at least the number of requested milliseconds', ->
+ curtime = lua_time!
+ mch_delay 1000
+ ellapsed = lua_time! - curtime
+ eq true, ellapsed >= 1 and ellapsed <=2