redstr 0.2.14

Red team string obfuscation and transformation for offensive security, WAF bypass, XSS, SQL injection, phishing, and evasion testing
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
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
use crate::rng::SimpleRng;

/// Applies random capitalization to each letter in the input string.
///
/// Each alphabetic character has a 50% chance of being uppercase or lowercase,
/// creating unpredictable case patterns. Non-alphabetic characters (numbers,
/// spaces, punctuation) are preserved unchanged.
///
/// # Use Cases
///
/// - **Red Team**: Bypass case-sensitive filters and detection systems
/// - **Blue Team**: Test case-insensitive input validation
/// - **General**: Create visually distinctive text for testing purposes
///
/// # Examples
///
/// ```
/// use redstr::randomize_capitalization;
///
/// let result = randomize_capitalization("hello world");
/// // Example output: "HeLlO wOrLd" or "hElLo WoRLd" (varies each run)
/// assert_eq!(result.len(), "hello world".len());
///
/// // Numbers and symbols are preserved
/// let result2 = randomize_capitalization("test123");
/// assert!(result2.contains("123"));
/// ```
pub fn randomize_capitalization(input: &str) -> String {
    let mut rng = SimpleRng::new();
    let mut result = String::with_capacity(input.len() * 2); // Allocate extra for potential multi-byte chars

    for c in input.chars() {
        if c.is_alphabetic() {
            if rng.next() % 2 == 0 {
                for uc in c.to_uppercase() {
                    result.push(uc);
                }
            } else {
                for lc in c.to_lowercase() {
                    result.push(lc);
                }
            }
        } else {
            result.push(c);
        }
    }
    result
}

/// Alternates between uppercase and lowercase for each alphabetic character.
///
/// Creates a predictable pattern starting with uppercase, then lowercase, and
/// repeating for each letter. Non-alphabetic characters don't affect the pattern.
/// This is also known as "spongebob case" or "mocking case".
///
/// # Use Cases
///
/// - **Testing**: Verify case-insensitive string comparisons
/// - **Visual**: Create distinctive formatting for emphasis or mockery
/// - **Red Team**: Test filter bypass with alternating patterns
///
/// # Examples
///
/// ```
/// use redstr::alternate_case;
///
/// assert_eq!(alternate_case("hello"), "HeLlO");
/// assert_eq!(alternate_case("hello world"), "HeLlO wOrLd");
///
/// // Non-alphabetic characters are preserved but don't affect the pattern
/// assert_eq!(alternate_case("a1b2c3"), "A1b2C3");
/// ```
pub fn alternate_case(input: &str) -> String {
    let mut upper = true;
    let mut result = String::with_capacity(input.len() * 2);

    for c in input.chars() {
        if c.is_alphabetic() {
            if upper {
                for uc in c.to_uppercase() {
                    result.push(uc);
                }
            } else {
                for lc in c.to_lowercase() {
                    result.push(lc);
                }
            }
            upper = !upper;
        } else {
            result.push(c);
        }
    }
    result
}

/// Inverts the case of all alphabetic characters.
///
/// Converts uppercase letters to lowercase and lowercase letters to uppercase.
/// Non-alphabetic characters remain unchanged. This is useful for testing
/// case sensitivity and creating inverted text patterns.
///
/// # Use Cases
///
/// - **Testing**: Verify case transformation logic
/// - **Red Team**: Test case-sensitive filter evasion
/// - **Data Processing**: Normalize or transform text data
///
/// # Examples
///
/// ```
/// use redstr::inverse_case;
///
/// assert_eq!(inverse_case("Hello World"), "hELLO wORLD");
/// assert_eq!(inverse_case("ABC123xyz"), "abc123XYZ");
///
/// // All uppercase becomes all lowercase
/// assert_eq!(inverse_case("SHOUTING"), "shouting");
/// ```
pub fn inverse_case(input: &str) -> String {
    let mut result = String::with_capacity(input.len() * 2);

    for c in input.chars() {
        if c.is_uppercase() {
            for lc in c.to_lowercase() {
                result.push(lc);
            }
        } else if c.is_lowercase() {
            for uc in c.to_uppercase() {
                result.push(uc);
            }
        } else {
            result.push(c);
        }
    }
    result
}

