cli/cmd/gen-docs/main_test.go
Mikel Olasagasti Uranga 46a7042b88
Bump cpuguy83/go-md2man from 2.0.1 to 2.0.3 (#8209)
Version 2.0.3 introduces a fix in PR
https://github.com/cpuguy83/go-md2man/pull/105 that breaks a test for
gen-doc, thus requires a small change in the test.
2023-10-18 07:17:20 +00:00

32 lines
724 B
Go

package main
import (
"os"
"strings"
"testing"
)
func Test_run(t *testing.T) {
dir := t.TempDir()
args := []string{"--man-page", "--website", "--doc-path", dir}
err := run(args)
if err != nil {
t.Fatalf("got error: %v", err)
}
manPage, err := os.ReadFile(dir + "/gh-issue-create.1")
if err != nil {
t.Fatalf("error reading `gh-issue-create.1`: %v", err)
}
if !strings.Contains(string(manPage), `\fBgh issue create`) {
t.Fatal("man page corrupted")
}
markdownPage, err := os.ReadFile(dir + "/gh_issue_create.md")
if err != nil {
t.Fatalf("error reading `gh_issue_create.md`: %v", err)
}
if !strings.Contains(string(markdownPage), `## gh issue create`) {
t.Fatal("markdown page corrupted")
}
}