diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2014-09-06 18:36:00 -0400 |
---|---|---|
committer | Justin M. Keyes <justinkz@gmail.com> | 2014-09-11 05:17:52 +0000 |
commit | f6088e79b098791dc04e42602692ab2bdd08ee78 (patch) | |
tree | 7956b881e4ee7c91fbf9e15a6668a0ed9414cae3 /test/unit/formatc.lua | |
parent | c76feb338a14a0e6dea494c18fb2d22f474cfc0e (diff) | |
download | rneovim-f6088e79b098791dc04e42602692ab2bdd08ee78.tar.gz rneovim-f6088e79b098791dc04e42602692ab2bdd08ee78.tar.bz2 rneovim-f6088e79b098791dc04e42602692ab2bdd08ee78.zip |
unit tests: avoid global scope; add missing cimports
temporarily comment out call to vim_deltempdir() to avoid segfault
Diffstat (limited to 'test/unit/formatc.lua')
-rw-r--r-- | test/unit/formatc.lua | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/test/unit/formatc.lua b/test/unit/formatc.lua index bafaf09310..792894f349 100644 --- a/test/unit/formatc.lua +++ b/test/unit/formatc.lua @@ -212,18 +212,21 @@ local function formatc(str) return table.concat(result) end --- uncomment the following lines (and comment the return) for standalone --- operation (very handy for debugging) +-- standalone operation (very handy for debugging) local function standalone(...) Preprocess = require("preprocess") Preprocess.add_to_include_path('./../../src') Preprocess.add_to_include_path('./../../build/include') Preprocess.add_to_include_path('./../../.deps/usr/include') - input = Preprocess.preprocess_stream(arg[1]) + local input = Preprocess.preprocess_stream(arg[1]) local raw = input:read('*all') input:close() + if raw == nil then + print("ERROR: Preprocess.preprocess_stream():read() returned empty") + end + local formatted if #arg == 2 and arg[2] == 'no' then formatted = raw @@ -233,6 +236,9 @@ local function standalone(...) print(formatted) end +-- uncomment this line (and comment the `return`) for standalone debugging +-- example usage: +-- ../../.deps/usr/bin/luajit formatc.lua ../../include/tempfile.h.generated.h +-- ../../.deps/usr/bin/luajit formatc.lua /usr/include/malloc.h -- standalone(...) - return formatc |