ferrotype 0.1.3

An opinionated wrapper for insta.rs
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
// Copyright Two Neutron Stars Incorporated and contributors
// SPDX-License-Identifier: BlueOak-1.0.0

use ferrotype::Ferrotype;

#[test]
fn test_add_section() {
  let mut ferrotype = Ferrotype::new();
  ferrotype.add("Test Section", "Test content".to_string());

  let output = ferrotype.as_string();
  assert!(output.contains("Test Section: >"));
  assert!(output.contains("  Test content"));
}

#[test]
fn test_add_debug_section() {
  let mut snapshot = Ferrotype::new();
  let test_data = vec![1, 2, 3];
  snapshot.add_debug("Debug Section", &test_data);

  let output = snapshot.as_string();
  assert!(output.contains("Debug Section: >"));
  assert!(output.contains("["));
  assert!(output.contains("1"));
  assert!(output.contains("2"));
  assert!(output.contains("3"));
  assert!(output.contains("]"));

  ferrotype::assert!(snapshot);
}

#[test]
fn test_multiple_sections() {
  let mut snapshot = Ferrotype::new();
  snapshot.add("First", "First content".to_string());
  snapshot.add("Second", "Second content".to_string());

  let output = snapshot.as_string();
  assert!(output.contains("First: >"));
  assert!(output.contains("  First content"));
  assert!(output.contains("Second: >"));
  assert!(output.contains("  Second content"));

  ferrotype::assert!(snapshot);
}

#[test]
fn test_multiline_content_indentation() {
  let mut snapshot = Ferrotype::new();
  let multiline_content = "Line 1\nLine 2\nLine 3";
  snapshot.add("Multiline", multiline_content.to_string());

  let output = snapshot.as_string();
  assert!(output.contains("  Line 1"));
  assert!(output.contains("  Line 2"));
  assert!(output.contains("  Line 3"));

  ferrotype::assert!(snapshot);
}

#[test]
fn test_empty_sections() {
  let snapshot = Ferrotype::new();
  let output = snapshot.as_string();
  assert_eq!(output, "");

  ferrotype::assert!(snapshot);
}

#[test]
fn test_display_trait() {
  let mut snapshot = Ferrotype::new();
  // ANSI-colored content: `as_string()` keeps the escape codes, while the
  // Display impl strips them under the `anstream` feature, so the two outputs
  // only diverge when that feature is enabled.
  snapshot.add("Test", "\x1b[31mcontent\x1b[0m".to_string());

  let display_output = format!("{snapshot}");
  let as_string_output = snapshot.as_string();

  // Without anstream, Display is a passthrough of `as_string()`.
  #[cfg(not(feature = "anstream"))]
  assert_eq!(display_output, as_string_output);

  // With anstream, Display strips the ANSI codes, so it differs.
  #[cfg(feature = "anstream")]
  assert_ne!(display_output, as_string_output);

  ferrotype::assert!(snapshot);
}

#[test]
fn test_debug_trait() {
  let mut snapshot = Ferrotype::new();
  snapshot.add("Test", "content".to_string());

  // Test that Debug trait works
  let debug_output = format!("{snapshot:?}");
  assert!(debug_output.contains("Ferrotype"));
  assert!(debug_output.contains("expect_errors"));
  assert!(debug_output.contains("filter_memory_addresses"));
  assert!(debug_output.contains("sections"));

  ferrotype::assert!(snapshot);
}

#[test]
fn test_get_output_dir() {
  let output_dir = ferrotype::get_output_dir();

  #[cfg(feature = "dot_snapshots")]
  assert_eq!(output_dir, ".snapshots");

  #[cfg(not(feature = "dot_snapshots"))]
  assert_eq!(output_dir, "snapshots");
}

