8000 Document when arrays are compared by their contents vs. their object identity · Issue #928 · google/truth · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Document when arrays are compared by their contents vs. their object identity #928
Open
@kuanyingchou

Description

@kuanyingchou

Hi, I got some strange results when comparing List of Arrays. It seems to work for Array of Arrays, List of Lists, and Array of Lists though:

        assertThat(emptyList<Any>()).isEqualTo(emptyList<Any>()) // true
        assertThat(emptyArray<Any>()).isEqualTo(emptyArray<Any>()) // true
        assertThat(listOf(1, 2, 3)).isEqualTo(listOf(1, 2, 3)) // true
        assertThat(arrayOf(1, 2, 3)).isEqualTo(arrayOf(1, 2, 3)) // true
        assertThat(listOf(listOf(1, 2, 3))).isEqualTo(listOf(listOf(1, 2, 3))) // true
        assertThat(listOf(listOf(1, 2, 3))).containsExactlyElementsIn(listOf(listOf(1, 2, 3))).inOrder() // true
        assertThat(arrayOf(arrayOf(1, 2, 3))).isEqualTo(arrayOf(arrayOf(1, 2, 3))) // true
        assertThat(arrayOf(listOf(1, 2, 3))).isEqualTo(arrayOf(listOf(1, 2, 3))) // true
        
        assertThat(listOf(arrayOf(1, 2, 3))).isEqualTo(listOf(arrayOf(1, 2, 3))) // false
        assertThat(listOf(arrayOf(1, 2, 3))).containsExactlyElementsIn(listOf(arrayOf(1, 2, 3))).inOrder() // false

This happens in version 1.1.3.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3not scheduledtype=api-docsChange/add API documentation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0