Skip to content

Commit

Permalink
Fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
clayne11 committed Jun 30, 2022
1 parent c84b6eb commit 5ed1c9f
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions codegen/templates/templates_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ func TestTemplateOverride(t *testing.T) {
}

func TestRenderFS(t *testing.T) {

tempDir := t.TempDir()

outDir := filepath.Join(tempDir, "output")
Expand All @@ -144,6 +145,10 @@ func TestRenderFS(t *testing.T) {
t.Fatal(err)
}

contents, _ := os.ReadFile(f.Name())
assert.Equal(t, "package \n\nimport (\n)\nthis is my test package\n", string(contents))
expectedString := "package \n\nimport (\n)\nthis is my test package"
actualContents, _ := os.ReadFile(f.Name())
actualContentsStr := string(actualContents)

// don't look at last character since it's \n on Linux and \r\n on Windows
assert.Equal(t, expectedString, actualContentsStr[:len(expectedString)])
}

0 comments on commit 5ed1c9f

Please sign in to comment.