test: expand diagnostic showcase

This commit is contained in:
Dandaedre 2026-09-29 23:22:44 +02:00
parent dbf4049384
commit 8cf91c0507
Signed by: Dandaedre
GPG Key ID: 440C6592E8A26D99
7 changed files with 43 additions and 11 deletions

View File

@ -5,7 +5,7 @@ coverage = 92.23
[last_run_clean.run_duration]
secs = 31
nanos = 435206141
nanos = 493686186
[last_run_incremental]
run_status = "Success"

View File

@ -10,6 +10,8 @@ All notable changes to John Slop are recorded here. The format follows
- Made graphical Miette output easier to scan with marked rule-code titles,
attached diagnostic bodies, and spacing between complete findings.
- Expanded the expected-failure diagnostic showcase to include prose and source
rules plus the complete embedded replacement-character set.
- Adopted the measured three-package Cargo workspace. Shared package metadata,
dependency requirements, and lint policy now use workspace inheritance while
the reusable core remains isolated from CLI, async, and LSP dependencies.

View File

@ -46,22 +46,29 @@ as the formatter.
## Expected-failure diagnostic showcase
[`diagnostic-showcase.txt`](diagnostic-showcase.txt) deliberately contains every
kind of currently shipped prose signal. Its adjacent example configuration
promotes assistant self-identification from warning to error, making one run
show Miette advice, warning, and error diagnostics together:
[`diagnostic-showcase.txt`](diagnostic-showcase.txt) contains every currently
shipped prose signal, while
[`diagnostic-showcase/source.rs`](diagnostic-showcase/source.rs) adds the
source-placeholder and tutorial-narration rules plus all ten embedded
replacement characters. The adjacent example configuration promotes assistant
self-identification from warning to error and lifts the typography occurrence
cap for this display, making one run show Miette advice, warning, error, and
fixable diagnostics together:
```sh
cargo run --bin john-slop -- \
--config examples/diagnostic-showcase.toml \
--output miette --fail-level low \
examples/diagnostic-showcase.txt
examples/diagnostic-showcase.txt \
examples/diagnostic-showcase/source.rs
```
That command is expected to exit with status `1`: reaching the configured
threshold is the behavior under demonstration. The repository test asserts the
nonzero result rather than making the suite red. Run it with capture disabled to
print the complete report:
nonzero result and representative prose/source categories rather than requiring
exact equality with an evolving catalog. Keeping new diagnostic kinds visible
here is nevertheless part of the intended maintenance workflow. Run the test
with capture disabled to print the complete report:
```sh
cargo test --test example_fixtures \

View File

@ -3,3 +3,9 @@
[[rules]]
id = "assistant-self-identification"
severity = "error"
# Let the companion source fixture display every embedded replacement character
# instead of stopping at the production catalog's normal per-document cap.
[[rules]]
id = "typography-non-ascii-hyphen"
occurrence_cap = 10

View File

@ -0,0 +1,6 @@
fn main() {
// First, we declare an intentionally incomplete showcase value.
// Next, we leave the implementation placeholder visible for review.
// TODO: implement
let _replacement_characters = "‐ ‑ ‒ – — ― − ﹘ ﹣ -";
}

View File

@ -393,7 +393,7 @@ against the 90% floor.
## Milestone 15 — Comprehensive diagnostic showcase
- [ ] Extend the expected-failure showcase across prose and Rust fixtures so it
- [x] Extend the expected-failure showcase across prose and Rust fixtures so it
demonstrates every currently shipped heuristic kind and every embedded ASCII
replacement character where practical. Keep completeness aspirational rather
than coupling the test dynamically to future catalog additions; document the
@ -404,6 +404,11 @@ typography, source placeholders, tutorial narration, advice, warnings, errors,
fixable findings, and per-document summaries; tests pin representative coverage
and formatting without asserting exact equality with the evolving catalogs.
Accepted on 2026-09-29 after the showcase exercised all 11 currently shipped
heuristic rule IDs and all 10 embedded replacement characters across two
documents and 25 findings. Both feature matrices, formatting, Clippy, rustdoc,
and Tarpaulin passed; coverage remains 92.23% (1,342/1,455 lines).
## Deferred by design
- Statistical or model-based authorship classification.

View File

@ -140,7 +140,7 @@ fn formatter_cli_matches_every_shared_expected_file() {
}
#[test]
fn diagnostic_showcase_is_an_expected_threshold_failure() {
fn diagnostic_showcase_spans_prose_source_and_severities() {
let root = Path::new(env!("CARGO_MANIFEST_DIR"));
let config_home = tempfile::tempdir().expect("temp config home");
let output = Command::new(env!("CARGO_BIN_EXE_john-slop"))
@ -148,6 +148,7 @@ fn diagnostic_showcase_is_an_expected_threshold_failure() {
.args(["--output", "miette", "--fail-level", "low", "--config"])
.arg(root.join("examples/diagnostic-showcase.toml"))
.arg(root.join("examples/diagnostic-showcase.txt"))
.arg(root.join("examples/diagnostic-showcase/source.rs"))
.output()
.expect("run expected-failure diagnostic showcase");
let stdout = String::from_utf8(output.stdout).expect("UTF-8 diagnostic output");
@ -159,7 +160,12 @@ fn diagnostic_showcase_is_an_expected_threshold_failure() {
assert!(stdout.contains("assistant-self-identification"));
assert!(stdout.contains("prompt-response-scaffolding"));
assert!(stdout.contains("typography-non-ascii-hyphen"));
assert!(stdout.contains("source-placeholder-todo"));
assert!(stdout.contains("source-tutorial-narration"));
assert!(stdout.contains('‐'));
assert!(stdout.contains('-'));
assert!(stdout.contains("low-care evidence score: 71 (medium)"));
assert!(stdout.matches("low-care evidence score:").count() >= 2);
assert!(stdout.contains("advice"));
assert!(stdout.contains("warning"));
assert!(stdout.contains("error"));
@ -167,7 +173,7 @@ fn diagnostic_showcase_is_an_expected_threshold_failure() {
{
assert!(stdout.contains('\u{1b}'));
assert!(stdout.contains('╭'));
assert_eq!(stdout.matches("◆ ").count(), 12);
assert!(stdout.matches("◆ ").count() >= 12);
let lines = stdout.lines().collect::<Vec<_>>();
for (index, line) in lines.iter().enumerate() {
if line.starts_with("◆ ") {