humanize-string 0.1.0

Convert a camelCase / snake_case / dash-case string into a human-readable one (fooBar -> Foo bar). A faithful port of the humanize-string npm package.
Documentation
//! Integration tests exercising the public API of `humanize-string`.

use humanize_string::{humanize_string, humanize_string_with};

#[test]
fn humanizes_identifiers() {
    assert_eq!(humanize_string("getHTTPResponseCode"), "Get http response code");
    assert_eq!(humanize_string("inner_html"), "Inner html");
    assert_eq!(humanize_string("user-name"), "User name");
    assert_eq!(humanize_string("first_name"), "First name");
}

#[test]
fn preserve_case_mode() {
    assert_eq!(humanize_string_with("getHTTPResponseCode", true), "GetHTTPResponseCode");
    assert_eq!(humanize_string_with("user-name", true), "User name");
}

#[test]
fn normalizes_whitespace_and_punctuation() {
    assert_eq!(humanize_string("a__b--c"), "A b c");
    assert_eq!(humanize_string("  leading and trailing  "), "Leading and trailing");
    assert_eq!(humanize_string("___"), "");
    assert_eq!(humanize_string(""), "");
}