Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.
package flags
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestOutputFlag(t *testing.T) {
var f Output
var err error
// Invalid
err = f.Set("foo")
assert.EqualError(t, err, "accepted arguments are json and text")
// Lowercase
err = f.Set("text")
assert.NoError(t, err)
assert.Equal(t, "text", f.String())
// Uppercase
err = f.Set("TEXT")
err = f.Set("json")
assert.Equal(t, "json", f.String())
err = f.Set("JSON")
}