quickmark-core 1.1.0

Lightning-fast Markdown/CommonMark linter core library with tree-sitter based parsing
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
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
use core::fmt;
use serde::Deserialize;
use std::rc::Rc;
use tree_sitter::Node;

use crate::linter::{range_from_tree_sitter, Context, RuleLinter, RuleViolation};

use super::{Rule, RuleType};

// MD003-specific configuration types
#[derive(Debug, PartialEq, Clone, Deserialize)]
pub enum HeadingStyle {
    #[serde(rename = "consistent")]
    Consistent,
    #[serde(rename = "atx")]
    ATX,
    #[serde(rename = "setext")]
    Setext,
    #[serde(rename = "atx_closed")]
    ATXClosed,
    #[serde(rename = "setext_with_atx")]
    SetextWithATX,
    #[serde(rename = "setext_with_atx_closed")]
    SetextWithATXClosed,
}

impl Default for HeadingStyle {
    fn default() -> Self {
        Self::Consistent
    }
}

#[derive(Debug, PartialEq, Clone, Deserialize)]
pub struct MD003HeadingStyleTable {
    #[serde(default)]
    pub style: HeadingStyle,
}

impl Default for MD003HeadingStyleTable {
    fn default() -> Self {
        Self {
            style: HeadingStyle::Consistent,
        }
    }
}

#[derive(PartialEq, Debug)]
enum Style {
    Setext,
    Atx,
    AtxClosed,
}

impl fmt::Display for Style {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        match self {
            Style::Setext => write!(f, "setext"),
            Style::Atx => write!(f, "atx"),
            Style::AtxClosed => write!(f, "atx_closed"),
        }
    }
}

pub(crate) struct MD003Linter {
    context: Rc<Context>,
    enforced_style: Option<Style>,
    violations: Vec<RuleViolation>,
}

impl MD003Linter {
    pub fn new(context: Rc<Context>) -> Self {
        // Access MD003 config through the centralized config structure
        let md003_config = &context.config.linters.settings.heading_style;
        let enforced_style = match md003_config.style {
            HeadingStyle::ATX => Some(Style::Atx),
            HeadingStyle::Setext => Some(Style::Setext),
            HeadingStyle::ATXClosed => Some(Style::AtxClosed),
            HeadingStyle::SetextWithATX => None, // Allow both setext and atx
            HeadingStyle::SetextWithATXClosed => None, // Allow setext and atx_closed
            _ => None,
        };
        Self {
            context,
            enforced_style,
            violations: Vec::new(),
        }
    }

    fn get_heading_level(&self, node: &Node) -> u8 {
        let mut cursor = node.walk();
        match node.kind() {
            "atx_heading" => node
                .children(&mut cursor)
                .find_map(|child| {
                    let kind = child.kind();
                    if kind.starts_with("atx_h") && kind.ends_with("_marker") {
                        // "atx_h3_marker" -> 3
                        kind.get(5..6)?.parse::<u8>().ok()
                    } else {
                        None
                    }
                })
                .unwrap_or(1),
            "setext_heading" => node
                .children(&mut cursor)
                .find_map(|child| match child.kind() {
                    "setext_h1_underline" => Some(1),
                    "setext_h2_underline" => Some(2),
                    _ => None,
                })
                .unwrap_or(1),
            _ => 1,
        }
    }

    fn is_atx_closed(&self, node: &Node) -> bool {
        // Use the idiomatic tree-sitter way to get the node's text.
        // This is more efficient than slicing the whole document manually.
        if let Ok(heading_text) = node.utf8_text(self.context.get_document_content().as_bytes()) {
            // Trim trailing whitespace and check if the heading ends with '#'.
            heading_text.trim_end().ends_with('#')
        } else {
            false
        }
    }

    fn add_violation(&mut self, node: &Node, expected: &str, actual: &Style) {
        self.violations.push(RuleViolation::new(
            &MD003,
            format!(
                "{} [Expected: {}; Actual: {}]",
                MD003.description, expected, actual
            ),
            self.context.file_path.clone(),
            range_from_tree_sitter(&node.range()),
        ));
    }
}

