matryer / is

Professional lightweight testing mini-framework for Go.
MIT License
1.78k stars 58 forks source link

Panics when comparing two nil slices or two nil maps #11

Closed cloudlena closed 6 years ago

cloudlena commented 6 years ago

The test panics with panic: runtime error: comparing uncomparable type map[string]string if two nil slices or two nil maps are compared.

This can be simulated by adding the following test cases:

{
    N: "Equal(nilSlice1, nilSlice2)",
    F: func(is *I) {
        var s1 []string
        var s2 []string
        is.Equal(s1, s2) // nil slices
    },
    Fail: "",
},
{
    N: "Equal(nilMap1, nilMap2)",
    F: func(is *I) {
        var m1 map[string]string
        var m2 map[string]string
        is.Equal(m1, m2) // nil maps
    },
    Fail: "",
},