// Test the title formatting function indirectly through as_string
#[test]
fn test_title_formatting() {
  let mut snapshot = Ferrotype::new();
  snapshot.add("snake_case_title", "content".to_string());
  snapshot.add("UPPER_CASE_TITLE", "content".to_string());
  snapshot.add("mixedCase_title", "content".to_string());

  let output = snapshot.as_string();
  assert!(output.contains("SnakeCaseTitle: >"));
  assert!(output.contains("UpperCaseTitle: >"));
  assert!(output.contains("MixedCaseTitle: >"));

  ferrotype::assert!(snapshot);
}

#[test]
fn test_empty_title() {
  let mut snapshot = Ferrotype::new();
  snapshot.add("", "content".to_string());

  let output = snapshot.as_string();
  assert!(output.contains(": >"));
  assert!(output.contains("  content"));

  ferrotype::assert!(snapshot);
}

#[test]
fn test_special_characters_in_content() {
  let mut snapshot = Ferrotype::new();
  let special_content = "Content with\ttabs\nand\rcarriage returns\0and nulls";
  snapshot.add("Special", special_content.to_string());

  let output = snapshot.as_string();
  assert!(output.contains("Special: >"));
  // The content should be properly indented and preserved
  assert!(output.contains("  Content with"));

  ferrotype::assert!(snapshot);
}

// Test that print methods don't panic (we can't easily test stdout/stderr
// output)
#[test]
fn test_print_methods_dont_panic() {
  let mut snapshot = Ferrotype::new();
  snapshot.add("Test", "content".to_string());

  // These should not panic
  snapshot.print();
  snapshot.print_stdout();
  snapshot.print_stderr();

  ferrotype::assert!(snapshot);
}

// Test with various data types for add_debug
#[test]
fn test_add_debug_various_types() {
  let mut snapshot = Ferrotype::new();

  snapshot.add_debug("String", "Hello".to_string());
  snapshot.add_debug("Integer", 42);
  snapshot.add_debug("Float", 1.23456789);
  snapshot.add_debug("Boolean", true);
  snapshot.add_debug("Option", Some(10));
  snapshot.add_debug("Result", Ok::<i32, &str>(42));

  let output = snapshot.as_string();
  assert!(output.contains("String: >"));
  assert!(output.contains("Integer: >"));
  assert!(output.contains("Float: >"));
  assert!(output.contains("Boolean: >"));
  assert!(output.contains("Option: >"));
  assert!(output.contains("Result: >"));

  ferrotype::assert!(snapshot);
}

#[test]
fn test_sections_are_separated() {
  let mut snapshot = Ferrotype::new();
  snapshot.add("First", "first content".to_string());
  snapshot.add("Second", "second content".to_string());

  let output = snapshot.as_string();

  // Check that sections are separated by double newlines
  assert!(output.contains("first content\n\nSecond: >"));

  ferrotype::assert!(snapshot);
}

#[test]
fn test_filter_memory_addresses_enabled() {
  let mut snapshot = Ferrotype::new();
  // Default should be true
  assert!(snapshot.filter_memory_addresses());

  // Add content with memory addresses
  snapshot.add(
    "Memory Addresses",
    "Pointer at 0x7fff5fbff710 and another at 0xDEADBEEF".to_string(),
  );
  snapshot
    .add_debug("Debug with Address", format!("Object at {:p}", &snapshot));

  // The snapshot content itself should still contain the addresses
  let content = snapshot.as_string();
  assert!(content.contains("0x7fff5fbff710"));
  assert!(content.contains("0xDEADBEEF"));

  // Note: The actual filtering happens in the assert! macro, not in as_string()
  ferrotype::assert!(snapshot);
}

#[test]
fn test_filter_memory_addresses_disabled() {
  let mut snapshot = Ferrotype::new();
  snapshot.set_filter_memory_addresses(false);
  assert!(!snapshot.filter_memory_addresses());

  // Add content with memory addresses
  snapshot.add(
    "Memory Addresses",
    "Pointer at 0x7fff5fbff710 and another at 0xDEADBEEF".to_string(),
  );
  snapshot.add_debug("Debug with Address", "Object at 0xCAFEBABE");

  // The addresses should still be in the content
  let content = snapshot.as_string();
  assert!(content.contains("0x7fff5fbff710"));
  assert!(content.contains("0xDEADBEEF"));

  ferrotype::assert!(snapshot);
}

