Skip to content

Commit

Permalink
Merge pull request #14 from chezmoi/docs-test
Browse files Browse the repository at this point in the history
chore: Add trivial docs test
  • Loading branch information
twpayne authored Mar 4, 2024
2 parents 2568f54 + 86cad9d commit 62f7d15
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions docs/docs_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package docs_test

import (
"testing"

"github.com/alecthomas/assert/v2"

"github.com/chezmoi/templatefuncs/docs"
)

func TestReferences(t *testing.T) {
assert.Equal(t, docs.Reference{
Title: "`contains` *substring* *string*",
Body: "`contains` returns whether *substring* is in *string*.",
Example: "" +
"```text\n" +
"{{ \"abc\" | contains \"ab\" }}\n" +
"\n" +
"true\n" +
"```",
}, docs.References["contains"])
assert.Equal(t, docs.Reference{
Title: "`trimSpace` *string*",
Body: "`trimSpace` returns *string* with all spaces removed.",
Example: "```text\n" +
"{{ \" foobar \" | trimSpace }}\n" +
"\n" +
"foobar\n" +
"```",
}, docs.References["trimSpace"])
}

0 comments on commit 62f7d15

Please sign in to comment.