Use counter for index. Sort stray comments.

pull/4429/head
DanHam 9 years ago
parent f84dec91bc
commit 2bd9fa6c70
No known key found for this signature in database
GPG Key ID: 58E79AEDD6AA987E

@ -207,6 +207,7 @@ func TestProvisionerPrepare_EnvironmentVars(t *testing.T) {
if err != nil { if err != nil {
t.Fatalf("should not have error: %s", err) t.Fatalf("should not have error: %s", err)
} }
// Test when the env variable value contains an equals sign // Test when the env variable value contains an equals sign
config["environment_vars"] = []string{"good=withequals=true"} config["environment_vars"] = []string{"good=withequals=true"}
p = new(Provisioner) p = new(Provisioner)
@ -237,7 +238,6 @@ func TestProvisionerQuote_EnvironmentVars(t *testing.T) {
} }
expected := []string{ expected := []string{
"keyone=valueone", "keyone=valueone",
"keytwo=value\ntwo", "keytwo=value\ntwo",
"keythree='valuethree'", "keythree='valuethree'",
@ -250,9 +250,8 @@ func TestProvisionerQuote_EnvironmentVars(t *testing.T) {
p.Prepare(config) p.Prepare(config)
for i, expectedValue := range expected { for i, expectedValue := range expected {
if p.config.Vars[i] != expectedValue { if p.config.Vars[i] != expectedValue {
t.Fatalf("%s should be equal to %s", p.config.Vars[0], expectedValue) t.Fatalf("%s should be equal to %s", p.config.Vars[i], expectedValue)
} }
} }
@ -425,7 +424,7 @@ func TestProvisioner_createFlattenedEnvVars_windows(t *testing.T) {
t.Fatalf("expected flattened env vars to be: %s, got: %s", expectedEnvVars, flattenedEnvVars) t.Fatalf("expected flattened env vars to be: %s, got: %s", expectedEnvVars, flattenedEnvVars)
} }
// Environment variable with value containing equals. No Packer web server // Environment variable with value containing equals
p.config.Vars = []string{"FOO=bar=baz"} p.config.Vars = []string{"FOO=bar=baz"}
flattenedEnvVars, err = p.createFlattenedEnvVars() flattenedEnvVars, err = p.createFlattenedEnvVars()
if err != nil { if err != nil {
@ -436,7 +435,7 @@ func TestProvisioner_createFlattenedEnvVars_windows(t *testing.T) {
t.Fatalf("expected flattened env vars to be: %s, got: %s", expectedEnvVars, flattenedEnvVars) t.Fatalf("expected flattened env vars to be: %s, got: %s", expectedEnvVars, flattenedEnvVars)
} }
// Environment variable with value starting with equals. No Packer web server // Environment variable with value starting with equals
p.config.Vars = []string{"FOO==baz"} p.config.Vars = []string{"FOO==baz"}
flattenedEnvVars, err = p.createFlattenedEnvVars() flattenedEnvVars, err = p.createFlattenedEnvVars()
if err != nil { if err != nil {

Loading…
Cancel
Save