Skip to content

Commit

Permalink
Fix for comparison of incompatible types when the first type is Array (
Browse files Browse the repository at this point in the history
  • Loading branch information
hilfazer authored May 4, 2022
1 parent 187807a commit 56e9147
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
3 changes: 1 addition & 2 deletions addons/gut/comparator.gd
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,7 @@ func simple(v1, v2, missing_string=''):
extra = str('. ', _cannot_comapre_text(v1, v2))

cmp_str = get_compare_symbol(result.are_equal)
if(typeof(v1) != TYPE_ARRAY):
result.summary = str(format_value(v1), ' ', cmp_str, ' ', format_value(v2), extra)
result.summary = str(format_value(v1), ' ', cmp_str, ' ', format_value(v2), extra)

return result

Expand Down
2 changes: 1 addition & 1 deletion test/unit/test_comparator.gd
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ class TestSimpleCompare:
assert_string_contains(result.summary, str(p[0]), 'zero value')
assert_string_contains(result.summary, str(p[1]), 'one value')

var incompatible_types = [[1, 'a'], ['text', Node], [false, []], [{}, []]]
var incompatible_types = [[1, 'a'], ['text', Node], [false, []], [{}, []], [[], 12]]
func test_incompatible_types(p=use_parameters(incompatible_types)):
var result = _comparator.simple(p[0], p[1])
assert_not_null(result.are_equal, result.summary)
Expand Down

0 comments on commit 56e9147

Please sign in to comment.