diff --git a/init.lua b/init.lua index be57943..ccb4063 100644 --- a/init.lua +++ b/init.lua @@ -51,10 +51,10 @@ local tests = { if not eeprom then return "SKIP" end local code = component.invoke(eeprom, 'get'); - if not code then return "FAIL" end + if type(code) ~= "string" then return "FAIL" end local data = component.invoke(eeprom, 'getData'); - if not data then return "FAIL" end + if type(data) ~= "string" then return "FAIL" end return "PASS" end}, @@ -70,10 +70,10 @@ local tests = { end local code = component.invoke(eeprom, 'get'); - if not code then return "FAIL" end + if type(code) ~= "string" then return "FAIL" end local data = component.invoke(eeprom, 'getData'); - if not data then return "FAIL" end + if type(data) ~= "string" then return "FAIL" end local testData = "HELLO MY NAME IS BLENDI GOOSE AND I AM WRITING THIS CODE RIGHT NOW; wow what a good test message thank you, me." @@ -98,6 +98,8 @@ local tests = { local label, err = component.invoke(eeprom, 'getLabel'); if err then return "FAIL" end + if (label ~= nil) and (type(label) ~= "string") then return "FAIL" end + return "PASS" end}, {name = "eeprom: r/w label", run = function() @@ -113,6 +115,7 @@ local tests = { local label, err = component.invoke(eeprom, 'getLabel'); if err then return "FAIL" end + if (label ~= nil) and (type(label) ~= "string") then return "FAIL" end local testlabel = "I AM A TEST" component.invoke(eeprom, 'setLabel', testlabel); @@ -126,9 +129,9 @@ local tests = { {name = "eeprom: other methods", run = function() local eeprom = component.list('eeprom')(); - if not component.invoke(eeprom, 'getSize') then return "FAIL" end - if not component.invoke(eeprom, 'getDataSize') then return "FAIL" end - if not component.invoke(eeprom, 'getChecksum') then return "FAIL" end + if type(component.invoke(eeprom, 'getSize')) ~= "number" then return "FAIL" end + if type(component.invoke(eeprom, 'getDataSize')) ~= "number" then return "FAIL" end + if type(component.invoke(eeprom, 'getChecksum')) ~= "string" then return "FAIL" end return "PASS" end}