aboutsummaryrefslogtreecommitdiff
path: root/test/unit/os/env.moon
diff options
context:
space:
mode:
authorStefan Hoffmann <stefan991@gmail.com>2014-04-05 13:51:48 +0200
committerThiago de Arruda <tpadilha84@gmail.com>2014-04-05 20:19:38 -0300
commite76249c813192aa082060d024b66f11d95d09b51 (patch)
treeb85521e6135f487f4dd7b7df9d3f4965e37f0246 /test/unit/os/env.moon
parenta8013f2bb1b7e62c273f7a7da58653aa82e9c5ca (diff)
downloadrneovim-e76249c813192aa082060d024b66f11d95d09b51.tar.gz
rneovim-e76249c813192aa082060d024b66f11d95d09b51.tar.bz2
rneovim-e76249c813192aa082060d024b66f11d95d09b51.zip
Moved mch_get_host_name and renamed it to os_get_hostanme
Diffstat (limited to 'test/unit/os/env.moon')
-rw-r--r--test/unit/os/env.moon11
1 files changed, 11 insertions, 0 deletions
diff --git a/test/unit/os/env.moon b/test/unit/os/env.moon
index b8405947d9..ad945f2206 100644
--- a/test/unit/os/env.moon
+++ b/test/unit/os/env.moon
@@ -9,6 +9,7 @@ const char *os_getenv(const char *name);
int os_setenv(const char *name, const char *value, int override);
char *os_getenvname_at_index(size_t index);
long os_get_pid(void);
+void os_get_hostname(char *hostname, size_t len);
]]
NULL = ffi.cast 'void*', 0
@@ -104,3 +105,13 @@ describe 'env function', ->
-- /proc is not avaliable on all systems, test if pid is nonzero.
eq true, (env.os_get_pid! > 0)
+ describe 'os_get_hostname', ->
+
+ it 'returns the hostname', ->
+ handle = io.popen 'hostname'
+ hostname = handle\read '*l'
+ handle\close!
+ hostname_buf = cstr 255, ''
+ env.os_get_hostname hostname_buf, 255
+ eq hostname, (ffi.string hostname_buf)
+