Skip to content

Commit

Permalink
test: added integration tests for Caser
Browse files Browse the repository at this point in the history
  • Loading branch information
sttk committed Feb 25, 2024
1 parent c9f39f8 commit b1435d4
Showing 1 changed file with 127 additions and 0 deletions.
127 changes: 127 additions & 0 deletions tests/caser_test.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
use stringcase::Caser;

#[test]
fn it_should_convert_to_camel_case_by_method_of_string() {
let converted = "foo_bar100BAZQux".to_camel_case();
assert_eq!(converted, "fooBar100BazQux");
}

#[test]
fn it_should_convert_to_camel_case_with_sep_by_method_of_string() {
let converted = "foo_bar100BAZQux".to_camel_case_with_sep("_");
assert_eq!(converted, "fooBar100BazQux");
}

#[test]
fn it_should_convert_to_camel_case_with_keep_by_method_of_string() {
let converted = "foo_bar100BAZQux".to_camel_case_with_keep("#");
assert_eq!(converted, "fooBar100BazQux");
}

#[test]
fn it_should_convert_to_cobol_case_by_method_of_string() {
let converted = "foo_bar100BAZQux".to_cobol_case();
assert_eq!(converted, "FOO-BAR100-BAZ-QUX");
}

#[test]
fn it_should_convert_to_cobol_case_with_sep_by_method_of_string() {
let converted = "foo_bar100BAZQux".to_cobol_case_with_sep("_");
assert_eq!(converted, "FOO-BAR100-BAZ-QUX");
}

#[test]
fn it_should_convert_to_cobol_case_with_keep_by_method_of_string() {
let converted = "foo_bar100BAZQux".to_cobol_case_with_keep("#");
assert_eq!(converted, "FOO-BAR100-BAZ-QUX");
}

#[test]
fn it_should_convert_to_kebab_case_by_method_of_string() {
let converted = "foo_bar100BAZQux".to_kebab_case();
assert_eq!(converted, "foo-bar100-baz-qux");
}

#[test]
fn it_should_convert_to_kebab_case_with_sep_by_method_of_string() {
let converted = "foo_bar100BAZQux".to_kebab_case_with_sep("_");
assert_eq!(converted, "foo-bar100-baz-qux");
}

#[test]
fn it_should_convert_to_kebab_case_with_keep_by_method_of_string() {
let converted = "foo_bar100BAZQux".to_kebab_case_with_keep("#");
assert_eq!(converted, "foo-bar100-baz-qux");
}

#[test]
fn it_should_convert_to_macro_case_by_method_of_string() {
let converted = "foo_bar100BAZQux".to_macro_case();
assert_eq!(converted, "FOO_BAR100_BAZ_QUX");
}

#[test]
fn it_should_convert_to_macro_case_with_sep_by_method_of_string() {
let converted = "foo_bar100BAZQux".to_macro_case_with_sep("_");
assert_eq!(converted, "FOO_BAR100_BAZ_QUX");
}

#[test]
fn it_should_convert_to_macro_case_with_keep_by_method_of_string() {
let converted = "foo_bar100BAZQux".to_macro_case_with_keep("#");
assert_eq!(converted, "FOO_BAR100_BAZ_QUX");
}

#[test]
fn it_should_convert_to_pascal_case_by_method_of_string() {
let converted = "foo_bar100BAZQux".to_pascal_case();
assert_eq!(converted, "FooBar100BazQux");
}

#[test]
fn it_should_convert_to_pascal_case_with_sep_by_method_of_string() {
let converted = "foo_bar100BAZQux".to_pascal_case_with_sep("_");
assert_eq!(converted, "FooBar100BazQux");
}

#[test]
fn it_should_convert_to_pascal_case_with_keep_by_method_of_string() {
let converted = "foo_bar100BAZQux".to_pascal_case_with_keep("#");
assert_eq!(converted, "FooBar100BazQux");
}

#[test]
fn it_should_convert_to_snake_case_by_method_of_string() {
let converted = "foo_bar100BAZQux".to_snake_case();
assert_eq!(converted, "foo_bar100_baz_qux");
}

#[test]
fn it_should_convert_to_snake_case_with_sep_by_method_of_string() {
let converted = "foo_bar100BAZQux".to_snake_case_with_sep("_");
assert_eq!(converted, "foo_bar100_baz_qux");
}

#[test]
fn it_should_convert_to_snake_case_with_keep_by_method_of_string() {
let converted = "foo_bar100BAZQux".to_snake_case_with_keep("#");
assert_eq!(converted, "foo_bar100_baz_qux");
}

#[test]
fn it_should_convert_to_train_case_by_method_of_string() {
let converted = "foo_bar100BAZQux".to_train_case();
assert_eq!(converted, "Foo-Bar100-Baz-Qux");
}

#[test]
fn it_should_convert_to_train_case_with_sep_by_method_of_string() {
let converted = "foo_bar100BAZQux".to_train_case();
assert_eq!(converted, "Foo-Bar100-Baz-Qux");
}

#[test]
fn it_should_convert_to_train_case_with_keep_by_method_of_string() {
let converted = "foo_bar100BAZQux".to_train_case_with_keep("#");
assert_eq!(converted, "Foo-Bar100-Baz-Qux");
}

0 comments on commit b1435d4

Please sign in to comment.