#[test]
fn test_filter_memory_addresses_various_formats() {
  let mut snapshot = Ferrotype::new();
  snapshot.set_filter_memory_addresses(true);

  // Test various memory address formats
  snapshot.add("Lowercase", "address: 0xdeadbeef".to_string());
  snapshot.add("Uppercase", "ADDRESS: 0xDEADBEEF".to_string());
  snapshot.add("Mixed Case", "ptr: 0xDEadBEef".to_string());
  snapshot.add("Short", "0x42".to_string());
  snapshot.add("Long", "0x7fff5fbff710abcdef".to_string());
  snapshot.add("Multiple", "start: 0x1000 end: 0x2000".to_string());
  snapshot.add("With Whitespace", "addr:   0x12345678   here".to_string());

  ferrotype::assert!(snapshot);
}

#[test]
fn test_filter_memory_addresses_preserves_non_addresses() {
  let mut snapshot = Ferrotype::new();
  snapshot.set_filter_memory_addresses(true);

  // These should NOT be filtered
  snapshot.add("Hex Without 0x", "deadbeef is not an address".to_string());
  snapshot.add("Decimal", "12345678 is a number".to_string());
  snapshot.add("Partial Match", "0xGHIJK is not valid hex".to_string());
  snapshot.add("Email", "user@0x42.com should stay".to_string());

  let content = snapshot.as_string();
  assert!(content.contains("deadbeef is not an address"));
  assert!(content.contains("12345678 is a number"));
  assert!(content.contains("0xGHIJK is not valid hex"));
  assert!(content.contains("user@0x42.com should stay"));

  ferrotype::assert!(snapshot);
}

#[test]
fn test_clone_preserves_filter_setting() {
  let mut original = Ferrotype::new();
  original.set_filter_memory_addresses(false);
  original.add("Test", "Memory at 0x1234".to_string());

  let cloned = original.clone();
  assert_eq!(
    cloned.filter_memory_addresses(),
    original.filter_memory_addresses()
  );
  assert!(!cloned.filter_memory_addresses());
}

#[test]
fn test_filter_uuids_enabled() {
  let mut snapshot = Ferrotype::new();
  // Default should be true
  assert!(snapshot.filter_uuids());

  // Add content with UUIDs
  snapshot.add(
    "UUIDs",
    "ID: 550e8400-e29b-41d4-a716-446655440000 and 123e4567-e89b-12d3-a456-426614174000".to_string(),
  );
  snapshot.add(
    "Mixed Content",
    "User 6ba7b810-9dad-11d1-80b4-00c04fd430c8 logged in".to_string(),
  );

  // The snapshot content itself should still contain the UUIDs
  let content = snapshot.as_string();
  assert!(content.contains("550e8400-e29b-41d4-a716-446655440000"));
  assert!(content.contains("123e4567-e89b-12d3-a456-426614174000"));
  assert!(content.contains("6ba7b810-9dad-11d1-80b4-00c04fd430c8"));

  // Note: The actual filtering happens in the assert! macro, not in as_string()
  ferrotype::assert!(snapshot);
}

#[test]
fn test_filter_uuids_disabled() {
  let mut snapshot = Ferrotype::new();
  snapshot.set_filter_uuids(false);
  assert!(!snapshot.filter_uuids());

  // Add content with UUIDs
  snapshot.add(
    "UUIDs",
    "ID: 550e8400-e29b-41d4-a716-446655440000 and 123e4567-e89b-12d3-a456-426614174000".to_string(),
  );
  snapshot.add(
    "Mixed Content",
    "User 6ba7b810-9dad-11d1-80b4-00c04fd430c8 logged in".to_string(),
  );

  // The UUIDs should still be in the content
  let content = snapshot.as_string();
  assert!(content.contains("550e8400-e29b-41d4-a716-446655440000"));
  assert!(content.contains("123e4567-e89b-12d3-a456-426614174000"));
  assert!(content.contains("6ba7b810-9dad-11d1-80b4-00c04fd430c8"));

  ferrotype::assert!(snapshot);
}

