par-term 0.30.10

Cross-platform GPU-accelerated terminal emulator with inline graphics support (Sixel, iTerm2, Kitty)
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
750
751
//! Integration tests for the snippets system.
//!
//! Covers: snippet creation and storage, builder fields, variable substitution
//! (built-in, custom, session, mixed), keybinding generation for snippets,
//! config persistence for snippets, and snippet library export/import.

use par_term::badge::SessionVariables;
use par_term::config::{Config, SnippetConfig, SnippetLibrary};
use std::collections::HashMap;
use std::fs;
use std::path::PathBuf;
use tempfile::TempDir;

/// Helper to create a temporary config directory
fn setup_temp_config() -> (TempDir, PathBuf) {
    let temp_dir = TempDir::new().unwrap();
    let config_dir = temp_dir.path().join("par-term");
    fs::create_dir_all(&config_dir).unwrap();
    (temp_dir, config_dir)
}

// ============================================================================
// Snippet Creation and Builder Tests
// ============================================================================

#[test]
fn test_snippet_creation_and_storage() {
    let snippet = SnippetConfig::new(
        "test_snippet".to_string(),
        "Test Snippet".to_string(),
        "echo 'Hello, World!'".to_string(),
    );

    assert_eq!(snippet.id, "test_snippet");
    assert_eq!(snippet.title, "Test Snippet");
    assert_eq!(snippet.content, "echo 'Hello, World!'");
    assert!(snippet.enabled);
    assert!(snippet.keybinding.is_none());
    assert!(snippet.variables.is_empty());
}

#[test]
fn test_snippet_with_keybinding() {
    let snippet = SnippetConfig::new(
        "test_snippet".to_string(),
        "Test Snippet".to_string(),
        "echo 'test'".to_string(),
    )
    .with_keybinding("Ctrl+Shift+T".to_string());

    assert_eq!(snippet.keybinding, Some("Ctrl+Shift+T".to_string()));
}

#[test]
fn test_snippet_with_folder() {
    let snippet = SnippetConfig::new(
        "test_snippet".to_string(),
        "Test Snippet".to_string(),
        "echo 'test'".to_string(),
    )
    .with_folder("Git".to_string());

    assert_eq!(snippet.folder, Some("Git".to_string()));
}

#[test]
fn test_snippet_with_custom_variable() {
    let snippet = SnippetConfig::new(
        "test_snippet".to_string(),
        "Test Snippet".to_string(),
        "echo 'test'".to_string(),
    )
    .with_variable("name".to_string(), "value".to_string());

    assert_eq!(snippet.variables.get("name"), Some(&"value".to_string()));
}

#[test]
fn test_snippet_auto_execute_field() {
    // Test default value is false
    let snippet = SnippetConfig::new(
        "test".to_string(),
        "Test".to_string(),
        "echo 'hello'".to_string(),
    );

    assert!(!snippet.auto_execute);

    // Test with_auto_execute builder
    let snippet_auto = SnippetConfig::new(
        "test2".to_string(),
        "Test2".to_string(),
        "echo 'world'".to_string(),
    )
    .with_auto_execute();

    assert!(snippet_auto.auto_execute);
}

#[test]
fn test_snippet_keybinding_enabled_field() {
    // Test default value is true
    let snippet = SnippetConfig::new(
        "test".to_string(),
        "Test".to_string(),
        "content".to_string(),
    )
    .with_keybinding("Ctrl+Shift+T".to_string());

    assert_eq!(snippet.keybinding, Some("Ctrl+Shift+T".to_string()));
    assert!(snippet.keybinding_enabled);

    // Test with_keybinding_disabled builder
    let snippet_disabled = SnippetConfig::new(
        "test2".to_string(),
        "Test2".to_string(),
        "content".to_string(),
    )
    .with_keybinding("Ctrl+Shift+X".to_string())
    .with_keybinding_disabled();

    assert_eq!(
        snippet_disabled.keybinding,
        Some("Ctrl+Shift+X".to_string())
    );
    assert!(!snippet_disabled.keybinding_enabled);
}

// ============================================================================
// Variable Substitution Tests
// ============================================================================

use par_term::snippets::VariableSubstitutor;

#[test]
fn test_variable_substitution_builtin() {
    let substitutor = VariableSubstitutor::new();
    let custom_vars = HashMap::new();

    let result = substitutor
        .substitute("Hello \\(user), today is \\(date)", &custom_vars)
        .unwrap();

    assert!(result.contains("Hello "));
    assert!(result.contains(", today is "));
    assert!(!result.contains("\\("));
}

