Commits

jonforums  committed 2ee75ce

Clean up context tests

  • Participants
  • Parent commits 894d489

Comments (0)

Files changed (1)

File env/context_test.go

 )
 
 func TestContextInit(t *testing.T) {
-	var ctx = NewContext()
-	var reg = RubyRegistry{RubyRegistryVersion, RubyMap{}}
+	ctx := NewContext()
+	reg := RubyRegistry{
+		Version:    RubyRegistryVersion,
+		Rubies:     RubyMap{},
+	}
 
 	if ctx.commandRegex == nil {
 		t.Error("Context's `commandRegex` member not initialized")
 	}
 
 	rv := ctx.Registry
-	if !reflect.DeepEqual(rv, reg) {
-		t.Errorf("Context's `Registry` member not initialized correctly\n  want: `%v`\n  got: `%v`",
-			reg,
-			rv)
+	if rv.Version != reg.Version {
+		t.Errorf("Context's `Registry.Version` member not initialized correctly\n  want: `%v`\n  got: `%v`",
+			reg.Version,
+			rv.Version)
+	}
+	if !reflect.DeepEqual(rv.Rubies, reg.Rubies) {
+		t.Errorf("Context's `Registry.Rubies` member not initialized correctly\n  want: `%v`\n  got: `%v`",
+			reg.Rubies,
+			rv.Rubies)
 	}
 }
 
 func TestContextCmdRegex(t *testing.T) {
-	var ctx = NewContext()
+	ctx := NewContext()
 	var r *regexp.Regexp
 
 	ctx.SetCmdRegex(`version`, `\Aver(?:sion)?\z`)
 }
 
 func TestContextHome(t *testing.T) {
-	var ctx = NewContext()
+	ctx := NewContext()
 
 	if ctx.Home() != `` {
 		t.Error("Context's `home` member not initialized to an empty string")
 }
 
 func TestContextCmd(t *testing.T) {
-	var ctx = NewContext()
+	ctx := NewContext()
 
 	if ctx.Cmd() != `` {
 		t.Error("Context's `command` member not initialized to an empty string")
 }
 
 func TestContextCmdArgs(t *testing.T) {
-	var ctx = NewContext()
+	ctx := NewContext()
 
 	if ctx.CmdArgs() != nil {
 		t.Error("Context's `commandArgs` member not initialized to a nil string slice")
 }
 
 func TestContextSetCmdAndArgs(t *testing.T) {
-	var ctx = NewContext()
+	ctx := NewContext()
 
 	cmdVal := `test_combined_command`
 	cmdArgsVal := []string{`combined_arg1`, `combined_arg2`, `combined_arg3`}