/// Swaps case randomly for WAF and filter bypass testing.
///
/// Each alphabetic character has a 50% chance of having its case inverted.
/// This creates unpredictable case patterns while maintaining readability,
/// making it ideal for evading case-sensitive security filters.
///
/// # Use Cases
///
/// - **Red Team**: Bypass WAF rules that look for specific case patterns
/// - **SQL Injection**: Evade detection with queries like `SeLeCt * FrOm users`
/// - **XSS Testing**: Bypass filters with `<ScRiPt>alert(1)</ScRiPt>`
/// - **Blue Team**: Test if security controls properly normalize case
///
/// # Examples
///
/// ```
/// use redstr::case_swap;
///
/// // SQL injection with case variations
/// let result = case_swap("SELECT * FROM users");
/// // Example output: "SeLeCt * FrOm users" or "sElEcT * fRoM users"
/// assert_ne!(result, "SELECT * FROM users");
///
/// // XSS payload obfuscation
/// let xss = case_swap("<script>alert(1)</script>");
/// // Example output: "<ScRiPt>alert(1)</ScRiPt>"
/// ```
pub fn case_swap(input: &str) -> String {
    let mut rng = SimpleRng::new();
    let mut result = String::with_capacity(input.len() * 2);
    let mut swapped_any = false;

    for c in input.chars() {
        if c.is_alphabetic() && rng.next() % 2 == 0 {
            swapped_any = true;
            if c.is_uppercase() {
                for lc in c.to_lowercase() {
                    result.push(lc);
                }
            } else {
                for uc in c.to_uppercase() {
                    result.push(uc);
                }
            }
        } else {
            result.push(c);
        }
    }

    // Guarantee a changed output when alphabetic characters are present.
    if !swapped_any && input.chars().any(|c| c.is_alphabetic()) {
        let mut guaranteed = String::with_capacity(result.len());
        let mut changed = false;
        for c in input.chars() {
            if !changed && c.is_alphabetic() {
                changed = true;
                if c.is_uppercase() {
                    for lc in c.to_lowercase() {
                        guaranteed.push(lc);
                    }
                } else {
                    for uc in c.to_uppercase() {
                        guaranteed.push(uc);
                    }
                }
            } else {
                guaranteed.push(c);
            }
        }
        return guaranteed;
    }

    result
}

/// Converts a string to camelCase.
///
/// Transforms input into camelCase format where the first word is lowercase
/// and subsequent words have their first letter capitalized, with all spaces,
/// hyphens, and underscores removed.
///
/// # Use Cases
///
/// - **API Development**: Convert field names to JavaScript/Java conventions
/// - **Code Generation**: Transform human-readable names to variable names
/// - **Data Transformation**: Normalize naming conventions across systems
///
/// # Examples
///
/// ```
/// use redstr::to_camel_case;
///
/// assert_eq!(to_camel_case("hello world"), "helloWorld");
/// assert_eq!(to_camel_case("user_first_name"), "userFirstName");
/// assert_eq!(to_camel_case("get-user-id"), "getUserId");
/// assert_eq!(to_camel_case("API Response Code"), "apiResponseCode");
/// ```
pub fn to_camel_case(input: &str) -> String {
    let mut result = String::new();
    let mut capitalize_next = false;
    let mut first_char = true;

    for c in input.chars() {
        if c.is_whitespace() || c == '_' || c == '-' {
            capitalize_next = true;
        } else if c.is_alphabetic() {
            if first_char {
                result.push_str(&c.to_lowercase().to_string());
                first_char = false;
            } else if capitalize_next {
                result.push_str(&c.to_uppercase().to_string());
                capitalize_next = false;
            } else {
                result.push_str(&c.to_lowercase().to_string());
            }
        } else {
            result.push(c);
        }
    }
    result
}

/// Converts a string to snake_case.
///
/// Transforms input into snake_case format where all letters are lowercase
/// and words are separated by underscores. Converts from camelCase, PascalCase,
/// kebab-case, or space-separated formats.
///
/// # Use Cases
///
/// - **Database Schema**: Convert field names to SQL column conventions
/// - **Python/Ruby**: Transform names to language naming conventions
/// - **Configuration Files**: Normalize setting names
///
/// # Examples
///
/// ```
/// use redstr::to_snake_case;
///
/// assert_eq!(to_snake_case("HelloWorld"), "hello_world");
/// assert_eq!(to_snake_case("getUserId"), "get_user_id");
/// assert_eq!(to_snake_case("API Response"), "api_response");
/// assert_eq!(to_snake_case("user-first-name"), "user_first_name");
/// ```
pub fn to_snake_case(input: &str) -> String {
    let mut result = String::new();
    let mut prev_was_upper = false;

    for (i, c) in input.chars().enumerate() {
        if c.is_whitespace() || c == '-' {
            result.push('_');
            prev_was_upper = false;
        } else if c.is_uppercase() {
            if i > 0 && !prev_was_upper && !result.ends_with('_') {
                result.push('_');
            }
            result.push_str(&c.to_lowercase().to_string());
            prev_was_upper = true;
        } else {
            result.push(c);
            prev_was_upper = false;
        }
    }
    result
}