#[test]
fn test_variable_substitution_custom() {
    let substitutor = VariableSubstitutor::new();
    let mut custom_vars = HashMap::new();
    custom_vars.insert("name".to_string(), "Alice".to_string());

    let result = substitutor
        .substitute("Hello \\(name)!", &custom_vars)
        .unwrap();

    assert_eq!(result, "Hello Alice!");
}

#[test]
fn test_variable_substitution_mixed() {
    let substitutor = VariableSubstitutor::new();
    let mut custom_vars = HashMap::new();
    custom_vars.insert("greeting".to_string(), "Welcome".to_string());

    let result = substitutor
        .substitute("\\(greeting) \\(user)!", &custom_vars)
        .unwrap();

    assert!(result.starts_with("Welcome "));
    assert!(result.ends_with("!"));
    assert!(!result.contains("\\("));
}

#[test]
fn test_variable_substitution_undefined() {
    let substitutor = VariableSubstitutor::new();
    let custom_vars = HashMap::new();

    let result = substitutor.substitute("Value: \\(undefined)", &custom_vars);

    assert!(result.is_err());
    match result.unwrap_err() {
        par_term::snippets::SubstitutionError::UndefinedVariable(name) => {
            assert_eq!(name, "undefined");
        }
        _ => panic!("Expected UndefinedVariable error"),
    }
}

#[test]
fn test_variable_substitution_empty() {
    let substitutor = VariableSubstitutor::new();
    let custom_vars = HashMap::new();

    let result = substitutor
        .substitute("No variables here", &custom_vars)
        .unwrap();

    assert_eq!(result, "No variables here");
}

#[test]
fn test_variable_substitution_duplicate() {
    let substitutor = VariableSubstitutor::new();
    let mut custom_vars = HashMap::new();
    custom_vars.insert("name".to_string(), "Alice".to_string());

    let result = substitutor
        .substitute("\\(name) and \\(name)", &custom_vars)
        .unwrap();

    assert_eq!(result, "Alice and Alice");
}

#[test]
fn test_has_variables() {
    let substitutor = VariableSubstitutor::new();

    assert!(substitutor.has_variables("Hello \\(user)"));
    assert!(!substitutor.has_variables("Hello world"));
}

#[test]
fn test_extract_variables() {
    let substitutor = VariableSubstitutor::new();

    let vars = substitutor.extract_variables("\\(user) and \\(date) and \\(time)");

    assert_eq!(vars, vec!["user", "date", "time"]);
}

#[test]
fn test_variable_substitution_all_builtins() {
    let substitutor = VariableSubstitutor::new();
    let custom_vars = HashMap::new();

    // Test that all built-in variables resolve without errors
    let builtins = vec![
        "date",
        "time",
        "datetime",
        "hostname",
        "user",
        "path",
        "git_branch",
        "git_commit",
        "uuid",
        "random",
    ];

    for var in builtins {
        let result = substitutor.substitute(&format!("\\({})", var), &custom_vars);
        assert!(result.is_ok(), "Variable {} should resolve", var);
        let resolved = result.unwrap();
        assert!(
            !resolved.contains("\\("),
            "Variable {} should be substituted",
            var
        );
    }
}

#[test]
fn test_snippet_with_multiple_variables() {
    let substitutor = VariableSubstitutor::new();
    let mut custom_vars = HashMap::new();
    custom_vars.insert("project".to_string(), "par-term".to_string());

    let snippet = SnippetConfig::new(
        "test".to_string(),
        "Test".to_string(),
        "echo '\\(user) working on \\(project) at \\(path)'".to_string(),
    )
    .with_variable("project".to_string(), "par-term".to_string());

    let result = substitutor
        .substitute(&snippet.content, &snippet.variables)
        .unwrap();

    // Should contain the substituted values
    assert!(result.contains("working on"));
    assert!(result.contains("at"));
    assert!(!result.contains("\\("));
}

// ============================================================================
// Session Variable Substitution Tests
// ============================================================================

