rok-utils 0.2.2

Laravel/AdonisJS-inspired utility helpers for the Rok ecosystem
Documentation
use rok_utils::{path, string};

#[test]
fn write_and_read() {
    use std::fs;
    let dir = tempfile::tempdir().unwrap();
    let file = dir.path().join("out.txt");
    fs::write(&file, b"rok").unwrap();
    let content = fs::read_to_string(&file).unwrap();
    assert_eq!(content, "rok");
}

#[test]
fn path_normalize() {
    assert_eq!(
        path::normalize("a/b/../c/./d"),
        std::path::PathBuf::from("a/c/d")
    );
}

#[test]
fn string_conversions() {
    assert_eq!(string::to_camel_case("hello_world"), "helloWorld");
    assert_eq!(string::to_pascal_case("hello_world"), "HelloWorld");
    assert_eq!(string::to_snake_case("helloWorld"), "hello_world");
    assert_eq!(string::to_kebab_case("HelloWorld"), "hello-world");
    assert_eq!(string::to_screaming_snake("helloWorld"), "HELLO_WORLD");
}