Documented the behavior of getOperation and updated existing test to match that behavior (missing key is a non-zero return value, per git behavior)

This commit is contained in:
Zach Musgrave
2019-03-11 15:42:01 -07:00
parent d5191167cd
commit 333b236a30
2 changed files with 4 additions and 2 deletions
+2
View File
@@ -83,6 +83,8 @@ func processConfigCommand(dEnv *env.DoltEnv, setCfgTypes *set.StrSet, opName str
panic("New operation added but not implemented.")
}
// Gets the config value for the key requested in the args, running the printFn given with the key and fetched value as
// arguments. If the key is not found, or if there is an error retrieving it, returns 1. Otherwise returns 0.
func getOperation(dEnv *env.DoltEnv, setCfgTypes *set.StrSet, args []string, printFn func(string, *string)) int {
if len(args) != 1 {
// matches git behavior... kinda dumb
+2 -2
View File
@@ -93,8 +93,8 @@ func TestConfig(t *testing.T) {
}
})
if ret != 0 {
t.Error("get operation failed")
if ret == 0 {
t.Error("get operation should return 1 for a key not found")
}
}