#[test]
fn test_session_variable_substitution() {
    // Create session variables with test data
    let mut session_vars = SessionVariables::new();
    session_vars.hostname = "testhost".to_string();
    session_vars.username = "testuser".to_string();
    session_vars.path = "/home/test/projects".to_string();
    session_vars.job = Some("vim".to_string());

    // Test substitution with session variables
    let substitutor = VariableSubstitutor::new();
    let custom_vars = std::collections::HashMap::new();

    let result = substitutor
        .substitute_with_session(
            "User: \\(session.username), Host: \\(session.hostname), Path: \\(session.path), Job: \\(session.job)",
            &custom_vars,
            Some(&session_vars),
        )
        .unwrap();

    assert_eq!(
        result,
        "User: testuser, Host: testhost, Path: /home/test/projects, Job: vim"
    );
}

#[test]
fn test_session_variables_override_builtins() {
    // Create session variables
    let mut session_vars = SessionVariables::new();
    session_vars.hostname = "session-host".to_string();

    // Test that session variables take precedence over built-in
    let substitutor = VariableSubstitutor::new();
    let custom_vars = std::collections::HashMap::new();

    let result = substitutor
        .substitute_with_session(
            "\\(session.hostname) vs \\(hostname)",
            &custom_vars,
            Some(&session_vars),
        )
        .unwrap();

    // Both should work, giving different values
    assert!(result.contains("session-host"));
    assert!(result.contains(" vs "));
}

#[test]
fn test_custom_variables_override_session() {
    // Create session and custom variables
    let mut session_vars = SessionVariables::new();
    session_vars.hostname = "session-host".to_string();

    let mut custom_vars = std::collections::HashMap::new();
    custom_vars.insert("hostname".to_string(), "custom-host".to_string());

    // Test that custom variables have highest priority
    let substitutor = VariableSubstitutor::new();

    let result = substitutor
        .substitute_with_session(
            "\\(session.hostname) vs \\(hostname)",
            &custom_vars,
            Some(&session_vars),
        )
        .unwrap();

    assert_eq!(result, "session-host vs custom-host");
}

// ============================================================================
// Snippet Keybinding Generation Tests
// ============================================================================

#[test]
fn test_generate_snippet_keybindings() {
    let mut config = Config::default();
    let initial_count = config.keybindings.len();

    // Add snippet with keybinding
    config.snippets.push(
        SnippetConfig::new(
            "test".to_string(),
            "Test".to_string(),
            "content".to_string(),
        )
        .with_keybinding("Ctrl+Shift+T".to_string()),
    );

    // Generate keybindings
    config.generate_snippet_action_keybindings();

    // Check that keybinding was generated
    assert_eq!(config.keybindings.len(), initial_count + 1);
    assert_eq!(config.keybindings.last().unwrap().key, "Ctrl+Shift+T");
    assert_eq!(config.keybindings.last().unwrap().action, "snippet:test");
}

#[test]
fn test_generate_snippet_keybindings_no_duplicates() {
    let mut config = Config::default();

    // Add snippet with keybinding
    config.snippets.push(
        SnippetConfig::new(
            "test".to_string(),
            "Test".to_string(),
            "content".to_string(),
        )
        .with_keybinding("Ctrl+Shift+T".to_string()),
    );

    // Generate keybindings twice
    config.generate_snippet_action_keybindings();
    let count_after_first = config.keybindings.len();

    config.generate_snippet_action_keybindings();
    let count_after_second = config.keybindings.len();

    // Should not add duplicates
    assert_eq!(count_after_first, count_after_second);
}

#[test]
fn test_generate_snippet_keybindings_disabled_snippet() {
    let mut config = Config::default();
    let initial_count = config.keybindings.len();

    // Add disabled snippet with keybinding
    let mut snippet = SnippetConfig::new(
        "test".to_string(),
        "Test".to_string(),
        "content".to_string(),
    )
    .with_keybinding("Ctrl+Shift+T".to_string());
    snippet.enabled = false;
    config.snippets.push(snippet);

    // Generate keybindings
    config.generate_snippet_action_keybindings();

    // Should not generate keybinding for disabled snippet
    assert_eq!(config.keybindings.len(), initial_count);
}

#[test]
fn test_generate_snippet_keybindings_empty_keybinding() {
    let mut config = Config::default();
    let initial_count = config.keybindings.len();

    // Add snippet without keybinding
    config.snippets.push(SnippetConfig::new(
        "test".to_string(),
        "Test".to_string(),
        "content".to_string(),
    ));

    // Generate keybindings
    config.generate_snippet_action_keybindings();

    // Should not generate keybinding
    assert_eq!(config.keybindings.len(), initial_count);
}

