rumdl 0.1.51

A fast Markdown linter written in Rust (Ru(st) MarkDown Linter)
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
//! Tests for CLI rule alias support (Issue #242) and unknown rule validation (Issue #243)
//!
//! Verifies that CLI flags --enable, --disable, --extend-enable, and --extend-disable
//! accept both rule IDs (MD001) and human-readable aliases (heading-increment).
//! Also verifies that unknown rule names produce warnings.

use std::fs;
use std::process::Command;
use tempfile::tempdir;

fn setup_test_file() -> tempfile::TempDir {
    let temp_dir = tempdir().unwrap();
    let base_path = temp_dir.path();

    // Create a test file that triggers MD001 (heading-increment) and MD013 (line-length)
    fs::write(
        base_path.join("test.md"),
        "# Test Header\n\n### Skip Level Header\n\nThis is a very long line that exceeds the typical line length limit and should trigger the line-length rule when enabled with proper configuration\n",
    )
    .unwrap();

    temp_dir
}

#[test]
fn test_enable_with_alias() {
    let temp_dir = setup_test_file();
    let base_path = temp_dir.path();
    let rumdl_exe = env!("CARGO_BIN_EXE_rumdl");

    // Test: --enable with alias should work
    let output = Command::new(rumdl_exe)
        .current_dir(base_path)
        .args(["check", "test.md", "--enable", "heading-increment", "--verbose"])
        .output()
        .expect("Failed to execute command");

    let stdout = String::from_utf8_lossy(&output.stdout);
    println!("Enable with alias output: {stdout}");

    // Should show MD001 enabled (resolved from heading-increment alias)
    assert!(
        stdout.contains("MD001"),
        "MD001 should be enabled via heading-increment alias"
    );
    // Should NOT show MD013 since we only enabled MD001
    assert!(
        !stdout.contains("MD013"),
        "MD013 should not be enabled when only heading-increment is specified"
    );
}

#[test]
fn test_enable_with_mixed_ids_and_aliases() {
    let temp_dir = setup_test_file();
    let base_path = temp_dir.path();
    let rumdl_exe = env!("CARGO_BIN_EXE_rumdl");

    // Test: --enable with mixed IDs and aliases
    let output = Command::new(rumdl_exe)
        .current_dir(base_path)
        .args(["check", "test.md", "--enable", "MD001,line-length", "--verbose"])
        .output()
        .expect("Failed to execute command");

    let stdout = String::from_utf8_lossy(&output.stdout);
    println!("Enable with mixed IDs and aliases: {stdout}");

    // Should show both MD001 and MD013 enabled
    assert!(stdout.contains("MD001"), "MD001 should be enabled");
    assert!(
        stdout.contains("MD013"),
        "MD013 should be enabled via line-length alias"
    );
}

#[test]
fn test_disable_with_alias() {
    let temp_dir = setup_test_file();
    let base_path = temp_dir.path();
    let rumdl_exe = env!("CARGO_BIN_EXE_rumdl");

    // Test: --disable with alias should work
    let output = Command::new(rumdl_exe)
        .current_dir(base_path)
        .args(["check", "test.md", "--disable", "heading-increment", "--verbose"])
        .output()
        .expect("Failed to execute command");

    let stdout = String::from_utf8_lossy(&output.stdout);
    println!("Disable with alias output: {stdout}");

    // Should NOT show MD001 in enabled rules
    let enabled_section = stdout
        .lines()
        .skip_while(|l| !l.contains("Enabled rules:"))
        .take_while(|l| !l.is_empty())
        .collect::<Vec<_>>()
        .join("\n");
    assert!(
        !enabled_section.contains("MD001"),
        "MD001 should be disabled via heading-increment alias"
    );
}

#[test]
fn test_enable_with_case_insensitive_alias() {
    let temp_dir = setup_test_file();
    let base_path = temp_dir.path();
    let rumdl_exe = env!("CARGO_BIN_EXE_rumdl");

    // Test: aliases should be case-insensitive
    let output = Command::new(rumdl_exe)
        .current_dir(base_path)
        .args(["check", "test.md", "--enable", "HEADING-INCREMENT", "--verbose"])
        .output()
        .expect("Failed to execute command");

    let stdout = String::from_utf8_lossy(&output.stdout);
    println!("Enable with uppercase alias: {stdout}");

    // Should resolve uppercase alias to MD001
    assert!(
        stdout.contains("MD001"),
        "MD001 should be enabled via uppercase HEADING-INCREMENT alias"
    );
}

