feat: enforce output version v1 and add version subcommand

This commit is contained in:
2026-04-08 23:59:55 +08:00
parent a6daaff0fa
commit c4fa0eadcc
14 changed files with 117 additions and 10 deletions
+5 -2
View File
@@ -7,12 +7,13 @@ use gitea_pr_review::render::markdown::render_markdown;
#[test]
fn render_markdown_includes_expected_sections_and_preserves_comment_markdown() {
let doc = PrReviewDocument {
version: "v1".into(),
meta: PrMeta {
repo: "org/repo".into(),
pr_index: 7,
title: "Fix parser".into(),
description: Some("PR body".into()),
fetched_at: Some("2026-04-08T12:34:56Z".into()),
fetched_at: "2026-04-08T12:34:56Z".into(),
state: "open".into(),
author: "alice".into(),
base_branch: "main".into(),
@@ -73,6 +74,7 @@ fn render_markdown_includes_expected_sections_and_preserves_comment_markdown() {
assert!(md.contains("# org/repo `#7` Fix parser"));
assert!(md.contains("## Metadata"));
assert!(md.contains("> version: v1"));
assert!(md.contains("> fetched at: 2026-04-08T12:34:56Z"));
assert!(md.contains("## Commits"));
assert!(md.contains("## Diff Stat"));
@@ -96,12 +98,13 @@ fn render_markdown_includes_expected_sections_and_preserves_comment_markdown() {
fn render_markdown_uses_minimal_fence_for_plain_text() {
let body = "plain text";
let doc = PrReviewDocument {
version: "v1".into(),
meta: PrMeta {
repo: "org/repo".into(),
pr_index: 1,
title: "T".into(),
description: None,
fetched_at: None,
fetched_at: "2026-04-08T12:34:56Z".into(),
state: "open".into(),
author: "alice".into(),
base_branch: "main".into(),