@@ -371,17 +371,35 @@ func TestFromEnv(t *testing.T) {
371371 io Validator
372372 error bool
373373 }{
374- {"nil" , EnvOptions {}, nil , true },
375- {"nonptr" , EnvOptions {}, simpleValidator {}, true },
376- {"nilptr" , EnvOptions {}, (* simpleValidator )(nil ), true },
377- {"defaulterr" , EnvOptions {}, new (nonStructValidator ), true },
378- {"parseeerr" , EnvOptions {Environment : map [string ]string {"FOO" : "bar" }}, & simpleValidator {}, true },
379- {"invalid" , EnvOptions {Environment : map [string ]string {"FOO" : "23" }}, & simpleValidator {}, true },
380- {"simple" , EnvOptions {Environment : map [string ]string {"FOO" : "42" }}, & simpleValidator {42 }, false },
381- {"default" , EnvOptions {}, & defaultValidator {42 }, false },
382- {"override" , EnvOptions {Environment : map [string ]string {"FOO" : "23" }}, & defaultValidator {23 }, false },
383- {"prefix" , EnvOptions {Environment : map [string ]string {"PREFIX_FOO" : "42" }, Prefix : "PREFIX_" }, & simpleValidator {42 }, false },
384- {"nested" , EnvOptions {Environment : map [string ]string {"PREFIX_FOO" : "42" }}, & prefixValidator {simpleValidator {42 }}, false },
374+ {name : "nil" , error : true },
375+ {name : "nonptr" , io : simpleValidator {}, error : true },
376+ {name : "nilptr" , io : (* simpleValidator )(nil ), error : true },
377+ {name : "defaulterr" , io : new (nonStructValidator ), error : true },
378+ {
379+ name : "parseeerr" ,
380+ opts : EnvOptions {Environment : map [string ]string {"FOO" : "bar" }},
381+ io : & simpleValidator {},
382+ error : true ,
383+ },
384+ {
385+ name : "invalid" ,
386+ opts : EnvOptions {Environment : map [string ]string {"FOO" : "23" }},
387+ io : & simpleValidator {},
388+ error : true ,
389+ },
390+ {name : "simple" , opts : EnvOptions {Environment : map [string ]string {"FOO" : "42" }}, io : & simpleValidator {42 }},
391+ {name : "default" , io : & defaultValidator {42 }},
392+ {name : "override" , opts : EnvOptions {Environment : map [string ]string {"FOO" : "23" }}, io : & defaultValidator {23 }},
393+ {
394+ name : "prefix" ,
395+ opts : EnvOptions {Environment : map [string ]string {"PREFIX_FOO" : "42" }, Prefix : "PREFIX_" },
396+ io : & simpleValidator {42 },
397+ },
398+ {
399+ name : "nested" ,
400+ opts : EnvOptions {Environment : map [string ]string {"PREFIX_FOO" : "42" }},
401+ io : & prefixValidator {simpleValidator {42 }},
402+ },
385403 }
386404
387405 for _ , st := range subtests {
0 commit comments