func TestLoadWithParsersInitConfigNoDefaultAllFlag(t *testing.T) {
	// INIT
	config := newConfiguration()
	defaultPointers := &Configuration{}

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

	args := []string{
		"--loglevel=INFO",
		"--timeout=1s",
		"--db",
		"--db.watch",
		"--db.ip=192.168.0.1",
		"--db.load=-1",
		"--db.load64=-164",
		"--db.comax=2",
		"--db.connectionmax64=264",
		"--owner",
		"--owner.name",
		"--owner.dob=2016-04-20T17:39:00Z",
		"--owner.rate=0.222",
		"--owner.servers=1.0.0.1",
	}

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

	// CHECK
	checkDob, _ := time.Parse(time.RFC3339, "2016-04-20T17:39:00Z")
	check := &Configuration{
		Name:     "initName",
		LogLevel: "INFO",
		Timeout:  parse.Duration(time.Second),
		Db: &DatabaseInfo{
			ServerInfo: ServerInfo{
				Watch:  true,
				IP:     "192.168.0.1",
				Load:   -1,
				Load64: int64(-164),
			},
			ConnectionMax:   uint(2),
			ConnectionMax64: uint64(264),
		},
		Owner: &OwnerInfo{
			Name:        new(string),
			DateOfBirth: checkDob,
			Rate:        float64(0.222),
			Servers:     []ServerInfo{{IP: "1.0.0.1"}},
		},
	}

	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 without default values on pointers and with all flags called
Test LoadWithParsers on not empty config without default values on pointers and with all flags called
// Test LoadWithParsers on not empty config without default values on pointers and with all flags called
func TestLoadWithParsersInitConfigNoDefaultAllFlag(t *testing.T) {
	config := newConfiguration()
	defaultPointers := &Configuration{}
	customParsers := map[reflect.Type]parse.Parser{
		reflect.TypeOf([]ServerInfo{}): &sliceServerValue{},
	}
	args := []string{
		"--loglevel=INFO",
		"--timeout=1s",
		"--db",
		"--db.watch",
		"--db.ip=192.168.0.1",
		"--db.load=-1",
		"--db.load64=-164",
		"--db.comax=2",
		"--db.connectionmax64=264",
		"--owner",
		"--owner.name",
		"--owner.dob=2016-04-20T17:39:00Z",
		"--owner.rate=0.222",
		"--owner.servers=1.0.0.1",
	}
	if err := LoadWithParsers(config, defaultPointers, args, customParsers); err != nil {
		t.Fatal(err)
	}
	checkDob, _ := time.Parse(time.RFC3339, "2016-04-20T17:39:00Z")
	check := &Configuration{
		Name:     "initName",
		LogLevel: "INFO",
		Timeout:  parse.Duration(time.Second),
		Db: &DatabaseInfo{
			ServerInfo: ServerInfo{
				Watch:  true,
				IP:     "192.168.0.1",
				Load:   -1,
				Load64: int64(-164),
			},
			ConnectionMax:   uint(2),
			ConnectionMax64: uint64(264),
		},
		Owner: &OwnerInfo{
			Name:        new(string),
			DateOfBirth: checkDob,
			Rate:        float64(0.222),
			Servers:     []ServerInfo{{IP: "1.0.0.1"}},
		},
	}
	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 TestLoadWithParsersInitConfigNoDefaultAllFlag ( t * testing . T ) { config := newConfiguration ( ) defaultPointers := & Configuration { } customParsers := map [ reflect . Type ] parse . Parser { reflect . TypeOf ( [ ] ServerInfo { } ) : & sliceServerValue { } , } args := [ ] string { " " , " " , " " , " " , " " , " " , " " , " " , " " , " " , " " , " " , " " , " " , } if err := LoadWithParsers ( config , defaultPointers , args , customParsers ) ; err != nil { t . Fatal ( err ) } checkDob , _ := time . Parse ( time . RFC3339 , " " ) check := & Configuration { Name : " " , LogLevel : " " , Timeout : parse . Duration ( time . Second ) , Db : & DatabaseInfo { ServerInfo : ServerInfo { Watch : true , IP : " " , Load : - 1 , Load64 : int64 ( - 164 ) , } , ConnectionMax : uint ( 2 ) , ConnectionMax64 : uint64 ( 264 ) , } , Owner : & OwnerInfo { Name : new ( string ) , DateOfBirth : checkDob , Rate : float64 ( 0.222 ) , Servers : [ ] ServerInfo { { IP : " " } } , } , } 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 without default values on pointers and with all flags called
Test LoadWithParsers on not empty config without default values on pointers and with all flags called
// INIT // TEST // CHECK