From c233876e67aea3946d73890aeb9b96cfc4106edd Mon Sep 17 00:00:00 2001 From: Adam Date: Mon, 3 Feb 2020 11:52:37 +1100 Subject: [PATCH] fix windows test paths --- codegen/config/package_test.go | 5 +++-- codegen/config/resolver_test.go | 13 ++++++------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/codegen/config/package_test.go b/codegen/config/package_test.go index 2108944c680..239797e6aa5 100644 --- a/codegen/config/package_test.go +++ b/codegen/config/package_test.go @@ -1,6 +1,7 @@ package config import ( + "path/filepath" "testing" "github.com/stretchr/testify/require" @@ -19,7 +20,7 @@ func TestPackageConfig(t *testing.T) { require.Equal(t, "config_test_data", p.Pkg().Name()) require.Equal(t, "github.com/99designs/gqlgen/codegen/config/testdata", p.Pkg().Path()) - require.Contains(t, p.Filename, "codegen/config/testdata/example.go") + require.Contains(t, filepath.ToSlash(p.Filename), "codegen/config/testdata/example.go") require.Contains(t, p.Dir(), "codegen/config/testdata") }) @@ -35,7 +36,7 @@ func TestPackageConfig(t *testing.T) { require.Equal(t, "wololo", p.Pkg().Name()) require.Equal(t, "github.com/99designs/gqlgen/codegen/config/testdata", p.Pkg().Path()) - require.Contains(t, p.Filename, "codegen/config/testdata/example.go") + require.Contains(t, filepath.ToSlash(p.Filename), "codegen/config/testdata/example.go") require.Contains(t, p.Dir(), "codegen/config/testdata") }) diff --git a/codegen/config/resolver_test.go b/codegen/config/resolver_test.go index f9406aa820e..0c158faab46 100644 --- a/codegen/config/resolver_test.go +++ b/codegen/config/resolver_test.go @@ -1,6 +1,7 @@ package config import ( + "path/filepath" "testing" "github.com/stretchr/testify/require" @@ -20,7 +21,7 @@ func TestResolverConfig(t *testing.T) { require.Equal(t, "config_test_data", p.Pkg().Name()) require.Equal(t, "github.com/99designs/gqlgen/codegen/config/testdata", p.Pkg().Path()) - require.Contains(t, p.Filename, "codegen/config/testdata/example.go") + require.Contains(t, filepath.ToSlash(p.Filename), "codegen/config/testdata/example.go") require.Contains(t, p.Dir(), "codegen/config/testdata") }) @@ -36,7 +37,7 @@ func TestResolverConfig(t *testing.T) { require.Equal(t, "wololo", p.Pkg().Name()) require.Equal(t, "github.com/99designs/gqlgen/codegen/config/testdata", p.Pkg().Path()) - require.Contains(t, p.Filename, "codegen/config/testdata/example.go") + require.Contains(t, filepath.ToSlash(p.Filename), "codegen/config/testdata/example.go") require.Contains(t, p.Dir(), "codegen/config/testdata") }) @@ -83,9 +84,7 @@ func TestResolverConfig(t *testing.T) { require.Equal(t, "config_test_data", p.Pkg().Name()) require.Equal(t, "github.com/99designs/gqlgen/codegen/config/testdata", p.Pkg().Path()) - require.Equal(t, "github.com/99designs/gqlgen/codegen/config/testdata", p.Pkg().Path()) - - require.Contains(t, p.Filename, "codegen/config/testdata/resolver.go") + require.Contains(t, filepath.ToSlash(p.Filename), "codegen/config/testdata/resolver.go") require.Contains(t, p.Dir(), "codegen/config/testdata") }) @@ -101,7 +100,7 @@ func TestResolverConfig(t *testing.T) { require.Equal(t, "wololo", p.Pkg().Name()) require.Equal(t, "github.com/99designs/gqlgen/codegen/config/testdata", p.Pkg().Path()) - require.Contains(t, p.Filename, "codegen/config/testdata/resolver.go") + require.Contains(t, filepath.ToSlash(p.Filename), "codegen/config/testdata/resolver.go") require.Contains(t, p.Dir(), "codegen/config/testdata") }) @@ -117,7 +116,7 @@ func TestResolverConfig(t *testing.T) { require.Equal(t, "config_test_data", p.Pkg().Name()) require.Equal(t, "github.com/99designs/gqlgen/codegen/config/testdata", p.Pkg().Path()) - require.Contains(t, p.Filename, "codegen/config/testdata/asdf.go") + require.Contains(t, filepath.ToSlash(p.Filename), "codegen/config/testdata/asdf.go") require.Contains(t, p.Dir(), "codegen/config/testdata") })