#[test]
fn test_filter_uuids_various_formats() {
  let mut snapshot = Ferrotype::new();
  snapshot.set_filter_uuids(true);

  // Test various UUID formats (all should be valid v4 UUIDs)
  snapshot.add(
    "Lowercase",
    "uuid: 550e8400-e29b-41d4-a716-446655440000".to_string(),
  );
  snapshot.add(
    "Uppercase",
    "UUID: 550E8400-E29B-41D4-A716-446655440000".to_string(),
  );
  snapshot.add(
    "Mixed Case",
    "id: 550e8400-E29B-41d4-A716-446655440000".to_string(),
  );
  snapshot.add("Multiple", "start: 123e4567-e89b-12d3-a456-426614174000 end: 6ba7b810-9dad-11d1-80b4-00c04fd430c8".to_string());
  snapshot.add(
    "In Sentence",
    "The user 550e8400-e29b-41d4-a716-446655440000 was created".to_string(),
  );
  snapshot.add(
    "With Punctuation",
    "uuid(550e8400-e29b-41d4-a716-446655440000)".to_string(),
  );

  ferrotype::assert!(snapshot);
}

#[test]
fn test_filter_uuids_preserves_non_uuids() {
  let mut snapshot = Ferrotype::new();
  snapshot.set_filter_uuids(true);

  // These should NOT be filtered
  snapshot.add("Not Enough Groups", "550e8400-e29b-41d4-a716".to_string());
  snapshot.add(
    "Wrong Format",
    "550e8400e29b41d4a716446655440000".to_string(),
  );
  snapshot.add("Too Short", "550e8400-e29b-41d4-a716-44665544".to_string());
  snapshot.add(
    "Too Long",
    "550e8400-e29b-41d4-a716-446655440000-extra".to_string(),
  );
  snapshot.add(
    "Invalid Chars",
    "550e8400-e29b-41d4-a716-44665544000g".to_string(),
  );
  snapshot.add(
    "Partial Match",
    "prefix-550e8400-e29b-41d4-a716-446655440000-suffix".to_string(),
  );

  let content = snapshot.as_string();
  assert!(content.contains("550e8400-e29b-41d4-a716"));
  assert!(content.contains("550e8400e29b41d4a716446655440000"));
  assert!(content.contains("550e8400-e29b-41d4-a716-44665544"));
  assert!(content.contains("550e8400-e29b-41d4-a716-446655440000-extra"));
  assert!(content.contains("550e8400-e29b-41d4-a716-44665544000g"));

  ferrotype::assert!(snapshot);
}

#[test]
fn test_set_filter_random_ids_enables_all() {
  let mut snapshot = Ferrotype::new();

  // First disable individual filters
  snapshot.set_filter_memory_addresses(false);
  snapshot.set_filter_uuids(false);
  assert!(!snapshot.filter_memory_addresses());
  assert!(!snapshot.filter_uuids());

  // Now enable all random ID filtering
  snapshot.set_filter_random_ids(true);
  assert!(snapshot.filter_memory_addresses());
  assert!(snapshot.filter_uuids());

  // Add content with both types of IDs
  snapshot.add(
    "Mixed IDs",
    "Pointer at 0xDEADBEEF and UUID 550e8400-e29b-41d4-a716-446655440000"
      .to_string(),
  );

  ferrotype::assert!(snapshot);
}

