use slash_lang::parser::ast::{Command, Op, Pipeline, Priority, Program, Urgency};

#[test]
fn command_new_sets_name_and_priority() {
    let cmd = Command::new("deploy".into(), Priority::High);
    assert_eq!(cmd.name, "deploy");
    assert_eq!(cmd.priority, Priority::High);
    assert_eq!(cmd.urgency, Urgency::None);
    assert_eq!(cmd.verbosity, 0);
    assert!(!cmd.optional);
    assert!(cmd.args.is_empty());
    assert!(cmd.test_id.is_none());
    assert!(cmd.redirect.is_none());
    assert!(cmd.pipe.is_none());
}

#[test]
fn pipeline_operator_is_none_for_last() {
    let cmd = Command::new("build".into(), Priority::Low);
    let pipeline = Pipeline {
        commands: vec![cmd],
        operator: None,
    };
    assert!(pipeline.operator.is_none());
}

#[test]
fn program_holds_pipelines() {
    let prog = Program { pipelines: vec![] };
    assert!(prog.pipelines.is_empty());
}

#[test]
fn op_variants_are_distinct() {
    assert_ne!(Op::And, Op::Or);
    assert_ne!(Op::Pipe, Op::PipeErr);
}