/// Converts a string to kebab-case.
///
/// Transforms input into kebab-case (also called dash-case or lisp-case)
/// where all letters are lowercase and words are separated by hyphens.
/// Commonly used in URLs, CSS class names, and HTML attributes.
///
/// # Use Cases
///
/// - **URLs**: Create SEO-friendly URL slugs
/// - **CSS/HTML**: Convert to standard class name format
/// - **Command-line**: Transform to CLI flag conventions
///
/// # Examples
///
/// ```
/// use redstr::to_kebab_case;
///
/// assert_eq!(to_kebab_case("HelloWorld"), "hello-world");
/// assert_eq!(to_kebab_case("user_profile_page"), "user-profile-page");
/// assert_eq!(to_kebab_case("API Endpoint"), "api-endpoint");
///
/// // Useful for URL slugs
/// assert_eq!(to_kebab_case("My Blog Post Title"), "my-blog-post-title");
/// ```
pub fn to_kebab_case(input: &str) -> String {
    to_snake_case(input).replace('_', "-")
}

#[cfg(test)]
mod tests {
    use super::*;

    #[test]
    fn test_alternate_case() {
        let result = alternate_case("hello");
        assert_eq!(result, "HeLlO");
    }

    #[test]
    fn test_alternate_case_empty_string() {
        let result = alternate_case("");
        assert_eq!(result, "");
    }

    #[test]
    fn test_alternate_case_single_char() {
        let result = alternate_case("a");
        assert_eq!(result, "A");
    }

    #[test]
    fn test_alternate_case_with_numbers() {
        let result = alternate_case("hello123world");
        assert_eq!(result, "HeLlO123wOrLd");
    }

    #[test]
    fn test_alternate_case_with_spaces() {
        let result = alternate_case("hello world");
        assert_eq!(result, "HeLlO wOrLd");
    }

    #[test]
    fn test_alternate_case_special_chars() {
        let result = alternate_case("a!b@c#d");
        assert_eq!(result, "A!b@C#d");
    }

    #[test]
    fn test_alternate_case_all_uppercase() {
        let result = alternate_case("HELLO");
        assert_eq!(result, "HeLlO");
    }

    #[test]
    fn test_alternate_case_mixed_case() {
        let result = alternate_case("HeLLo");
        assert_eq!(result, "HeLlO");
    }

    #[test]
    fn test_alternate_case_long_string() {
        let result = alternate_case("abcdefghijklmnop");
        assert_eq!(result, "AbCdEfGhIjKlMnOp");
    }

    #[test]
    fn test_alternate_case_unicode() {
        let result = alternate_case("héllo");
        assert!(!result.is_empty());
        assert!(result.starts_with("H") || result.starts_with("h"));
    }

    #[test]
    fn test_inverse_case() {
        let result = inverse_case("Hello World");
        assert_eq!(result, "hELLO wORLD");
    }

    #[test]
    fn test_inverse_case_empty_string() {
        let result = inverse_case("");
        assert_eq!(result, "");
    }

    #[test]
    fn test_inverse_case_single_char_lower() {
        let result = inverse_case("a");
        assert_eq!(result, "A");
    }

    #[test]
    fn test_inverse_case_single_char_upper() {
        let result = inverse_case("A");
        assert_eq!(result, "a");
    }

    #[test]
    fn test_inverse_case_numbers() {
        let result = inverse_case("Test123");
        assert_eq!(result, "tEST123");
    }

    #[test]
    fn test_inverse_case_special_chars() {
        let result = inverse_case("Hello!@#World");
        assert_eq!(result, "hELLO!@#wORLD");
    }

    #[test]
    fn test_inverse_case_all_lowercase() {
        let result = inverse_case("hello");
        assert_eq!(result, "HELLO");
    }

    #[test]
    fn test_inverse_case_all_uppercase() {
        let result = inverse_case("HELLO");
        assert_eq!(result, "hello");
    }