#[test]
fn test_set_filter_random_ids_disables_all() {
  let mut snapshot = Ferrotype::new();

  // Defaults should be true
  assert!(snapshot.filter_memory_addresses());
  assert!(snapshot.filter_uuids());

  // Disable all random ID filtering
  snapshot.set_filter_random_ids(false);
  assert!(!snapshot.filter_memory_addresses());
  assert!(!snapshot.filter_uuids());

  // Add content with both types of IDs
  snapshot.add(
    "Mixed IDs",
    "Pointer at 0xDEADBEEF and UUID 550e8400-e29b-41d4-a716-446655440000"
      .to_string(),
  );

  ferrotype::assert!(snapshot);
}

#[test]
fn test_clone_preserves_uuid_filter_setting() {
  let mut original = Ferrotype::new();
  original.set_filter_uuids(false);
  original.add(
    "Test",
    "UUID: 550e8400-e29b-41d4-a716-446655440000".to_string(),
  );

  let cloned = original.clone();
  assert_eq!(cloned.filter_uuids(), original.filter_uuids());
  assert!(!cloned.filter_uuids());
}

#[test]
fn test_combined_filtering() {
  let mut snapshot = Ferrotype::new();
  snapshot.set_filter_random_ids(true);

  // Add content with multiple types of random data
  snapshot.add(
    "All Types",
    "Memory: 0x12345678, UUID: 550e8400-e29b-41d4-a716-446655440000, Regular: 12345".to_string(),
  );
  snapshot.add(
    "Complex",
    "Object 0xABCDEF with ID 123e4567-e89b-12d3-a456-426614174000 at index 42"
      .to_string(),
  );

  // The content should still have the original values
  let content = snapshot.as_string();
  assert!(content.contains("0x12345678"));
  assert!(content.contains("550e8400-e29b-41d4-a716-446655440000"));
  assert!(content.contains("0xABCDEF"));
  assert!(content.contains("123e4567-e89b-12d3-a456-426614174000"));
  assert!(content.contains("12345")); // Regular numbers should not be filtered

  ferrotype::assert!(snapshot);
}

#[test]
fn test_filter_type_ids_enabled() {
  let mut snapshot = Ferrotype::new();
  // Default should be true
  assert!(snapshot.filter_type_ids());

  // Add content with TypeIds
  snapshot.add(
    "TypeIds",
    "Type: TypeId { t: 12345, } and TypeId { t: 67890, }".to_string(),
  );
  snapshot.add(
    "Spaced TypeId",
    "Found TypeId  {  t:  99999  ,  } in debug output".to_string(),
  );

  // The snapshot content itself should still contain the TypeIds
  let content = snapshot.as_string();
  assert!(content.contains("TypeId { t: 12345, }"));
  assert!(content.contains("TypeId { t: 67890, }"));

  ferrotype::assert!(snapshot);
}

#[test]
fn test_filter_type_ids_disabled() {
  let mut snapshot = Ferrotype::new();
  snapshot.set_filter_type_ids(false);
  assert!(!snapshot.filter_type_ids());

  // Add content with TypeIds
  snapshot.add(
    "TypeIds",
    "Type: TypeId { t: 12345, } and TypeId { t: 67890, }".to_string(),
  );
  snapshot.add(
    "Spaced TypeId",
    "Found TypeId  {  t:  99999  ,  } in debug output".to_string(),
  );

  ferrotype::assert!(snapshot);
}

#[test]
fn test_filter_hashes_enabled() {
  let mut snapshot = Ferrotype::new();
  // Default should be true
  assert!(snapshot.filter_hashes());

  // Add content with hashes
  snapshot.add(
    "Hashes",
    "Item with hash: 12345, and another hash: 67890, here".to_string(),
  );
  snapshot.add(
    "Multiple Hashes",
    "First hash: 111, second hash: 222, third hash: 333, done".to_string(),
  );

  // The snapshot content itself should still contain the hashes
  let content = snapshot.as_string();
  assert!(content.contains("hash: 12345,"));
  assert!(content.contains("hash: 67890,"));

  ferrotype::assert!(snapshot);
}

