From 8d5f9661e954be91a17d915f214bd14f44622e99 Mon Sep 17 00:00:00 2001 From: Peter Melnichenko Date: Wed, 4 May 2016 15:44:19 +0300 Subject: Test what lfs.attributes returns on error --- tests/test.lua | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/test.lua b/tests/test.lua index abfbd4d..5872717 100644 --- a/tests/test.lua +++ b/tests/test.lua @@ -136,7 +136,10 @@ io.write(".") io.flush() -- Trying to get attributes of a non-existent file -assert (lfs.attributes ("this couldn't be an actual file") == nil, "could get attributes of a non-existent file") +local attr_ok, err, errno = lfs.attributes("this couldn't be an actual file") +assert(attr_ok == nil, "could get attributes of a non-existent file") +assert(type(err) == "string", "failed lfs.attributes did not return an error message") +assert(type(errno) == "number", "failed lfs.attributes did not return error code") assert (type(lfs.attributes (upper)) == "table", "couldn't get attributes of upper directory") io.write(".") -- cgit v1.2.3-55-g6feb