frontend 0.4.0

rustc's frontend with no LLVM and no std: parsing through MIR, as a library
// `#![no_std]`: these arrive with the standard prelude and name no path, so a `std::`
// search cannot see them - and a `#[derive]` can use them without the name appearing
// in this file at all, which is why they are not trimmed by inspection.
use alloc::borrow::ToOwned;
use alloc::boxed::Box;
use alloc::format;
use alloc::string::{String, ToString};
use alloc::vec;
use alloc::vec::Vec;

use super::{is_upper_camel_case, to_upper_camel_case};

#[test]
fn camel_case() {
    assert!(!is_upper_camel_case("userData"));
    assert_eq!(to_upper_camel_case("userData"), "UserData");

    assert!(is_upper_camel_case("X86_64"));

    assert!(!is_upper_camel_case("X86__64"));
    assert_eq!(to_upper_camel_case("X86__64"), "X86_64");

    assert!(!is_upper_camel_case("Abc_123"));
    assert_eq!(to_upper_camel_case("Abc_123"), "Abc123");

    assert!(!is_upper_camel_case("A1_b2_c3"));
    assert_eq!(to_upper_camel_case("A1_b2_c3"), "A1B2C3");

    assert!(!is_upper_camel_case("ONE_TWO_THREE"));
    assert_eq!(to_upper_camel_case("ONE_TWO_THREE"), "OneTwoThree");

    // FIXME(@Jules-Bertholet): This test doesn't work due to what I believe
    // is a Unicode spec bug - uppercase Georgian letters have
    // incorrect titlecase mappings.
    // I've reported it to Unicode.
    // Georgian mtavruli is only used in all-caps
    //assert!(!is_upper_camel_case("ᲫალაᲔრთობაშია"));
    //assert_eq!(to_upper_camel_case("ᲫალაᲔრთობაშია"), "ძალა_ერთობაშია");

    assert!(!is_upper_camel_case("LJNJaaaDŽooo"));
    assert_eq!(to_upper_camel_case("LJNJaaLjNJaDŽooo"), "LjnjaaLjNjaDžooo");

    // Final sigma
    assert!(!is_upper_camel_case("ΦΙΛΟΣ_ΦΙΛΟΣ"));
    assert_eq!(to_upper_camel_case("ΦΙΛΟΣ_ΦΙΛΟΣ"), "ΦιλοςΦιλος");
    assert!(is_upper_camel_case("ΦιλοσΦιλοσ"));
}