#[test]
fn test_filter_hashes_disabled() {
  let mut snapshot = Ferrotype::new();
  snapshot.set_filter_hashes(false);
  assert!(!snapshot.filter_hashes());

  // Add content with hashes
  snapshot.add(
    "Hashes",
    "Item with hash: 12345, and another hash: 67890, here".to_string(),
  );
  snapshot.add(
    "Multiple Hashes",
    "First hash: 111, second hash: 222, third hash: 333, done".to_string(),
  );

  ferrotype::assert!(snapshot);
}

#[test]
fn test_filter_hashes_preserves_non_hash_patterns() {
  let mut snapshot = Ferrotype::new();
  snapshot.set_filter_hashes(true);

  // These should NOT be filtered
  snapshot.add("No Comma", "hash: 12345 without comma".to_string());
  snapshot.add("Wrong Format", "hash:12345, (no space)".to_string());
  snapshot.add("Not Hash", "bash: 12345, is different".to_string());
  snapshot.add("Partial", "hashmap: 12345, is not hash:".to_string());

  let content = snapshot.as_string();
  assert!(content.contains("hash: 12345 without comma"));
  assert!(content.contains("hash:12345,")); // Wrong format preserved
  assert!(content.contains("bash: 12345,"));
  assert!(content.contains("hashmap: 12345,"));

  ferrotype::assert!(snapshot);
}

#[test]
fn test_set_filter_random_ids_includes_type_ids_and_hashes() {
  let mut snapshot = Ferrotype::new();

  // First disable all filters
  snapshot.set_filter_memory_addresses(false);
  snapshot.set_filter_uuids(false);
  snapshot.set_filter_type_ids(false);
  snapshot.set_filter_hashes(false);

  assert!(!snapshot.filter_memory_addresses());
  assert!(!snapshot.filter_uuids());
  assert!(!snapshot.filter_type_ids());
  assert!(!snapshot.filter_hashes());

  // Now enable all random ID filtering
  snapshot.set_filter_random_ids(true);
  assert!(snapshot.filter_memory_addresses());
  assert!(snapshot.filter_uuids());
  assert!(snapshot.filter_type_ids());
  assert!(snapshot.filter_hashes());

  // Add content with all types of IDs
  snapshot.add(
    "All Random IDs",
    "Memory: 0xDEADBEEF, UUID: 550e8400-e29b-41d4-a716-446655440000, TypeId { t: 12345, }, hash: 67890,".to_string(),
  );

  ferrotype::assert!(snapshot);
}

#[test]
fn test_clone_preserves_type_id_and_hash_settings() {
  let mut original = Ferrotype::new();
  original.set_filter_type_ids(false);
  original.set_filter_hashes(false);
  original.add("Test", "TypeId { t: 12345, } hash: 67890,".to_string());

  let cloned = original.clone();
  assert_eq!(cloned.filter_type_ids(), original.filter_type_ids());
  assert_eq!(cloned.filter_hashes(), original.filter_hashes());
  assert!(!cloned.filter_type_ids());
  assert!(!cloned.filter_hashes());
}

#[test]
fn test_combined_all_filters() {
  let mut snapshot = Ferrotype::new();
  snapshot.set_filter_random_ids(true);

  // Add content with all types of random data
  snapshot.add(
    "Everything",
    "Ptr: 0x12345678, ID: 550e8400-e29b-41d4-a716-446655440000, Type: TypeId { t: 99999, }, Item hash: 12345, done".to_string(),
  );

  // Complex nested example
  snapshot.add(
    "Debug Output",
    "Object { ptr: 0xABCDEF, uuid: 123e4567-e89b-12d3-a456-426614174000, type_id: TypeId { t: 777, }, hash: 888, data: [1, 2, 3] }".to_string(),
  );

  ferrotype::assert!(snapshot);
}