From cd9bd10c7bab0c5a3e5cd67d6d2749a341ab7bc8 Mon Sep 17 00:00:00 2001 From: Daniel Silverstone Date: Sat, 8 Sep 2012 14:30:42 +0100 Subject: GALL.LL: Complete coverage of gall.ll --- lib/gall/ll.lua | 13 +++++++------ test/test-gall.ll.lua | 13 +++++++++++++ 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/lib/gall/ll.lua b/lib/gall/ll.lua index 24f76bb..92200a4 100644 --- a/lib/gall/ll.lua +++ b/lib/gall/ll.lua @@ -90,12 +90,13 @@ local simple_cmds = { for _, s in pairs(simple_cmds) do local ss = s:gsub("%-", "_") - mod_ret[ss] = function(_t) - local t = util.deep_copy(_t) - table.insert(t, 1, s) - t.stdout = _chomp - return _rungit(t) - end + local function ss_fn(_t) + local t = util.deep_copy(_t) + table.insert(t, 1, s) + t.stdout = _chomp + return _rungit(t) + end + mod_ret[ss] = ss_fn end return mod_ret diff --git a/test/test-gall.ll.lua b/test/test-gall.ll.lua index 90e3f8b..8dfb0be 100644 --- a/test/test-gall.ll.lua +++ b/test/test-gall.ll.lua @@ -60,6 +60,19 @@ function suite.test_rungit() assert(stderr == nil or stderr == "") end +function suite.test_rungit_stderr() + local args = { + repo = "/DOES_NOT_EXIST", + stderr = gall.ll.chomp, + stdout = gall.ll.chomp, + "log" + } + local why, stdout, stderr = gall.ll.rungit(args) + assert(why ~= 0) + assert(stdout == nil or stdout == "") + assert(stderr:find("DOES_NOT_EXIST")) +end + function suite.test_hash_object() local args = { repo = ".", -- cgit v1.2.1