#[test]
fn test_enable_with_underscore_alias() {
    let temp_dir = setup_test_file();
    let base_path = temp_dir.path();
    let rumdl_exe = env!("CARGO_BIN_EXE_rumdl");

    // Test: underscores should be converted to hyphens
    let output = Command::new(rumdl_exe)
        .current_dir(base_path)
        .args(["check", "test.md", "--enable", "heading_increment", "--verbose"])
        .output()
        .expect("Failed to execute command");

    let stdout = String::from_utf8_lossy(&output.stdout);
    println!("Enable with underscore alias: {stdout}");

    // Should resolve underscore alias to MD001
    assert!(
        stdout.contains("MD001"),
        "MD001 should be enabled via heading_increment alias (underscore variant)"
    );
}

#[test]
fn test_extend_enable_with_alias() {
    let temp_dir = setup_test_file();
    let base_path = temp_dir.path();
    let rumdl_exe = env!("CARGO_BIN_EXE_rumdl");

    // Create a config that enables only MD033
    fs::write(base_path.join(".rumdl.toml"), "[global]\nenable = [\"MD033\"]\n").unwrap();

    // Test: --extend-enable with alias should add to config
    let output = Command::new(rumdl_exe)
        .current_dir(base_path)
        .args(["check", "test.md", "--extend-enable", "heading-increment", "--verbose"])
        .output()
        .expect("Failed to execute command");

    let stdout = String::from_utf8_lossy(&output.stdout);
    println!("Extend-enable with alias: {stdout}");

    // Should show both MD033 (from config) and MD001 (from extend-enable alias)
    assert!(
        stdout.contains("MD001"),
        "MD001 should be enabled via extend-enable heading-increment alias"
    );
    assert!(stdout.contains("MD033"), "MD033 should still be enabled from config");
}

#[test]
fn test_extend_disable_with_alias() {
    let temp_dir = setup_test_file();
    let base_path = temp_dir.path();
    let rumdl_exe = env!("CARGO_BIN_EXE_rumdl");

    // Test: --extend-disable with alias should disable rule
    let output = Command::new(rumdl_exe)
        .current_dir(base_path)
        .args(["check", "test.md", "--extend-disable", "heading-increment", "--verbose"])
        .output()
        .expect("Failed to execute command");

    let stdout = String::from_utf8_lossy(&output.stdout);
    println!("Extend-disable with alias: {stdout}");

    // Should NOT show MD001 in enabled rules
    let enabled_section = stdout
        .lines()
        .skip_while(|l| !l.contains("Enabled rules:"))
        .take_while(|l| !l.is_empty())
        .collect::<Vec<_>>()
        .join("\n");
    assert!(
        !enabled_section.contains("MD001"),
        "MD001 should be disabled via extend-disable heading-increment alias"
    );
}

#[test]
fn test_multiple_aliases_comma_separated() {
    let temp_dir = setup_test_file();
    let base_path = temp_dir.path();
    let rumdl_exe = env!("CARGO_BIN_EXE_rumdl");

    // Test: multiple aliases in comma-separated list
    let output = Command::new(rumdl_exe)
        .current_dir(base_path)
        .args([
            "check",
            "test.md",
            "--enable",
            "heading-increment,line-length,no-bare-urls",
            "--verbose",
        ])
        .output()
        .expect("Failed to execute command");

    let stdout = String::from_utf8_lossy(&output.stdout);
    println!("Multiple aliases: {stdout}");

    // Should resolve all three aliases
    assert!(
        stdout.contains("MD001"),
        "MD001 should be enabled via heading-increment"
    );
    assert!(stdout.contains("MD013"), "MD013 should be enabled via line-length");
    assert!(stdout.contains("MD034"), "MD034 should be enabled via no-bare-urls");
}

#[test]
fn test_enable_disable_with_aliases() {
    let temp_dir = setup_test_file();
    let base_path = temp_dir.path();
    let rumdl_exe = env!("CARGO_BIN_EXE_rumdl");

    // Test: --enable with --disable using aliases
    let output = Command::new(rumdl_exe)
        .current_dir(base_path)
        .args([
            "check",
            "test.md",
            "--enable",
            "heading-increment,line-length",
            "--disable",
            "line-length",
            "--verbose",
        ])
        .output()
        .expect("Failed to execute command");

    let stdout = String::from_utf8_lossy(&output.stdout);
    println!("Enable+Disable with aliases: {stdout}");

    // Should show MD001 but NOT MD013 (disabled via alias)
    assert!(stdout.contains("MD001"), "MD001 should be enabled");

    // Check enabled rules section specifically
    let enabled_section = stdout
        .lines()
        .skip_while(|l| !l.contains("Enabled rules:"))
        .take_while(|l| !l.is_empty())
        .collect::<Vec<_>>()
        .join("\n");
    assert!(
        !enabled_section.contains("MD013"),
        "MD013 should be disabled via line-length alias in --disable"
    );
}