#[test]
fn test_generate_snippet_keybindings_disabled_keybinding() {
    let mut config = Config::default();
    let initial_count = config.keybindings.len();

    // Add snippet with keybinding but keybinding disabled
    let mut snippet = SnippetConfig::new(
        "test".to_string(),
        "Test".to_string(),
        "content".to_string(),
    )
    .with_keybinding("Ctrl+Shift+T".to_string());
    snippet.keybinding_enabled = false;
    config.snippets.push(snippet);

    // Generate keybindings
    config.generate_snippet_action_keybindings();

    // Should not generate keybinding when keybinding_enabled is false
    assert_eq!(config.keybindings.len(), initial_count);
}

#[test]
fn test_generate_snippet_keybindings_update_existing() {
    let mut config = Config::default();

    // Add snippet with initial keybinding
    let snippet = SnippetConfig::new(
        "test".to_string(),
        "Test".to_string(),
        "content".to_string(),
    )
    .with_keybinding("Ctrl+Shift+T".to_string());
    config.snippets.push(snippet);

    // Generate keybindings first time
    config.generate_snippet_action_keybindings();
    assert_eq!(config.keybindings.last().unwrap().key, "Ctrl+Shift+T");

    // Update snippet keybinding
    config.snippets[0].keybinding = Some("Ctrl+Shift+X".to_string());

    // Generate keybindings again - should update existing keybinding
    config.generate_snippet_action_keybindings();

    // Should still have the same number of keybindings (not add a duplicate)
    let snippet_keybindings: Vec<_> = config
        .keybindings
        .iter()
        .filter(|kb| kb.action == "snippet:test")
        .collect();

    assert_eq!(snippet_keybindings.len(), 1);
    assert_eq!(snippet_keybindings[0].key, "Ctrl+Shift+X");
}

#[test]
fn test_generate_snippet_keybindings_remove_when_cleared() {
    let mut config = Config::default();
    let initial_count = config.keybindings.len();

    // Add snippet with keybinding
    let snippet = SnippetConfig::new(
        "test".to_string(),
        "Test".to_string(),
        "content".to_string(),
    )
    .with_keybinding("Ctrl+Shift+T".to_string());
    config.snippets.push(snippet);

    // Generate keybindings
    config.generate_snippet_action_keybindings();
    assert_eq!(config.keybindings.len(), initial_count + 1);

    // Remove keybinding from snippet
    config.snippets[0].keybinding = None;

    // Generate keybindings again - should remove the keybinding
    config.generate_snippet_action_keybindings();

    // Should be back to initial count
    assert_eq!(config.keybindings.len(), initial_count);
    // Should not have the snippet keybinding anymore
    assert!(
        !config
            .keybindings
            .iter()
            .any(|kb| kb.action == "snippet:test")
    );
}

// ============================================================================
// Snippet Config Persistence Tests
// ============================================================================

#[test]
fn test_config_persistence_snippets() {
    let (_temp_dir, config_dir) = setup_temp_config();

    // Create config with snippets
    let mut config = Config::default();
    config.snippets.push(SnippetConfig::new(
        "test".to_string(),
        "Test".to_string(),
        "content".to_string(),
    ));

    // Save config
    let config_path = config_dir.join("config.yaml");
    let yaml = serde_yaml_ng::to_string(&config).unwrap();
    fs::write(&config_path, yaml).unwrap();

    // Load config
    let loaded_yaml = fs::read_to_string(&config_path).unwrap();
    let loaded_config: Config = serde_yaml_ng::from_str(&loaded_yaml).unwrap();

    assert_eq!(loaded_config.snippets.len(), 1);
    assert_eq!(loaded_config.snippets[0].id, "test");
    assert_eq!(loaded_config.snippets[0].title, "Test");
}

#[test]
fn test_snippet_serialization() {
    let snippet = SnippetConfig::new(
        "test".to_string(),
        "Test Snippet".to_string(),
        "echo 'Hello'".to_string(),
    )
    .with_keybinding("Ctrl+Shift+T".to_string())
    .with_folder("Git".to_string());

    // Serialize
    let yaml = serde_yaml_ng::to_string(&snippet).unwrap();

    // Deserialize
    let deserialized: SnippetConfig = serde_yaml_ng::from_str(&yaml).unwrap();

    assert_eq!(deserialized.id, snippet.id);
    assert_eq!(deserialized.title, snippet.title);
    assert_eq!(deserialized.content, snippet.content);
    assert_eq!(deserialized.keybinding, snippet.keybinding);
    assert_eq!(deserialized.folder, snippet.folder);
}

