File: string_types.rs

package info (click to toggle)
rust-convert-case 0.6.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 196 kB
  • sloc: makefile: 2
file content (41 lines) | stat: -rw-r--r-- 801 bytes parent folder | download
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
use convert_case::{Case, Casing};

// use std::ffi::{OsString};

#[test]
fn string_type() {
    let s: String = String::from("rust_programming_language");
    assert_eq!(
        "RustProgrammingLanguage",
        s.to_case(Case::Pascal),
    );
}

#[test]
fn str_type() {
    let s: &str = "rust_programming_language";
    assert_eq!(
        "RustProgrammingLanguage",
        s.to_case(Case::Pascal),
    );
}

#[test]
fn string_ref_type() {
    let s: String = String::from("rust_programming_language");
    assert_eq!(
        "RustProgrammingLanguage",
        (&s).to_case(Case::Pascal),
    );
}

/*
#[test]
fn os_string_type() {
    let s: OsString = OsString::from("rust_programming_language");
    assert_eq!(
        "RustProgrammingLanguage",
        s.to_case(Case::Pascal),
    );
}
*/