diff --git a/inspect.lua b/inspect.lua index ae5b430..c13a8cd 100644 --- a/inspect.lua +++ b/inspect.lua @@ -296,7 +296,8 @@ function Inspector:putValue(v) if tv == 'string' then self:puts(smartQuote(escape(v))) - elseif tv == 'number' or tv == 'boolean' or tv == 'nil' then + elseif tv == 'number' or tv == 'boolean' or tv == 'nil' or + tv == 'cdata' or tv == 'ctype' then self:puts(tostring(v)) elseif tv == 'table' then self:putTable(v) diff --git a/spec/inspect_spec.lua b/spec/inspect_spec.lua index 1e4a9e0..dadeb89 100644 --- a/spec/inspect_spec.lua +++ b/spec/inspect_spec.lua @@ -71,7 +71,8 @@ describe( 'inspect', function() if is_luajit then it('works with luajit cdata', function() - assert.equals('{ , , }', inspect({ ffi.new("int", 1), ffi.typeof("int"), ffi.typeof("int")(1) })) + assert.equals('{ cdata: PTR, ctype, cdata: PTR }', + inspect({ ffi.new("int", 1), ffi.typeof("int"), ffi.typeof("int")(1) }):gsub('(0x%x+)','PTR')) end) end