tc_colorWithHexString: needs quite a lot more clean up.
We have it marked as returning __tc_nonnull, but it should more likely return __tc_nullable. The only valid inputs should be in the following formats:
rgb
#rgb
rrggbb
#rrggbb
Where r, g, and b represent valid hex characters for the red, green, and blue values. Yet, if a string not matching this format is passed in, we simply happily try to generate some sort of color and return what may or may not be the valid color, although I'll argue that if we return anything but nil (rather than throw an exception) for anything outside those four formats, we're returning something invalid.
We'll need to just mark this method as deprecated until 3.0 and add another method that does it correctly.
The tests should also be cleaned up as noted in this comment.
tc_isEqualToColor:
should simply useCGColorEqualToColor
.tc_colorWithHexString:
needs quite a lot more clean up.We have it marked as returningThe only valid inputs should be in the following formats:__tc_nonnull
, but it should more likely return__tc_nullable
.rgb
#rgb
rrggbb
#rrggbb
Where
r
,g
, andb
represent valid hex characters for the red, green, and blue values. Yet, if a string not matching this format is passed in, we simply happily try to generate some sort of color and return what may or may not be the valid color, although I'll argue that if we return anythingbut(rather than throw an exception) for anything outside those four formats, we're returning something invalid.nil
We'll need to just mark this method as deprecated until 3.0 and add another method that does it correctly.The tests should also be cleaned up as noted in this comment.