Skip to content

Commit

Permalink
Fix up HSinspect tests, but disable the existing test because it does…
Browse files Browse the repository at this point in the history
…n't work. Add in a simple test just for a bit of coverage
  • Loading branch information
cmsj committed Dec 27, 2018
1 parent 05661b6 commit 6211143
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 0 deletions.
10 changes: 10 additions & 0 deletions Hammerspoon Tests/HSinspect.m
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,18 @@ - (void)tearDown {
[super tearDown];
}

- (void)testSimpleInspect {
RUN_LUA_TEST()
}

/* - cmsj disabled this test because it doesn't work:
2018-12-27 11:20:52.584907+0100 Hammerspoon[23984:1758686] Test returned: ...s/Hammerspoon Tests.xctest/Contents/Resources/lsunit.lua:27: Assertion failure: expected: '{a = "b"}', actual: '{
a = nil
}'
- (void)testInspectAlwaysNewTableKeyValue {
RUN_LUA_TEST()
}
*/

@end
2 changes: 2 additions & 0 deletions Hammerspoon.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
4F2DF3F51F605A9B00742D08 /* HSStreamDeckDevice.m in Sources */ = {isa = PBXBuildFile; fileRef = 4F2DF3F31F605A9B00742D08 /* HSStreamDeckDevice.m */; };
4F2DF3F81F6170BE00742D08 /* NSImage+BMP.h in Headers */ = {isa = PBXBuildFile; fileRef = 4F2DF3F61F6170BE00742D08 /* NSImage+BMP.h */; };
4F2DF3F91F6170BE00742D08 /* NSImage+BMP.m in Sources */ = {isa = PBXBuildFile; fileRef = 4F2DF3F71F6170BE00742D08 /* NSImage+BMP.m */; };
4F3042FF21D4DEE300769310 /* test_inspect.lua in Resources */ = {isa = PBXBuildFile; fileRef = 4F2C0C7121BB49E0008F32C1 /* test_inspect.lua */; };
4F3978841E89AE7200F30F05 /* Spoon.icns in Resources */ = {isa = PBXBuildFile; fileRef = 4F3978831E89AE7200F30F05 /* Spoon.icns */; };
4F3D9D031C3302CB0082E864 /* HSChooser.h in Headers */ = {isa = PBXBuildFile; fileRef = 4F3D9D011C3302CB0082E864 /* HSChooser.h */; };
4F3D9D041C3302CB0082E864 /* HSChooser.m in Sources */ = {isa = PBXBuildFile; fileRef = 4F3D9D021C3302CB0082E864 /* HSChooser.m */; };
Expand Down Expand Up @@ -5665,6 +5666,7 @@
4CB349EF1C7F74AD006F0DE0 /* test_javascript.lua in Resources */,
4CD64AAB1C6F168700EB6E39 /* test_socket.lua in Resources */,
4FDD8E911C8DEE3700085D7A /* test_appfinder.lua in Resources */,
4F3042FF21D4DEE300769310 /* test_inspect.lua in Resources */,
4F40EC441CCD126F006342D7 /* test_distributednotifications.lua in Resources */,
4F8779D3200CD63F00E9DB42 /* test_window.lua in Resources */,
4CE639141C772DC700BB7CD2 /* test_udpsocket.lua in Resources */,
Expand Down
8 changes: 8 additions & 0 deletions extensions/inspect/test_inspect.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
-- hs.inspect tests
hs.inspect = require("hs.inspect")

function testSimpleInspect()
local t = {a='b'}
assertIsEqual([[{
a = "b"
}]], hs.inspect(t))
return success()
end

-- tests the case where a custom __init always returns a new table instance as a key/value
function testInspectAlwaysNewTableKeyValue()
local t = setmetatable({}, {
Expand Down

0 comments on commit 6211143

Please sign in to comment.