stretchr/testify

Diffs are slightly off for assert.Equal on maps

Open

#288 aberto em 23 de mar. de 2016

Ver no GitHub
 (6 comments) (0 reactions) (0 assignees)Go (1.704 forks)batch import
enhancementhelp wanted

Métricas do repositório

Stars
 (25.958 stars)
Métricas de merge de PR
 (Mesclagem média 6d 15h) (2 fundiu PRs em 30d)

Description

It seems the map is rendered with no trailing , for the last element, so the diff catches that as a modified line.. but really the line isn't modified..

Diff:
            --- Expected
            +++ Actual
            @@ -1,5 +1,7 @@
            -(map[string]interface {}) (len=3) {
            +(map[string]interface {}) (len=5) {
              (string) (len=15) "installed.first": (string) (len=20) "2006-01-02T15:04:05Z",
              (string) (len=14) "installed.last": (string) (len=20) "2006-01-02T15:04:05Z",
            - (string) (len=23) "installed.windows.first": (string) (len=20) "2006-01-02T15:04:05Z"
            + (string) (len=23) "installed.windows.first": (string) (len=20) "2006-01-02T15:04:05Z",
            + (string) (len=22) "installed.windows.last": (string) (len=20) "2006-01-02T15:04:05Z",
            + (string) (len=30) "installed.windows.last_version": (string) (len=3) "8.1"
             }

See how installed.windows.first is different only in the trailing , !

Guia do colaborador