From b00f428a6ba335ca82f17c60ffbf9163237f4677 Mon Sep 17 00:00:00 2001 From: Silas Davis <silas@erisindustries.com> Date: Wed, 25 Jan 2017 14:27:51 +0000 Subject: [PATCH] Fix hell tests --- hell/merge_test.go | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/hell/merge_test.go b/hell/merge_test.go index f62849d3..cd59f4d0 100644 --- a/hell/merge_test.go +++ b/hell/merge_test.go @@ -1,11 +1,12 @@ package hell import ( - "fmt" "testing" - "github.com/stretchr/testify/assert" "strings" + + "github.com/Masterminds/glide/cfg" + "github.com/stretchr/testify/assert" ) const baseLockYml = `imports: @@ -52,11 +53,20 @@ testImports: [] ` func TestMergeGlideLockFiles(t *testing.T) { - lockYml, err := MergeGlideLockFiles(([]byte)(baseLockYml), ([]byte)(overrideLockYml)) + baseLockFile, err := cfg.LockfileFromYaml(([]byte)(baseLockYml)) + assert.NoError(t, err, "Lockfile should parse") + + overrideLockFile, err := cfg.LockfileFromYaml(([]byte)(overrideLockYml)) + assert.NoError(t, err, "Lockfile should parse") + + mergedLockFile, err := MergeGlideLockFiles(baseLockFile, overrideLockFile) assert.NoError(t, err, "Lockfiles should merge") - ymlLines := strings.Split(string(lockYml), "\n") + + mergedYmlBytes, err := mergedLockFile.Marshal() + assert.NoError(t, err, "Lockfile should marshal") + + ymlLines := strings.Split(string(mergedYmlBytes), "\n") // Drop the updated and hash lines actualYml := strings.Join(ymlLines[2:], "\n") - fmt.Println(actualYml) assert.Equal(t, expectedLockYml, actualYml) } -- GitLab