Experimenting with more structured ways to handle command-line input/output in Rust
//! End-to-end test for recursive localization support in the `fluent_embed_derive` macro

mod common;

use common::compare_message;
use fluent_embed::localize;
use icu_locale::langid;

#[localize("tests/locale/**/basic.ftl")]
pub struct Title {
    name: String,
}

#[localize("tests/locale/**/basic.ftl")]
pub struct Praise {
    name: Title,
}

#[localize("tests/locale/**/basic.ftl")]
pub struct Greeting {
    name: Praise,
}

#[test]
fn once() {
    let name = Title {
        name: String::from("Ferris"),
    };
    compare_message(
        Praise { name },
        "the Excellent Ferris the crab",
        langid!("en-US"),
    )
}

#[test]
fn twice() {
    let name = Praise {
        name: Title {
            name: String::from("Ferris"),
        },
    };
    compare_message(
        Greeting { name },
        "Hello, the Excellent Ferris the crab!",
        langid!("en-US"),
    )
}