// ============================================================================
// Issue #243: Unknown rule validation tests
// ============================================================================

#[test]
fn test_unknown_rule_in_enable_produces_warning() {
    let temp_dir = setup_test_file();
    let base_path = temp_dir.path();
    let rumdl_exe = env!("CARGO_BIN_EXE_rumdl");

    // Test: --enable with unknown rule should produce warning
    let output = Command::new(rumdl_exe)
        .current_dir(base_path)
        .args(["check", "test.md", "--enable", "abc"])
        .output()
        .expect("Failed to execute command");

    let stderr = String::from_utf8_lossy(&output.stderr);
    println!("Unknown rule stderr: {stderr}");

    assert!(
        stderr.contains("[cli warning]"),
        "Should produce a CLI warning for unknown rule"
    );
    assert!(
        stderr.contains("Unknown rule in --enable: abc"),
        "Warning should mention the unknown rule name"
    );
}

#[test]
fn test_unknown_rule_in_disable_produces_warning() {
    let temp_dir = setup_test_file();
    let base_path = temp_dir.path();
    let rumdl_exe = env!("CARGO_BIN_EXE_rumdl");

    let output = Command::new(rumdl_exe)
        .current_dir(base_path)
        .args(["check", "test.md", "--disable", "xyz"])
        .output()
        .expect("Failed to execute command");

    let stderr = String::from_utf8_lossy(&output.stderr);

    assert!(
        stderr.contains("Unknown rule in --disable: xyz"),
        "Should warn about unknown rule in --disable"
    );
}

#[test]
fn test_unknown_rule_in_extend_enable_produces_warning() {
    let temp_dir = setup_test_file();
    let base_path = temp_dir.path();
    let rumdl_exe = env!("CARGO_BIN_EXE_rumdl");

    let output = Command::new(rumdl_exe)
        .current_dir(base_path)
        .args(["check", "test.md", "--extend-enable", "nonexistent"])
        .output()
        .expect("Failed to execute command");

    let stderr = String::from_utf8_lossy(&output.stderr);

    assert!(
        stderr.contains("Unknown rule in --extend-enable: nonexistent"),
        "Should warn about unknown rule in --extend-enable"
    );
}

#[test]
fn test_unknown_rule_in_extend_disable_produces_warning() {
    let temp_dir = setup_test_file();
    let base_path = temp_dir.path();
    let rumdl_exe = env!("CARGO_BIN_EXE_rumdl");

    let output = Command::new(rumdl_exe)
        .current_dir(base_path)
        .args(["check", "test.md", "--extend-disable", "fake-rule"])
        .output()
        .expect("Failed to execute command");

    let stderr = String::from_utf8_lossy(&output.stderr);

    assert!(
        stderr.contains("Unknown rule in --extend-disable: fake-rule"),
        "Should warn about unknown rule in --extend-disable"
    );
}

#[test]
fn test_unknown_rule_suggests_similar() {
    let temp_dir = setup_test_file();
    let base_path = temp_dir.path();
    let rumdl_exe = env!("CARGO_BIN_EXE_rumdl");

    // Test: typo in rule name should suggest correct spelling
    let output = Command::new(rumdl_exe)
        .current_dir(base_path)
        .args(["check", "test.md", "--enable", "line-lenght"]) // typo: lenght
        .output()
        .expect("Failed to execute command");

    let stderr = String::from_utf8_lossy(&output.stderr);
    println!("Typo suggestion stderr: {stderr}");

    assert!(
        stderr.contains("did you mean"),
        "Should suggest similar rule name for typos"
    );
    assert!(
        stderr.contains("line-length"),
        "Should suggest 'line-length' for 'line-lenght'"
    );
}

#[test]
fn test_mixed_valid_and_invalid_rules() {
    let temp_dir = setup_test_file();
    let base_path = temp_dir.path();
    let rumdl_exe = env!("CARGO_BIN_EXE_rumdl");

    // Test: mix of valid and invalid rules
    let output = Command::new(rumdl_exe)
        .current_dir(base_path)
        .args(["check", "test.md", "--enable", "MD001,abc,MD003", "--verbose"])
        .output()
        .expect("Failed to execute command");

    let stdout = String::from_utf8_lossy(&output.stdout);
    let stderr = String::from_utf8_lossy(&output.stderr);

    // Should warn about 'abc'
    assert!(
        stderr.contains("Unknown rule in --enable: abc"),
        "Should warn about unknown rule 'abc'"
    );

    // Should still enable valid rules
    assert!(
        stdout.contains("MD001"),
        "MD001 should still be enabled despite invalid rule in list"
    );
    assert!(
        stdout.contains("MD003"),
        "MD003 should still be enabled despite invalid rule in list"
    );
}

