From a7d9d62996ed9c39a12196eab662334cf8a2b3c5 Mon Sep 17 00:00:00 2001 From: Megan Marsh Date: Mon, 4 Feb 2019 16:11:25 -0800 Subject: [PATCH] fix tests on windows --- builder/vagrant/artifact_test.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/builder/vagrant/artifact_test.go b/builder/vagrant/artifact_test.go index 794f5b1da..63e1db1ec 100644 --- a/builder/vagrant/artifact_test.go +++ b/builder/vagrant/artifact_test.go @@ -1,6 +1,7 @@ package vagrant import ( + "runtime" "strings" "testing" @@ -22,6 +23,9 @@ func TestArtifactId(t *testing.T) { } expected := "/my/dir/package.box" + if runtime.GOOS == "windows" { + expected = strings.Replace(expected, "/", "\\", -1) + } if strings.Compare(a.Id(), expected) != 0 { t.Fatalf("artifact ID should match: expected: %s received: %s", expected, a.Id()) } @@ -33,6 +37,9 @@ func TestArtifactString(t *testing.T) { BoxName: "package.box", } expected := "Vagrant box is /my/dir/package.box" + if runtime.GOOS == "windows" { + expected = strings.Replace(expected, "/", "\\", -1) + } if strings.Compare(a.String(), expected) != 0 { t.Fatalf("artifact string should match: expected: %s received: %s", expected, a.String())