    #[test]
    fn test_inverse_case_mixed() {
        let result = inverse_case("HeLLo WoRLd");
        assert_eq!(result, "hEllO wOrlD");
    }

    #[test]
    fn test_inverse_case_preserves_non_alpha() {
        let result = inverse_case("ABC_123_xyz");
        assert_eq!(result, "abc_123_XYZ");
    }

    #[test]
    fn test_to_camel_case() {
        assert_eq!(to_camel_case("hello world"), "helloWorld");
        assert_eq!(to_camel_case("hello_world"), "helloWorld");
        assert_eq!(to_camel_case("hello-world"), "helloWorld");
    }

    #[test]
    fn test_to_snake_case() {
        assert_eq!(to_snake_case("HelloWorld"), "hello_world");
        assert_eq!(to_snake_case("hello world"), "hello_world");
        assert_eq!(to_snake_case("hello-world"), "hello_world");
    }

    #[test]
    fn test_to_kebab_case() {
        assert_eq!(to_kebab_case("HelloWorld"), "hello-world");
        assert_eq!(to_kebab_case("hello world"), "hello-world");
    }

    #[test]
    fn test_randomize_capitalization_preserves_length() {
        let input = "hello world";
        let result = randomize_capitalization(input);
        assert_eq!(result.len(), input.len());
    }

    #[test]
    fn test_randomize_capitalization_preserves_non_alpha() {
        let input = "test123!@#";
        let result = randomize_capitalization(input);
        assert!(result.contains("123"));
        assert!(result.contains("!@#"));
    }

    #[test]
    fn test_randomize_capitalization_empty_string() {
        let result = randomize_capitalization("");
        assert_eq!(result, "");
    }

    #[test]
    fn test_randomize_capitalization_single_char() {
        let result = randomize_capitalization("a");
        assert_eq!(result.len(), 1);
        assert!(result == "a" || result == "A");
    }

    #[test]
    fn test_randomize_capitalization_numbers_only() {
        let result = randomize_capitalization("12345");
        assert_eq!(result, "12345");
    }

    #[test]
    fn test_randomize_capitalization_special_chars() {
        let result = randomize_capitalization("!@#$%");
        assert_eq!(result, "!@#$%");
    }

    #[test]
    fn test_randomize_capitalization_mixed_content() {
        let input = "Hello123World!";
        let result = randomize_capitalization(input);
        assert_eq!(result.len(), input.len());
        assert!(result.contains("123"));
        assert!(result.contains("!"));
    }

    #[test]
    fn test_randomize_capitalization_unicode() {
        let input = "héllo wörld";
        let result = randomize_capitalization(input);
        assert!(!result.is_empty());
    }

    #[test]
    fn test_randomize_capitalization_all_uppercase() {
        let input = "HELLO";
        let result = randomize_capitalization(input);
        assert_eq!(result.len(), input.len());
    }

    #[test]
    fn test_randomize_capitalization_all_lowercase() {
        let input = "hello";
        let result = randomize_capitalization(input);
        assert_eq!(result.len(), input.len());
    }

    #[test]
    fn test_randomize_capitalization_whitespace() {
        let input = "hello   world";
        let result = randomize_capitalization(input);
        assert_eq!(result.len(), input.len());
        assert!(result.contains("   "));
    }

    #[test]
    fn test_case_swap() {
        let result = case_swap("HELLO");
        // Should be different from original due to case swapping
        assert_ne!(result, "HELLO");
    }

    #[test]
    fn test_case_swap_empty_string() {
        let result = case_swap("");
        assert_eq!(result, "");
    }

    #[test]
    fn test_case_swap_single_char() {
        let result = case_swap("A");
        assert!(!result.is_empty());
    }

    #[test]
    fn test_case_swap_preserves_numbers() {
        let input = "ABC123XYZ";
        let result = case_swap(input);
        assert!(result.contains("123"));
    }

    #[test]
    fn test_case_swap_preserves_special_chars() {
        let input = "TEST!@#CODE";
        let result = case_swap(input);
        assert!(result.contains("!@#"));
    }

    #[test]
    fn test_case_swap_lowercase() {
        let result = case_swap("hello");
        assert!(!result.is_empty());
    }

    #[test]
    fn test_case_swap_mixed_case() {
        let result = case_swap("HeLLo");
        assert!(!result.is_empty());
    }