impl RuleLinter for MD003Linter {
    fn feed(&mut self, node: &Node) {
        let style = match node.kind() {
            "atx_heading" => {
                // Check if it's closed (has closing hashes)
                if self.is_atx_closed(node) {
                    Some(Style::AtxClosed)
                } else {
                    Some(Style::Atx)
                }
            }
            "setext_heading" => Some(Style::Setext),
            _ => None,
        };

        if let Some(style) = style {
            let level = self.get_heading_level(node);
            let config_style = &self.context.config.linters.settings.heading_style.style;

            match config_style {
                HeadingStyle::SetextWithATX => {
                    // Levels 1-2: must be setext, Levels 3+: must be atx (open), not atx_closed
                    if level <= 2 {
                        if style != Style::Setext {
                            self.add_violation(node, "setext", &style);
                        }
                    } else if style != Style::Atx {
                        self.add_violation(node, "atx", &style);
                    }
                }
                HeadingStyle::SetextWithATXClosed => {
                    // Levels 1-2: must be setext, Levels 3+: must be atx_closed, not plain atx
                    if level <= 2 {
                        if style != Style::Setext {
                            self.add_violation(node, "setext", &style);
                        }
                    } else if style != Style::AtxClosed {
                        self.add_violation(node, "atx_closed", &style);
                    }
                }
                _ => {
                    // For single-style configurations, check against enforced style
                    if let Some(enforced_style) = &self.enforced_style {
                        if style != *enforced_style {
                            self.add_violation(node, &enforced_style.to_string(), &style);
                        }
                    } else {
                        self.enforced_style = Some(style);
                    }
                }
            }
        }
    }

    fn finalize(&mut self) -> Vec<RuleViolation> {
        std::mem::take(&mut self.violations)
    }
}

pub const MD003: Rule = Rule {
    id: "MD003",
    alias: "heading-style",
    tags: &["headings"],
    description: "Heading style",
    rule_type: RuleType::Token,
    required_nodes: &["atx_heading", "setext_heading"],
    new_linter: |context| Box::new(MD003Linter::new(context)),
};

#[cfg(test)]
mod test {
    use std::path::PathBuf;

    use super::{HeadingStyle, MD003HeadingStyleTable};
    use crate::config::{LintersSettingsTable, RuleSeverity};
    use crate::linter::MultiRuleLinter;
    use crate::test_utils::test_helpers::test_config_with_settings;

    fn test_config(style: HeadingStyle) -> crate::config::QuickmarkConfig {
        test_config_with_settings(
            vec![
                ("heading-style", RuleSeverity::Error),
                ("heading-increment", RuleSeverity::Off),
            ],
            LintersSettingsTable {
                heading_style: MD003HeadingStyleTable { style },
                ..Default::default()
            },
        )
    }

    #[test]
    fn test_heading_style_consistent_positive() {
        let config = test_config(HeadingStyle::Consistent);

        let input = "
Setext level 1
--------------
Setext level 2
==============
### ATX header level 3
#### ATX header level 4
";
        let mut linter = MultiRuleLinter::new_for_document(PathBuf::from("test.md"), config, input);
        let violations = linter.analyze();
        assert_eq!(violations.len(), 2);
    }

    #[test]
    fn test_heading_style_consistent_negative_setext() {
        let config = test_config(HeadingStyle::Consistent);

        let input = "
Setext level 1
--------------
Setext level 2
==============
";
        let mut linter = MultiRuleLinter::new_for_document(PathBuf::from("test.md"), config, input);
        let violations = linter.analyze();
        assert_eq!(violations.len(), 0);
    }

    #[test]
    fn test_heading_style_consistent_negative_atx() {
        let config = test_config(HeadingStyle::Consistent);

        let input = "
# Atx heading 1
## Atx heading 2
### Atx heading 3
";
        let mut linter = MultiRuleLinter::new_for_document(PathBuf::from("test.md"), config, input);
        let violations = linter.analyze();
        assert_eq!(violations.len(), 0);
    }

    #[test]
    fn test_heading_style_atx_positive() {
        let config = test_config(HeadingStyle::ATX);

        let input = "
Setext heading 1
----------------
Setext heading 2
================
### Atx heading 3
";
        let mut linter = MultiRuleLinter::new_for_document(PathBuf::from("test.md"), config, input);
        let violations = linter.analyze();
        assert_eq!(violations.len(), 2);
    }

    #[test]
    fn test_heading_style_atx_negative() {
        let config = test_config(HeadingStyle::ATX);

        let input = "
# Atx heading 1
## Atx heading 2
### Atx heading 3
";
        let mut linter = MultiRuleLinter::new_for_document(PathBuf::from("test.md"), config, input);
        let violations = linter.analyze();
        assert_eq!(violations.len(), 0);
    }

