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
// SPDX-FileCopyrightText: 2026 LunNova
//
// SPDX-License-Identifier: MIT
//! Test that doc comments are preserved at all levels.
use pattern_wishcast::pattern_wishcast;
pattern_wishcast! {
/// Enum-level doc comment.
/// Multiple lines supported.
enum DocEnum = {
/// Unit variant doc comment
Unit,
/// Variant with named fields
Named {
/// Field doc comment
value: i32,
/// Another field
name: String,
},
/// Tuple variant doc comment
Tuple(i32, String),
};
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn test_enum_compiles_with_docs() {
// If this compiles, doc comments were preserved correctly
let _ = DocEnum::Unit;
let _ = DocEnum::Named {
value: 42,
name: "test".to_string(),
};
let _ = DocEnum::Tuple(1, "hello".to_string());
}
#[test]
fn test_debug_output_works() {
// Debug should still work with doc comments
let unit = DocEnum::Unit;
let debug_str = format!("{:?}", unit);
assert!(debug_str.contains("Unit"));
}
}