Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support TYPE_ENUM for beA expectation #50

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 3 additions & 9 deletions lua/gluatest/expectations/negative.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
local type = type
local TypeID = TypeID
local IsValid = IsValid
local string_format = string.format

Expand Down Expand Up @@ -73,20 +74,13 @@ return function( subject, ... )
end

function expectations.beA( comparison )
local class = type( subject )
local class = isnumber( comparison ) and TypeID( subject ) or type( subject )

if class == comparison then
i.expected( "to not be a '%s'", comparison )
end
end

function expectations.beAn( comparison )
local class = type( subject )

if class == comparison then
i.expected( "to not be an '%s'", comparison )
end
end
expectations.beAn = expectations.beA

function expectations.succeed()
local success = pcall( subject, unpack( args ) )
Expand Down
3 changes: 2 additions & 1 deletion lua/gluatest/expectations/positive.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
local type = type
local TypeID = TypeID
local IsValid = IsValid
local string_format = string.format

Expand Down Expand Up @@ -75,7 +76,7 @@ return function( subject, ... )
end

function expectations.beA( comparison )
local class = type( subject )
local class = isnumber( comparison ) and TypeID( subject ) or type( subject )

if class ~= comparison then
i.expected( "to be a '%s'", comparison )
Expand Down