nu-lint 1.3.0

Linter for Nu shell scripts that helpfully suggests improvements
Documentation
use super::RULE;

#[test]
fn test_descriptive_error_message_not_flagged() {
    let source = r#"
def process [input: int] {
    if $input < 0 {
        error make { msg: "Input must be non-negative, got: " + ($input | into string) }
    }
}
"#;
    RULE.assert_ignores(source);
}

#[test]
fn test_specific_error_message_not_flagged() {
    let source = r#"
def validate_file [path: string] {
    if not ($path | path exists) {
        error make { msg: $"File not found: ($path)" }
    }
}
"#;
    RULE.assert_ignores(source);
}

#[test]
fn test_print_stdout_not_flagged() {
    let source = r#"
def process [] {
    print "error"
}
"#;
    RULE.assert_ignores(source);
}

#[test]
fn test_print_stderr_descriptive_not_flagged() {
    let source = r#"
def process [] {
    print -e "Configuration file not found at ~/.config/app.toml"
}
"#;
    RULE.assert_ignores(source);
}