luau-syntax 0.732.0

Luau lexer, parser, AST, CST, and source utilities
Documentation
use super::*;

// Parser.test.cpp: parse_compound_assignment_error_call

// Parser.test.cpp: parse_compound_assignment_error_not_lvalue

// Parser.test.cpp: parse_compound_assignment_error_multiple
#[test]
fn compound_assignment_errors() {
    for (source, expected) in [
        (
            "a() += 5",
            "Expected identifier when parsing expression, got '+='",
        ),
        (
            "(a) += 5",
            "Assigned expression must be a variable or a field",
        ),
        (
            "a, b += 5",
            "Expected '=' when parsing assignment, got '+='",
        ),
    ] {
        parse_errors(source).assert_first_message(expected);
    }
}
// Parser.test.cpp: parse_error_assignment_lvalue
#[test]
fn parse_error_assignment_lvalue() {
    for source in [
        r#"
        local a, b
        (2), b = b, a
    "#,
        r#"
        local a, b
        a, (3) = b, a
    "#,
    ] {
        parse_errors(source)
            .assert_first_message("Assigned expression must be a variable or a field");
    }
}