changed default value of getenvint to 0. fix tests

Docker-DCO-1.1-Signed-off-by: Victor Vieux <victor.vieux@docker.com> (github: vieux)
This commit is contained in:
Victor Vieux
2014-01-31 02:06:08 +00:00
parent 7ced204372
commit 28b5ae8cc4
5 changed files with 16 additions and 8 deletions
+1 -1
View File
@@ -60,7 +60,7 @@ func (env *Env) GetInt64(key string) int64 {
s := strings.Trim(env.Get(key), " \t")
val, err := strconv.ParseInt(s, 10, 64)
if err != nil {
return -1
return 0
}
return val
}
+1 -1
View File
@@ -62,7 +62,7 @@ func TestSetenvInt(t *testing.T) {
if val := job.GetenvInt("bar"); val != 42 {
t.Fatalf("GetenvInt returns incorrect value: %d", val)
}
if val := job.GetenvInt("nonexistent"); val != -1 {
if val := job.GetenvInt("nonexistent"); val != 0 {
t.Fatalf("GetenvInt returns incorrect value: %d", val)
}
}