#[test]
fn test_special_all_value_is_valid() {
    let temp_dir = setup_test_file();
    let base_path = temp_dir.path();
    let rumdl_exe = env!("CARGO_BIN_EXE_rumdl");

    // Test: "all" special value should not produce warning
    let output = Command::new(rumdl_exe)
        .current_dir(base_path)
        .args(["check", "test.md", "--disable", "all"])
        .output()
        .expect("Failed to execute command");

    let stderr = String::from_utf8_lossy(&output.stderr);

    assert!(
        !stderr.contains("[cli warning]"),
        "'all' should be a valid special value and not produce warnings"
    );
}

#[test]
fn test_silent_flag_suppresses_cli_warnings() {
    let temp_dir = setup_test_file();
    let base_path = temp_dir.path();
    let rumdl_exe = env!("CARGO_BIN_EXE_rumdl");

    // Test: --silent should suppress CLI warnings
    let output = Command::new(rumdl_exe)
        .current_dir(base_path)
        .args(["check", "test.md", "--enable", "unknown-rule", "--silent"])
        .output()
        .expect("Failed to execute command");

    let stderr = String::from_utf8_lossy(&output.stderr);

    assert!(
        !stderr.contains("[cli warning]"),
        "--silent should suppress CLI warnings"
    );
}

/// Test that inline config comments with unknown rules produce warnings
#[test]
fn test_inline_config_unknown_rule_warning() {
    let temp_dir = tempdir().expect("Failed to create temp dir");
    let test_file = temp_dir.path().join("test.md");
    let rumdl_exe = env!("CARGO_BIN_EXE_rumdl");

    // Create a file with an inline config comment using an unknown rule
    fs::write(
        &test_file,
        r#"# Test
<!-- rumdl-disable nonexistent-rule -->
Some content
"#,
    )
    .expect("Failed to write test file");

    let output = Command::new(rumdl_exe)
        .args(["check", "--no-cache", test_file.to_str().unwrap()])
        .output()
        .expect("Failed to execute command");

    let stderr = String::from_utf8_lossy(&output.stderr);
    println!("Inline config warning stderr: {stderr}");

    assert!(
        stderr.contains("[inline config warning]"),
        "Should produce an inline config warning for unknown rule"
    );
    assert!(
        stderr.contains("nonexistent-rule"),
        "Warning should mention the unknown rule name"
    );
}

/// Test that inline config comments with valid rules don't produce warnings
#[test]
fn test_inline_config_valid_rule_no_warning() {
    let temp_dir = tempdir().expect("Failed to create temp dir");
    let test_file = temp_dir.path().join("test.md");
    let rumdl_exe = env!("CARGO_BIN_EXE_rumdl");

    // Create a file with an inline config comment using a valid rule
    fs::write(
        &test_file,
        r#"# Test
<!-- rumdl-disable MD013 -->
Some content
"#,
    )
    .expect("Failed to write test file");

    let output = Command::new(rumdl_exe)
        .args(["check", "--no-cache", test_file.to_str().unwrap()])
        .output()
        .expect("Failed to execute command");

    let stderr = String::from_utf8_lossy(&output.stderr);

    assert!(
        !stderr.contains("[inline config warning]"),
        "Should not produce inline config warning for valid rule MD013"
    );
}

/// Test that inline config warnings are suppressed with --silent
#[test]
fn test_inline_config_warning_silent() {
    let temp_dir = tempdir().expect("Failed to create temp dir");
    let test_file = temp_dir.path().join("test.md");
    let rumdl_exe = env!("CARGO_BIN_EXE_rumdl");

    // Create a file with an inline config comment using an unknown rule
    fs::write(
        &test_file,
        r#"# Test
<!-- rumdl-disable nonexistent-rule -->
Some content
"#,
    )
    .expect("Failed to write test file");

    let output = Command::new(rumdl_exe)
        .args(["check", "--no-cache", "--silent", test_file.to_str().unwrap()])
        .output()
        .expect("Failed to execute command");

    let stderr = String::from_utf8_lossy(&output.stderr);

    assert!(
        !stderr.contains("[inline config warning]"),
        "--silent should suppress inline config warnings"
    );
}

