use super::RULE;
#[test]
fn test_good_closure_no_space_before_params() {
let good = "[[status]; [UP] [UP]] | all {|el| $el.status == UP }";
RULE.assert_ignores(good);
}
#[test]
fn test_good_reduce_with_comma() {
let good = "[1 2 3 4] | reduce {|elt, acc| $elt + $acc }";
RULE.assert_ignores(good);
}
#[test]
fn test_good_reduce_without_comma() {
let good = "[1 2 3 4] | reduce {|elt acc| $elt + $acc }";
RULE.assert_ignores(good);
}
#[test]
fn test_good_each_closure() {
let good = "[1 2 3] | each {|x| $x * 2 }";
RULE.assert_ignores(good);
}
#[test]
fn test_good_closure_empty_params() {
let good = "[1 2] | each {|| $in * 2 }";
RULE.assert_ignores(good);
}
#[test]
fn test_good_closure_empty_params_in_list() {
let good = "[{|| notify-long-command }]";
RULE.assert_ignores(good);
}
#[test]
fn test_closure_without_params_ignored() {
let good = "do { print 'hello' }";
RULE.assert_ignores(good);
}
#[test]
fn test_record_ignored() {
let good = "{x: 1, y: 2}";
RULE.assert_ignores(good);
}