#[test]
fn test_snippet_serialization_with_auto_execute() {
    let snippet = SnippetConfig::new(
        "test".to_string(),
        "Test".to_string(),
        "content".to_string(),
    )
    .with_auto_execute();

    // Serialize
    let yaml = serde_yaml_ng::to_string(&snippet).unwrap();

    // Check that auto_execute is in the YAML
    assert!(yaml.contains("auto_execute"));

    // Deserialize
    let deserialized: SnippetConfig = serde_yaml_ng::from_str(&yaml).unwrap();

    assert_eq!(deserialized.id, snippet.id);
    assert!(deserialized.auto_execute);
}

// ============================================================================
// Snippet Library Export/Import Tests
// ============================================================================

#[test]
fn test_snippet_library_export_import() {
    let snippets = vec![
        SnippetConfig::new(
            "s1".to_string(),
            "Snippet 1".to_string(),
            "echo hello".to_string(),
        )
        .with_folder("Git".to_string()),
        SnippetConfig::new(
            "s2".to_string(),
            "Snippet 2".to_string(),
            "echo world".to_string(),
        )
        .with_keybinding("Ctrl+Shift+S".to_string()),
    ];

    let library = SnippetLibrary {
        snippets: snippets.clone(),
    };

    // Serialize
    let yaml = serde_yaml_ng::to_string(&library).unwrap();

    // Deserialize
    let deserialized: SnippetLibrary = serde_yaml_ng::from_str(&yaml).unwrap();

    assert_eq!(deserialized.snippets.len(), 2);
    assert_eq!(deserialized.snippets[0].id, "s1");
    assert_eq!(deserialized.snippets[0].title, "Snippet 1");
    assert_eq!(deserialized.snippets[0].folder, Some("Git".to_string()));
    assert_eq!(deserialized.snippets[1].id, "s2");
    assert_eq!(
        deserialized.snippets[1].keybinding,
        Some("Ctrl+Shift+S".to_string())
    );
}

#[test]
fn test_snippet_custom_variables_roundtrip() {
    let snippet = SnippetConfig::new(
        "vars_test".to_string(),
        "Variables Test".to_string(),
        "echo \\(greeting) \\(name)".to_string(),
    )
    .with_variable("greeting".to_string(), "Hello".to_string())
    .with_variable("name".to_string(), "World".to_string());

    // Serialize
    let yaml = serde_yaml_ng::to_string(&snippet).unwrap();

    // Deserialize
    let deserialized: SnippetConfig = serde_yaml_ng::from_str(&yaml).unwrap();

    assert_eq!(deserialized.variables.len(), 2);
    assert_eq!(
        deserialized.variables.get("greeting"),
        Some(&"Hello".to_string())
    );
    assert_eq!(
        deserialized.variables.get("name"),
        Some(&"World".to_string())
    );
}

#[test]
fn test_snippet_import_duplicate_handling() {
    // Simulate import: existing snippets + imported library
    let existing = vec![SnippetConfig::new(
        "existing".to_string(),
        "Existing".to_string(),
        "content".to_string(),
    )];

    let import_library = SnippetLibrary {
        snippets: vec![
            SnippetConfig::new(
                "existing".to_string(), // Duplicate ID
                "Duplicate".to_string(),
                "other content".to_string(),
            ),
            SnippetConfig::new(
                "new_one".to_string(), // New ID
                "New".to_string(),
                "new content".to_string(),
            ),
        ],
    };

    let existing_ids: std::collections::HashSet<String> =
        existing.iter().map(|s| s.id.clone()).collect();

    let mut result = existing.clone();
    let mut imported = 0usize;
    let mut skipped = 0usize;

    for snippet in import_library.snippets {
        if existing_ids.contains(&snippet.id) {
            skipped += 1;
            continue;
        }
        result.push(snippet);
        imported += 1;
    }

    assert_eq!(imported, 1);
    assert_eq!(skipped, 1);
    assert_eq!(result.len(), 2);
    assert_eq!(result[1].id, "new_one");
}

#[test]
fn test_snippet_library_empty() {
    let library = SnippetLibrary {
        snippets: Vec::new(),
    };

    let yaml = serde_yaml_ng::to_string(&library).unwrap();
    let deserialized: SnippetLibrary = serde_yaml_ng::from_str(&yaml).unwrap();

    assert!(deserialized.snippets.is_empty());
}