| 7 | ) |
| 8 | |
| 9 | func Test_run(t *testing.T) { |
| 10 | dir := t.TempDir() |
| 11 | args := []string{"--man-page", "--website", "--doc-path", dir} |
| 12 | err := run(args) |
| 13 | if err != nil { |
| 14 | t.Fatalf("got error: %v", err) |
| 15 | } |
| 16 | |
| 17 | manPage, err := os.ReadFile(dir + "/gh-issue-create.1") |
| 18 | if err != nil { |
| 19 | t.Fatalf("error reading `gh-issue-create.1`: %v", err) |
| 20 | } |
| 21 | if !strings.Contains(string(manPage), `\fBgh issue create`) { |
| 22 | t.Fatal("man page corrupted") |
| 23 | } |
| 24 | |
| 25 | markdownPage, err := os.ReadFile(dir + "/gh_issue_create.md") |
| 26 | if err != nil { |
| 27 | t.Fatalf("error reading `gh_issue_create.md`: %v", err) |
| 28 | } |
| 29 | if !strings.Contains(string(markdownPage), `## gh issue create`) { |
| 30 | t.Fatal("markdown page corrupted") |
| 31 | } |
| 32 | } |