cgen: fix fixed arrays literal eq (#8079)

This commit is contained in:
yuyi 2021-01-13 15:32:41 +08:00 committed by GitHub
parent 7458b699d0
commit ae592299dc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 0 deletions

View file

@ -44,3 +44,17 @@ fn test_fixed_array_eq() {
assert a8 == [['aaa', 'bbb']!!, ['ccc', 'ddd']!!]
assert a8 != [['bbb', 'aaa']!!, ['cccc', 'dddd']!!]
}
fn test_fixed_array_literal_eq() {
assert [1, 2, 3]! == [1, 2, 3]!
assert [1, 1, 1]! != [1, 2, 3]!
assert [[1, 2], [3, 4]]! == [[1, 2], [3, 4]]!
assert [[1, 1], [2, 2]]! != [[1, 2], [3, 4]]!
assert [[1, 1]!, [2, 2]!]! == [[1, 1]!, [2, 2]!]!
assert [[1, 1]!, [2, 2]!]! != [[1, 2]!, [2, 3]!]!
assert [[1, 1]!, [2, 2]!] == [[1, 1]!, [2, 2]!]
assert [[1, 1]!, [2, 2]!] != [[1, 2]!, [2, 3]!]
}