    #[test]
    fn test_heading_style_setext_positive() {
        let config = test_config(HeadingStyle::Setext);

        let input = "
# Atx heading 1
Setext heading 1
----------------
Setext heading 2
================
### Atx heading 3
";
        let mut linter = MultiRuleLinter::new_for_document(PathBuf::from("test.md"), config, input);
        let violations = linter.analyze();
        assert_eq!(violations.len(), 2);
    }

    #[test]
    fn test_heading_style_setext_negative() {
        let config = test_config(HeadingStyle::Setext);

        let input = "
Setext heading 1
----------------
Setext heading 2
================
Setext heading 2
================
";
        let mut linter = MultiRuleLinter::new_for_document(PathBuf::from("test.md"), config, input);
        let violations = linter.analyze();
        assert_eq!(violations.len(), 0);
    }

    #[test]
    fn test_heading_style_atx_closed_positive() {
        let config = test_config(HeadingStyle::ATXClosed);

        let input = "
# Open ATX heading 1
## Open ATX heading 2 ##
### ATX closed heading 3 ###
";
        let mut linter = MultiRuleLinter::new_for_document(PathBuf::from("test.md"), config, input);
        let violations = linter.analyze();
        assert_eq!(violations.len(), 1);
    }

    #[test]
    fn test_heading_style_atx_closed_negative() {
        let config = test_config(HeadingStyle::ATXClosed);

        let input = "
# ATX closed heading 1 #
## ATX closed heading 2 ##
### ATX closed heading 3 ###
";
        let mut linter = MultiRuleLinter::new_for_document(PathBuf::from("test.md"), config, input);
        let violations = linter.analyze();
        assert_eq!(violations.len(), 0);
    }

    #[test]
    fn test_heading_style_setext_with_atx_positive() {
        let config = test_config(HeadingStyle::SetextWithATX);

        let input = "
Setext heading 1
----------------
# Open ATX heading 2
## ATX closed heading 3 ##
";
        let mut linter = MultiRuleLinter::new_for_document(PathBuf::from("test.md"), config, input);
        let violations = linter.analyze();
        // Level-based: setext h2 should be used for level 2, open ATX for level 3
        // Violations: ATX heading at level 2, closed ATX at level 3
        assert_eq!(violations.len(), 2);
    }

    #[test]
    fn test_heading_style_setext_with_atx_negative() {
        let config = test_config(HeadingStyle::SetextWithATX);

        let input = "
Setext heading 1
----------------
Setext heading 2
----------------
### Open ATX heading 3
";
        let mut linter = MultiRuleLinter::new_for_document(PathBuf::from("test.md"), config, input);
        let violations = linter.analyze();
        // Level-based: setext for 1-2, open ATX for 3+ - all correct
        assert_eq!(violations.len(), 0);
    }

    #[test]
    fn test_heading_style_setext_with_atx_closed_positive() {
        let config = test_config(HeadingStyle::SetextWithATXClosed);

        let input = "
Setext heading 1
----------------
# Open ATX heading 2
### Open ATX heading 3
";
        let mut linter = MultiRuleLinter::new_for_document(PathBuf::from("test.md"), config, input);
        let violations = linter.analyze();
        // Level-based: setext for 1-2, closed ATX for 3+
        // Violations: open ATX at level 2, open ATX at level 3 (should be closed)
        assert_eq!(violations.len(), 2);
    }

    #[test]
    fn test_heading_style_setext_with_atx_closed_negative() {
        let config = test_config(HeadingStyle::SetextWithATXClosed);

        let input = "
Setext heading 1
----------------
Setext heading 2
----------------
### ATX closed heading 3 ###
";
        let mut linter = MultiRuleLinter::new_for_document(PathBuf::from("test.md"), config, input);
        let violations = linter.analyze();
        // Level-based: setext for 1-2, closed ATX for 3+ - all correct
        assert_eq!(violations.len(), 0);
    }

