windjammer 0.48.0

A simple language inspired by Go, Ruby, and Elixir that transpiles to Rust - 80% of Rust's power with 20% of the complexity
Documentation
#![cfg(any(
    not(any(
        feature = "parser_tests",
        feature = "analyzer_tests",
        feature = "codegen_tests",
        feature = "interpreter_tests",
        feature = "conformance_tests",
        feature = "integration_tests",
    )),
    feature = "analyzer_tests",
))]

#[path = "common/test_utils.rs"]
mod test_utils;

/// Helper to compile Windjammer code and return the generated Rust code
#[test]
#[cfg_attr(tarpaulin, ignore)]
fn test_struct_field_some_string_literal() {
    let code = r#"
    struct Config {
        name: string,
        parent: Option<string>,
    }
    impl Config {
        pub fn new() -> Config {
            Config {
                name: "default",
                parent: Some("root"),
            }
        }
    }
    "#;
    let generated = test_utils::compile_single_result(code).expect("Compilation failed");
    assert!(
        generated.contains(r#"Some("root".to_string()"#)
            || generated.contains(r#"Some(string::from("root")"#)
            || generated.contains(r#"Some(String::from("root")"#),
        "Some with string literal should auto-convert in struct field: {}",
        generated
    );
    assert!(
        generated.contains(r#"name: "default".to_string()"#)
            || generated.contains(r#"name: string::from("default")"#)
            || generated.contains(r#"name: String::from("default")"#),
        "Direct string literal field should also convert: {}",
        generated
    );
}

#[test]
#[cfg_attr(tarpaulin, ignore)]
fn test_struct_field_ok_string_literal() {
    let code = r#"
    struct Response {
        status: Result<string, string>,
    }
    impl Response {
        pub fn success() -> Response {
            Response {
                status: Ok("success"),
            }
        }
    }
    "#;
    let generated = test_utils::compile_single_result(code).expect("Compilation failed");
    assert!(
        generated.contains(r#"Ok("success".to_string()"#)
            || generated.contains(r#"Ok(string::from("success")"#)
            || generated.contains(r#"Ok(String::from("success")"#),
        "Ok with string literal should auto-convert in struct field: {}",
        generated
    );
}