Skip to content

assert.NotSubset incorrecly formats with %q #1800

@brackendawson

Description

@brackendawson

Description

NotSubset (but not Subset) seems to be using %q to format error output, that doesn't work for many collection element types.

Step To Reproduce

package kata_test

import (
	"testing"

	"github.com/stretchr/testify/assert"
)

type User struct {
	ID, Name string
	Age      int
}

func TestIfy(t *testing.T) {
	assert.NotSubset(t, []bool{true}, []bool{true})
}

Expected behavior

Values of arguments to be formatted well.

Actual behavior

--- FAIL: TestIfy (0.00s)
    /Users/brackendawson/src/github.com/brackendawson/kata/kata_test.go:15: 
        	Error Trace:	/Users/brackendawson/src/github.com/brackendawson/kata/kata_test.go:15
        	Error:      	[%!q(bool=true)] is a subset of [%!q(bool=true)]
        	Test:       	TestIfy
FAIL
coverage: 0.0% of statements
FAIL	github.com/brackendawson/kata	0.202s
FAIL

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions