Ejemplo n.º 1
0
// Ensures that a bad flag returns an error.
func TestConfigBadFlag(t *testing.T) {
	c := New()
	err := c.LoadFlags([]string{"-no-such-flag"})
	assert.Error(t, err)
	assert.Equal(t, err.Error(), `flag provided but not defined: -no-such-flag`)
}
Ejemplo n.º 2
0
// Ensures that a port only argument errors out
func TestConfigBindAddrErrorOnNoHost(t *testing.T) {
	c := New()
	assert.Nil(t, c.LoadFlags([]string{"-addr", "127.0.0.1:4009", "-bind-addr", ":4010"}), "")
	assert.Error(t, c.Sanitize())
}