    #[test]
    fn test_case_swap_sql_injection() {
        let result = case_swap("SELECT * FROM users");
        assert!(result.to_lowercase().contains("select"));
        assert!(result.to_lowercase().contains("from"));
    }

    #[test]
    fn test_case_swap_preserves_length() {
        let input = "TestString";
        let result = case_swap(input);
        assert_eq!(result.len(), input.len());
    }

    #[test]
    fn test_case_swap_with_whitespace() {
        let input = "Hello World Test";
        let result = case_swap(input);
        assert!(result.contains(" "));
    }

    #[test]
    fn test_to_camel_case_empty_string() {
        let result = to_camel_case("");
        assert_eq!(result, "");
    }

    #[test]
    fn test_to_camel_case_single_word() {
        let result = to_camel_case("hello");
        assert_eq!(result, "hello");
    }

    #[test]
    fn test_to_camel_case_multiple_spaces() {
        let result = to_camel_case("hello   world");
        assert_eq!(result, "helloWorld");
    }

    #[test]
    fn test_to_camel_case_mixed_separators() {
        let result = to_camel_case("hello_world-test");
        assert_eq!(result, "helloWorldTest");
    }

    #[test]
    fn test_to_camel_case_uppercase_input() {
        let result = to_camel_case("HELLO WORLD");
        assert_eq!(result, "helloWorld");
    }

    #[test]
    fn test_to_camel_case_numbers() {
        let result = to_camel_case("hello123world");
        assert!(result.contains("123"));
    }

    #[test]
    fn test_to_camel_case_special_chars() {
        let result = to_camel_case("hello@world");
        assert!(result.contains("@"));
    }

    #[test]
    fn test_to_camel_case_already_camel() {
        let result = to_camel_case("helloWorld");
        assert_eq!(result, "helloworld");
    }

    #[test]
    fn test_to_camel_case_three_words() {
        let result = to_camel_case("hello world test");
        assert_eq!(result, "helloWorldTest");
    }

    #[test]
    fn test_to_snake_case_empty_string() {
        let result = to_snake_case("");
        assert_eq!(result, "");
    }

    #[test]
    fn test_to_snake_case_single_word() {
        let result = to_snake_case("hello");
        assert_eq!(result, "hello");
    }

    #[test]
    fn test_to_snake_case_camel_case() {
        let result = to_snake_case("helloWorld");
        assert_eq!(result, "hello_world");
    }

    #[test]
    fn test_to_snake_case_multiple_uppercase() {
        let result = to_snake_case("HelloWorldTest");
        assert_eq!(result, "hello_world_test");
    }

    #[test]
    fn test_to_snake_case_consecutive_uppercase() {
        let result = to_snake_case("HTTPSConnection");
        // Should convert consecutive uppercase - exact behavior may vary
        assert!(!result.is_empty());
        assert!(result.to_lowercase() == result); // Should be all lowercase
    }

    #[test]
    fn test_to_snake_case_with_numbers() {
        let result = to_snake_case("test123Value");
        assert!(result.contains("123"));
    }

    #[test]
    fn test_to_snake_case_already_snake() {
        let result = to_snake_case("hello_world");
        assert_eq!(result, "hello_world");
    }

    #[test]
    fn test_to_snake_case_kebab_input() {
        let result = to_snake_case("hello-world-test");
        assert_eq!(result, "hello_world_test");
    }

    #[test]
    fn test_to_kebab_case_empty_string() {
        let result = to_kebab_case("");
        assert_eq!(result, "");
    }

    #[test]
    fn test_to_kebab_case_single_word() {
        let result = to_kebab_case("hello");
        assert_eq!(result, "hello");
    }

    #[test]
    fn test_to_kebab_case_camel_case() {
        let result = to_kebab_case("helloWorld");
        assert_eq!(result, "hello-world");
    }

    #[test]
    fn test_to_kebab_case_snake_case() {
        let result = to_kebab_case("hello_world");
        assert_eq!(result, "hello-world");
    }

    #[test]
    fn test_to_kebab_case_multiple_words() {
        let result = to_kebab_case("HelloWorldTest");
        assert_eq!(result, "hello-world-test");
    }

    #[test]
    fn test_to_kebab_case_with_numbers() {
        let result = to_kebab_case("test123Value");
        assert!(result.contains("123"));
    }

    #[test]
    fn test_to_kebab_case_already_kebab() {
        let result = to_kebab_case("hello-world");
        assert_eq!(result, "hello-world");
    }
}