    #[test]
    fn test_setext_with_atx_level_violations_comprehensive() {
        let config = test_config(HeadingStyle::SetextWithATX);

        let input = "
# Level 1 ATX (should be setext)
## Level 2 ATX (should be setext)
### Level 3 ATX closed (should be open ATX) ###
#### Level 4 ATX closed (should be open ATX) ####
";
        let mut linter = MultiRuleLinter::new_for_document(PathBuf::from("test.md"), config, input);
        let violations = linter.analyze();
        // Expect 4 violations: 2 for wrong style at levels 1-2, 2 for closed ATX at levels 3-4
        assert_eq!(violations.len(), 4);

        // Check specific violation messages
        assert!(violations[0]
            .message()
            .contains("Expected: setext; Actual: atx"));
        assert!(violations[1]
            .message()
            .contains("Expected: setext; Actual: atx"));
        assert!(violations[2]
            .message()
            .contains("Expected: atx; Actual: atx_closed"));
        assert!(violations[3]
            .message()
            .contains("Expected: atx; Actual: atx_closed"));
    }

    #[test]
    fn test_setext_with_atx_correct_level_usage() {
        let config = test_config(HeadingStyle::SetextWithATX);

        let input = "
Main Title
==========

Subtitle
--------

### Level 3 Open ATX
#### Level 4 Open ATX
##### Level 5 Open ATX
###### Level 6 Open ATX
";
        let mut linter = MultiRuleLinter::new_for_document(PathBuf::from("test.md"), config, input);
        let violations = linter.analyze();
        // Should have no violations - correct level-based usage
        assert_eq!(violations.len(), 0);
    }

    #[test]
    fn test_setext_with_atx_closed_level_violations_comprehensive() {
        let config = test_config(HeadingStyle::SetextWithATXClosed);

        let input = "
# Level 1 ATX (should be setext)
## Level 2 ATX (should be setext)
### Level 3 open ATX (should be closed ATX)
#### Level 4 open ATX (should be closed ATX)
##### Level 5 closed ATX is correct #####
";
        let mut linter = MultiRuleLinter::new_for_document(PathBuf::from("test.md"), config, input);
        let violations = linter.analyze();
        // Expect 4 violations: 2 for wrong style at levels 1-2, 2 for open ATX at levels 3-4
        assert_eq!(violations.len(), 4);

        // Check specific violation messages
        assert!(violations[0]
            .message()
            .contains("Expected: setext; Actual: atx"));
        assert!(violations[1]
            .message()
            .contains("Expected: setext; Actual: atx"));
        assert!(violations[2]
            .message()
            .contains("Expected: atx_closed; Actual: atx"));
        assert!(violations[3]
            .message()
            .contains("Expected: atx_closed; Actual: atx"));
    }

    #[test]
    fn test_setext_with_atx_closed_correct_level_usage() {
        let config = test_config(HeadingStyle::SetextWithATXClosed);

        let input = "
Main Title
==========

Subtitle
--------

### Level 3 Closed ATX ###
#### Level 4 Closed ATX ####
##### Level 5 Closed ATX #####
###### Level 6 Closed ATX ######
";
        let mut linter = MultiRuleLinter::new_for_document(PathBuf::from("test.md"), config, input);
        let violations = linter.analyze();
        // Should have no violations - correct level-based usage
        assert_eq!(violations.len(), 0);
    }

    #[test]
    fn test_mixed_atx_styles_comprehensive() {
        let config = test_config(HeadingStyle::ATXClosed);

        let input = "
# Open ATX 1
## Closed ATX 2 ##
### Open ATX 3
#### Closed ATX 4 ####
##### Open ATX 5
###### Closed ATX 6 ######
";
        let mut linter = MultiRuleLinter::new_for_document(PathBuf::from("test.md"), config, input);
        let violations = linter.analyze();
        // Expect 3 violations for open ATX headings (levels 1, 3, 5)
        assert_eq!(violations.len(), 3);

        for violation in &violations {
            assert!(violation
                .message()
                .contains("Expected: atx_closed; Actual: atx"));
        }
    }

    #[test]
    fn test_consistent_style_with_mixed_atx_variations() {
        let config = test_config(HeadingStyle::Consistent);

        let input = "
# First heading (sets the standard)
## Open ATX 2
### Closed ATX 3 ###
#### Open ATX 4
Setext heading
==============
";
        let mut linter = MultiRuleLinter::new_for_document(PathBuf::from("test.md"), config, input);
        let violations = linter.analyze();
        // Expect 2 violations: closed ATX and setext (both different from first open ATX)
        assert_eq!(violations.len(), 2);

        assert!(violations[0]
            .message()
            .contains("Expected: atx; Actual: atx_closed"));
        assert!(violations[1]
            .message()
            .contains("Expected: atx; Actual: setext"));
    }

