//! Tests the `#[cli]` macro.

#![cfg(feature = "cli")]
#![allow(missing_docs)]

use cicero_macro as cicero;


#[test]
fn should_template_cli_struct() {

    #[cicero::cli]
    fn testee() { }

    testee();

    let task = testee { };
    task.run();
}

#[test]
fn should_handle_function_with_parameters_and_return() {

    #[cicero::cli]
    fn testee(a: usize, b: usize) -> usize {
        a + b
    }

    assert_eq!(testee(1, 2), 3);

    let task = testee { a: 4, b: 5 };
    assert_eq!(task.run(), 9);
}

#[test]
fn should_apply_parameter_attributes_to_cli_struct_fields() {

    #[cicero::cli]
    fn testee(
        #[arg(long)] //clap's macro does not compile, if it were to be applied to function parameter
        _a: usize
    ) { }
}
