func TestLoadWithParsersInitConfigAllDefaultSomeFlag(t *testing.T) {
	// INIT
	config := newConfiguration()
	defaultPointers := newDefaultPointersConfiguration()

	customParsers := map[reflect.Type]parse.Parser{
		reflect.TypeOf([]ServerInfo{}): &sliceServerValue{},
	}

	args := []string{
		"--loglevel=INFO",
		"--db",
		"--owner.name",
		"--owner.dob=2016-04-20T17:39:00Z",
	}

	// TEST
	if err := LoadWithParsers(config, defaultPointers, args, customParsers); err != nil {
		t.Fatal(err)
	}

	// CHECK
	check := newConfiguration()
	check.LogLevel = "INFO"
	check.Db = newDefaultPointersConfiguration().Db
	check.Owner.Name = newDefaultPointersConfiguration().Owner.Name
	check.Owner.DateOfBirth, _ = time.Parse(time.RFC3339, "2016-04-20T17:39:00Z")

	if !reflect.DeepEqual(config, check) {
		if !reflect.DeepEqual(config.Owner, check.Owner) {
			t.Errorf("\nexpected\t: %+v\ngot\t\t\t: %+v", check.Owner, config.Owner)
		}
		t.Errorf("Error :\nexpected \t%+v \ngot \t\t%+v\n", check, config)
	}
}
// Test LoadWithParsers on not empty config with all default values on pointers and with some flags called
Test LoadWithParsers on not empty config with all default values on pointers and with some flags called
// Test LoadWithParsers on not empty config with all default values on pointers and with some flags called
func TestLoadWithParsersInitConfigAllDefaultSomeFlag(t *testing.T) {
	config := newConfiguration()
	defaultPointers := newDefaultPointersConfiguration()
	customParsers := map[reflect.Type]parse.Parser{
		reflect.TypeOf([]ServerInfo{}): &sliceServerValue{},
	}
	args := []string{
		"--loglevel=INFO",
		"--db",
		"--owner.name",
		"--owner.dob=2016-04-20T17:39:00Z",
	}
	if err := LoadWithParsers(config, defaultPointers, args, customParsers); err != nil {
		t.Fatal(err)
	}
	check := newConfiguration()
	check.LogLevel = "INFO"
	check.Db = newDefaultPointersConfiguration().Db
	check.Owner.Name = newDefaultPointersConfiguration().Owner.Name
	check.Owner.DateOfBirth, _ = time.Parse(time.RFC3339, "2016-04-20T17:39:00Z")
	if !reflect.DeepEqual(config, check) {
		if !reflect.DeepEqual(config.Owner, check.Owner) {
			t.Errorf("\nexpected\t: %+v\ngot\t\t\t: %+v", check.Owner, config.Owner)
		}
		t.Errorf("Error :\nexpected \t%+v \ngot \t\t%+v\n", check, config)
	}
}
func TestLoadWithParsersInitConfigAllDefaultSomeFlag ( t * testing . T ) { config := newConfiguration ( ) defaultPointers := newDefaultPointersConfiguration ( ) customParsers := map [ reflect . Type ] parse . Parser { reflect . TypeOf ( [ ] ServerInfo { } ) : & sliceServerValue { } , } args := [ ] string { " " , " " , " " , " " , } if err := LoadWithParsers ( config , defaultPointers , args , customParsers ) ; err != nil { t . Fatal ( err ) } check := newConfiguration ( ) check . LogLevel = " " check . Db = newDefaultPointersConfiguration ( ) . Db check . Owner . Name = newDefaultPointersConfiguration ( ) . Owner . Name check . Owner . DateOfBirth , _ = time . Parse ( time . RFC3339 , " " ) if ! reflect . DeepEqual ( config , check ) { if ! reflect . DeepEqual ( config . Owner , check . Owner ) { t . Errorf ( " \n \t \n \t \t \t " , check . Owner , config . Owner ) } t . Errorf ( " \n \t \n \t \t \n " , check , config ) } }
Test LoadWithParsers on not empty config with all default values on pointers and with some flags called
Test LoadWithParsers on not empty config with all default values on pointers and with some flags called
// INIT // TEST // CHECK