    #[test]
    fn test_file_without_trailing_newline_edge_case() {
        let config = test_config(HeadingStyle::Setext);

        // Test string without trailing newline (like our original issue)
        let input = "# ATX heading 1
## ATX heading 2
Final setext heading
--------------------";

        let mut linter = MultiRuleLinter::new_for_document(PathBuf::from("test.md"), config, input);
        let violations = linter.analyze();
        // Should catch all 3 violations, including the final setext heading
        assert_eq!(violations.len(), 2); // Only ATX headings violate setext rule

        for violation in &violations {
            assert!(violation
                .message()
                .contains("Expected: setext; Actual: atx"));
        }
    }

    #[test]
    fn test_mix_of_styles() {
        let config = test_config(HeadingStyle::SetextWithATX);

        let input = "# Open ATX heading level 1

## Open ATX heading level 2

### Open ATX heading level 3 ###

#### Closed ATX heading level 4 ####

Setext heading level 1
======================

Setext heading level 2
----------------------

Another setext heading
======================

# Another open ATX

## Another closed ATX ##

Final setext heading
--------------------
";
        let mut linter = MultiRuleLinter::new_for_document(PathBuf::from("test.md"), config, input);
        let violations = linter.analyze();
        // - Level 1 ATX should be setext (1 violation)
        // - Level 2 ATX should be setext (2 violations)
        // - Level 3+ closed ATX should be open ATX (2 violations)
        // - Level 2 closed ATX should be setext (1 violation)
        // Total: 6 violations
        assert_eq!(violations.len(), 6);
    }

    #[test]
    fn test_atx_closed_detection_comprehensive() {
        let config = test_config(HeadingStyle::ATXClosed);

        let input = "# Open ATX
# Open ATX with spaces
## Open ATX level 2
### Closed ATX level 3 ###
#### Closed ATX with spaces ####
##### Closed ATX no spaces #####
###### Mixed closing hashes ##########
";
        let mut linter = MultiRuleLinter::new_for_document(PathBuf::from("test.md"), config, input);
        let violations = linter.analyze();

        // Should detect 3 open ATX violations (lines 1, 2, 3)
        assert_eq!(violations.len(), 3);

        for violation in &violations {
            assert!(violation
                .message()
                .contains("Expected: atx_closed; Actual: atx"));
        }
    }

    #[test]
    fn test_atx_closed_detection_edge_cases() {
        let config = test_config(HeadingStyle::ATX);

        let input = "# Regular ATX
## Closed ATX ##
### Unbalanced closing ########
#### Text with hash # in middle
##### Text ending with hash#
###### Actually closed ######
";
        let mut linter = MultiRuleLinter::new_for_document(PathBuf::from("test.md"), config, input);
        let violations = linter.analyze();

        // Lines ending with # are considered closed: 2, 3, 5, 6
        // So we expect 4 violations for closed ATX when expecting open ATX
        assert_eq!(violations.len(), 4);

        for violation in &violations {
            assert!(violation
                .message()
                .contains("Expected: atx; Actual: atx_closed"));
        }
    }

    #[test]
    fn test_whitespace_handling_in_atx_closed_detection() {
        let config = test_config(HeadingStyle::ATXClosed);

        let input = "# Open ATX
## Closed with trailing spaces ##
### Closed with tabs ##
#### Open with trailing spaces
##### Closed no spaces #####
";
        let mut linter = MultiRuleLinter::new_for_document(PathBuf::from("test.md"), config, input);
        let violations = linter.analyze();

        // Should detect 2 open ATX violations (lines 1 and 4)
        assert_eq!(violations.len(), 2);

        for violation in &violations {
            assert!(violation
                .message()
                .contains("Expected: atx_closed; Actual: atx"));
        }
    }

    #[test]
    fn test_setext_only_supports_levels_1_and_2() {
        let config = test_config(HeadingStyle::Setext);

        let input = "Setext Level 1
==============

Setext Level 2
--------------

### Level 3 must be ATX ###
#### Level 4 must be ATX ####
";
        let mut linter = MultiRuleLinter::new_for_document(PathBuf::from("test.md"), config, input);
        let violations = linter.analyze();

        // Should detect 2 violations for ATX headings at levels 3-4
        assert_eq!(violations.len(), 2);

        for violation in &violations {
            assert!(violation
                .message()
                .contains("Expected: setext; Actual: atx_closed"));
        }
    }
}