Skip to content

Commit

Permalink
馃敤 refactor(docs_test.go): remove commented out code
Browse files Browse the repository at this point in the history
馃悰 fix(docs_test.go): fix expected content type to byte array
  • Loading branch information
tarampampam committed Apr 14, 2023
1 parent 260031b commit 8940782
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions docs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
package cli

import (
"bytes"
"errors"
"io/fs"
"os"
Expand Down Expand Up @@ -60,9 +61,7 @@ Some other text`)
content, err := os.ReadFile(tmpFile.Name()) // read the file content
expect(t, err, nil)

// content = bytes.Replace(content, []byte("\r\n"), []byte{}, -1) // ignore windows line endings

expected := `# App readme file
expected := []byte(`# App readme file
Some description
Expand All @@ -71,9 +70,11 @@ Some description
` + string(expectedDocs) + `
<!--/GENERATED:CLI_DOCS-->
Some other text`
Some other text`)

expected = bytes.Replace(expected, []byte("\r\n"), []byte{}, -1) // ignore windows line endings

expect(t, string(content), expected) // content matches
expect(t, string(content), string(expected)) // content matches
})

t.Run("custom tags", func(t *testing.T) {
Expand All @@ -98,9 +99,7 @@ Some other text`)
content, err := os.ReadFile(tmpFile.Name()) // read the file content
expect(t, err, nil)

// content = bytes.Replace(content, []byte("\r\n"), []byte{}, -1) // ignore windows line endings

expected := `# App readme file
expected := []byte(`# App readme file
Some description
Expand All @@ -109,12 +108,14 @@ foo_BAR|baz
` + string(expectedDocs) + `
lorem+ipsum
Some other text`
Some other text`)

expected = bytes.Replace(expected, []byte("\r\n"), []byte{}, -1) // ignore windows line endings

t.Log(content)
t.Log([]byte(expected))
t.Log(expected)

expect(t, string(content), expected) // content matches
expect(t, string(content), string(expected)) // content matches
})

t.Run("missing file", func(t *testing.T) {
Expand Down

0 comments on commit 8940782

Please sign in to comment.