/// Test that inline config warning includes did-you-mean suggestion
#[test]
fn test_inline_config_warning_suggestion() {
    let temp_dir = tempdir().expect("Failed to create temp dir");
    let test_file = temp_dir.path().join("test.md");
    let rumdl_exe = env!("CARGO_BIN_EXE_rumdl");

    // Create a file with an inline config comment using a typo of a valid rule
    fs::write(
        &test_file,
        r#"# Test
<!-- rumdl-disable MD00 -->
Some content
"#,
    )
    .expect("Failed to write test file");

    let output = Command::new(rumdl_exe)
        .args(["check", "--no-cache", test_file.to_str().unwrap()])
        .output()
        .expect("Failed to execute command");

    let stderr = String::from_utf8_lossy(&output.stderr);
    println!("Suggestion warning stderr: {stderr}");

    assert!(
        stderr.contains("[inline config warning]"),
        "Should produce an inline config warning"
    );
    assert!(stderr.contains("did you mean"), "Warning should include a suggestion");
}

/// Test that inline config warnings work via stdin
#[test]
fn test_inline_config_warning_stdin() {
    use std::io::Write;
    use std::process::Stdio;

    let rumdl_exe = env!("CARGO_BIN_EXE_rumdl");
    let content = r#"# Test
<!-- rumdl-disable nonexistent-rule -->
Some content
"#;

    let mut child = Command::new(rumdl_exe)
        .args(["check", "--stdin"])
        .stdin(Stdio::piped())
        .stdout(Stdio::piped())
        .stderr(Stdio::piped())
        .spawn()
        .expect("Failed to spawn command");

    {
        let stdin = child.stdin.as_mut().expect("Failed to open stdin");
        stdin.write_all(content.as_bytes()).expect("Failed to write to stdin");
    }

    let output = child.wait_with_output().expect("Failed to read output");
    let stderr = String::from_utf8_lossy(&output.stderr);
    println!("Stdin inline config warning stderr: {stderr}");

    assert!(
        stderr.contains("[inline config warning]"),
        "Should produce an inline config warning via stdin"
    );
    assert!(
        stderr.contains("nonexistent-rule"),
        "Warning should mention the unknown rule name"
    );
}

/// Test that configure-file comments are validated
#[test]
fn test_inline_config_configure_file_warning() {
    let temp_dir = tempdir().expect("Failed to create temp dir");
    let test_file = temp_dir.path().join("test.md");
    let rumdl_exe = env!("CARGO_BIN_EXE_rumdl");

    // Create a file with a configure-file comment using an unknown rule
    fs::write(
        &test_file,
        r#"# Test
<!-- rumdl-configure-file { "nonexistent_rule": { "enabled": true } } -->
Some content
"#,
    )
    .expect("Failed to write test file");

    let output = Command::new(rumdl_exe)
        .args(["check", "--no-cache", test_file.to_str().unwrap()])
        .output()
        .expect("Failed to execute command");

    let stderr = String::from_utf8_lossy(&output.stderr);
    println!("Configure-file warning stderr: {stderr}");

    assert!(
        stderr.contains("[inline config warning]"),
        "Should produce an inline config warning for configure-file"
    );
    assert!(
        stderr.contains("nonexistent_rule"),
        "Warning should mention the unknown rule name"
    );
    assert!(
        stderr.contains("configure-file"),
        "Warning should mention configure-file comment type"
    );
}

/// Test that markdownlint-* variants also produce warnings for unknown rules
#[test]
fn test_inline_config_markdownlint_variant_warning() {
    let temp_dir = tempdir().expect("Failed to create temp dir");
    let test_file = temp_dir.path().join("test.md");
    let rumdl_exe = env!("CARGO_BIN_EXE_rumdl");

    // Create a file with a markdownlint-disable comment using an unknown rule
    fs::write(
        &test_file,
        r#"# Test
<!-- markdownlint-disable nonexistent-rule -->
Some content
"#,
    )
    .expect("Failed to write test file");

    let output = Command::new(rumdl_exe)
        .args(["check", "--no-cache", test_file.to_str().unwrap()])
        .output()
        .expect("Failed to execute command");

    let stderr = String::from_utf8_lossy(&output.stderr);
    println!("Markdownlint variant warning stderr: {stderr}");

    assert!(
        stderr.contains("[inline config warning]"),
        "Should produce an inline config warning for markdownlint-* variant"
    );
    assert!(
        stderr.contains("nonexistent-rule"),
        "Warning should mention the unknown rule name"
    );
}