| 1 |
""" |
| 2 |
Module to test specific click-man issues. |
| 3 |
""" |
| 4 |
|
| 5 |
from click import Command, Context |
| 6 |
from click_man.core import generate_man_page |
| 7 |
|
| 8 |
|
| 9 |
def test_issue_59(): |
| 10 |
""" |
| 11 |
Test creating a man page with an indented docstring (issue #59) |
| 12 |
""" |
| 13 |
command = 'my-command' |
| 14 |
version = '1.0.0' |
| 15 |
date = '21-Feb-1994' |
| 16 |
short_help = 'Command to test man pages for click.' |
| 17 |
docstring = """ |
| 18 |
|
| 19 |
An imaginary description from an indented docstring, with newlines. |
| 20 |
|
| 21 |
""" |
| 22 |
cmd = Command(command, short_help=short_help, help=docstring) |
| 23 |
ctx = Context(cmd, info_name=command) |
| 24 |
man = generate_man_page(ctx, version=version, date=date) |
| 25 |
|
| 26 |
assert ( |
| 27 |
str(man) |
| 28 |
== r""".TH "MY-COMMAND" "1" "21-Feb-1994" "1.0.0" "my-command Manual" |
| 29 |
.SH NAME |
| 30 |
my-command \- Command to test man pages for click. |
| 31 |
.SH SYNOPSIS |
| 32 |
.B my-command |
| 33 |
[OPTIONS] |
| 34 |
.SH DESCRIPTION |
| 35 |
An imaginary description from an indented docstring, with newlines. |
| 36 |
""" |
| 37 |
) |