Wrap scenario descriptions in docstrings (#787)

Otherwise, the lines can get kind of long.
This commit is contained in:
Zanie Blue 2024-01-04 13:43:50 -06:00 committed by GitHub
parent f89c6456e3
commit 8ac6f9a198
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 16 additions and 5 deletions

View File

@ -110,7 +110,8 @@ fn requires_exact_version_does_not_exist() -> Result<()> {
/// requires-greater-version-does-not-exist
///
/// The user requires a version of `a` greater than `1.0.0` but only smaller or equal versions exist
/// The user requires a version of `a` greater than `1.0.0` but only smaller or
/// equal versions exist
///
/// requires-greater-version-does-not-exist-d34821ba
/// ├── environment
@ -161,7 +162,8 @@ fn requires_greater_version_does_not_exist() -> Result<()> {
/// requires-less-version-does-not-exist
///
/// The user requires a version of `a` less than `1.0.0` but only larger versions exist
/// The user requires a version of `a` less than `1.0.0` but only larger versions
/// exist
///
/// requires-less-version-does-not-exist-4088ec1b
/// ├── environment
@ -318,7 +320,8 @@ fn requires_direct_incompatible_versions() -> Result<()> {
/// requires-transitive-incompatible-with-root-version
///
/// The user requires packages `a` and `b` but `a` requires a different version of `b`
/// The user requires packages `a` and `b` but `a` requires a different version of
/// `b`
///
/// requires-transitive-incompatible-with-root-version-b3c83bbd
/// ├── environment
@ -381,7 +384,8 @@ fn requires_transitive_incompatible_with_root_version() -> Result<()> {
/// requires-transitive-incompatible-with-transitive
///
/// The user requires package `a` and `b`; `a` and `b` require different versions of `c`
/// The user requires package `a` and `b`; `a` and `b` require different versions of
/// `c`
///
/// requires-transitive-incompatible-with-transitive-a35362d1
/// ├── environment

View File

@ -20,7 +20,9 @@ mod common;
/// {{name}}
///
/// {{description}}
{{#description_lines}}
/// {{.}}
{{/description_lines}}
///
/// {{prefix}}
{{#tree}}

View File

@ -20,6 +20,7 @@ import json
import shutil
import subprocess
import sys
import textwrap
from pathlib import Path
@ -132,6 +133,10 @@ for index, scenario in enumerate(data["scenarios"]):
if scenario["name"] == "example":
data["scenarios"].pop(index)
# Wrap the description onto multiple lines
for scenario in data["scenarios"]:
scenario["description_lines"] = textwrap.wrap(scenario["description"], width=80)
# Render the template
print("Rendering template...", file=sys.stderr)
output = chevron_blue.render(template=TEMPLATE.read_text(), data=data, no_escape=True)