Merge pull request #754 from Masterminds/fix/windows

Fix tests on windows and add win CI testing
diff --git a/README.md b/README.md
index a8c27ff..208b3a6 100644
--- a/README.md
+++ b/README.md
@@ -12,7 +12,9 @@
 installed by a tool (e.g. glide), similar to `go get` or they can be vendored and
 distributed with the package.
 
-[![Build Status](https://travis-ci.org/Masterminds/glide.svg)](https://travis-ci.org/Masterminds/glide) [![Go Report Card](https://goreportcard.com/badge/github.com/Masterminds/glide)](https://goreportcard.com/report/github.com/Masterminds/glide) [![GoDoc](https://godoc.org/github.com/Masterminds/glide?status.svg)](https://godoc.org/github.com/Masterminds/glide) [![Documentation Status](https://readthedocs.org/projects/glide/badge/?version=stable)](http://glide.readthedocs.org/en/stable/?badge=stable) [![Documentation Status](https://readthedocs.org/projects/glide/badge/?version=latest)](http://glide.readthedocs.org/en/latest/?badge=latest) [![Join the chat at https://gitter.im/Masterminds/glide](https://badges.gitter.im/Masterminds/glide.svg)](https://gitter.im/Masterminds/glide?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
+[![Build Status](https://travis-ci.org/Masterminds/glide.svg)](https://travis-ci.org/Masterminds/glide)
+[![Build status](https://ci.appveyor.com/api/projects/status/3pl4ytgdlfj852li?svg=true&passingText=windows%20build%20passing&failingText=windows%20build%20failing)](https://ci.appveyor.com/project/mattfarina/glide-a8xtg)
+[![Go Report Card](https://goreportcard.com/badge/github.com/Masterminds/glide)](https://goreportcard.com/report/github.com/Masterminds/glide) [![GoDoc](https://godoc.org/github.com/Masterminds/glide?status.svg)](https://godoc.org/github.com/Masterminds/glide) [![Documentation Status](https://readthedocs.org/projects/glide/badge/?version=stable)](http://glide.readthedocs.org/en/stable/?badge=stable) [![Documentation Status](https://readthedocs.org/projects/glide/badge/?version=latest)](http://glide.readthedocs.org/en/latest/?badge=latest) [![Join the chat at https://gitter.im/Masterminds/glide](https://badges.gitter.im/Masterminds/glide.svg)](https://gitter.im/Masterminds/glide?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
 
 ### Golang Dep
 
diff --git a/action/plugin_test.go b/action/plugin_test.go
index 95a7b15..72826a1 100644
--- a/action/plugin_test.go
+++ b/action/plugin_test.go
@@ -2,6 +2,7 @@
 
 import (
 	"os"
+	"runtime"
 	"testing"
 
 	"github.com/Masterminds/glide/msg"
@@ -11,7 +12,15 @@
 	wd, _ := os.Getwd()
 	os.Chdir("../testdata/plugin")
 	msg.Default.PanicOnDie = true
-	cmd := "hello"
+	var cmd string
+
+	// Windows scripts for testing (batch) are different from shells scripts.
+	// Making sure the plugin works in both bases.
+	if runtime.GOOS == "windows" {
+		cmd = "hello-win"
+	} else {
+		cmd = "hello"
+	}
 	args := []string{"a", "b"}
 	// FIXME: Trapping the panic is the nice thing to do.
 	Plugin(cmd, args)
diff --git a/appveyor.yml b/appveyor.yml
new file mode 100644
index 0000000..26a402e
--- /dev/null
+++ b/appveyor.yml
@@ -0,0 +1,22 @@
+
+version: build-{build}.{branch}
+
+clone_folder: C:\gopath\src\github.com\Masterminds\glide
+shallow_clone: true
+
+environment:
+  GOPATH: C:\gopath
+
+platform:
+  - x64
+
+build: off
+
+install:
+  - go version
+  - go env
+
+test_script:
+  - go test -v . ./gb ./path ./action ./tree ./util ./godep ./godep/strip ./gpm ./cfg ./dependency ./importer ./msg ./repo ./mirrors
+
+deploy: off
diff --git a/dependency/resolver_test.go b/dependency/resolver_test.go
index f4b44d9..3d850b5 100644
--- a/dependency/resolver_test.go
+++ b/dependency/resolver_test.go
@@ -21,10 +21,10 @@
 	}
 
 	expect := []string{
-		"github.com/Masterminds/semver",
-		"github.com/Masterminds/vcs",
-		"gopkg.in/yaml.v2",
-		"github.com/codegangsta/cli",
+		filepath.FromSlash("github.com/Masterminds/semver"),
+		filepath.FromSlash("github.com/Masterminds/vcs"),
+		filepath.FromSlash("gopkg.in/yaml.v2"),
+		filepath.FromSlash("github.com/codegangsta/cli"),
 	}
 
 	for _, p := range expect {
@@ -77,7 +77,7 @@
 		t.Errorf("Expected 1 dep, got %d: %s", len(l), l[0])
 	}
 
-	if !strings.HasSuffix("github.com/codegangsta/cli", l[0]) {
+	if !strings.HasSuffix(filepath.FromSlash("github.com/codegangsta/cli"), l[0]) {
 		t.Errorf("Unexpected package name: %s", l[0])
 	}
 }
diff --git a/path/path_test.go b/path/path_test.go
index 77a0276..ca0492b 100644
--- a/path/path_test.go
+++ b/path/path_test.go
@@ -3,6 +3,7 @@
 import (
 	"os"
 	"path/filepath"
+	"runtime"
 	"testing"
 )
 
@@ -35,7 +36,7 @@
 	}
 	wd, _ := os.Getwd()
 
-	os.Chdir(filepath.Join(td, "a/b/c"))
+	os.Chdir(filepath.Join(td, "a", "b", "c"))
 	res, err := Vendor()
 	if err != nil {
 		t.Errorf("Failed to resolve vendor directory: %s", err)
@@ -45,12 +46,23 @@
 		t.Errorf("Failed to find vendor: expected %s got %s", expect, res)
 	}
 
-	os.Chdir(filepath.Join(td, "x/y/z"))
+	os.Chdir(filepath.Join(td, "x", "y", "z"))
 	res, err = Vendor()
 	if err != nil {
 		t.Errorf("Failed to resolve vendor directory: %s", err)
 	}
-	expect = filepath.Join(td, "x", "symlinked_vendor")
+
+	// Windows symlinks are different than *nix and they can be inconsistent.
+	// The current testing only works for *nix testing and windows doesn't follow
+	// the symlinks. If this is a vendor.lnk file in windows this won't work for
+	// the go toolchain. If this is a windows link you need access to create one
+	// which isn't consistent.
+	// If there is a better way would love to know.
+	if runtime.GOOS == "windows" {
+		expect = filepath.Join(td, "x", "vendor")
+	} else {
+		expect = filepath.Join(td, "x", "symlinked_vendor")
+	}
 	if res != expect {
 		t.Errorf("Failed to find vendor: expected %s got %s", expect, res)
 	}
diff --git a/testdata/path/x/symlinked_vendor/placeholder.empty b/testdata/path/x/symlinked_vendor/placeholder.empty
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/testdata/path/x/symlinked_vendor/placeholder.empty
diff --git a/testdata/plugin/glide-hello-win.bat b/testdata/plugin/glide-hello-win.bat
new file mode 100644
index 0000000..1a1cc1e
--- /dev/null
+++ b/testdata/plugin/glide-hello-win.bat
@@ -0,0 +1,2 @@
+@echo off
+echo "Hello from the other glide"