Skip to content

Commit 4c336d5

Browse files
committed
Add file for srcbreak_before_binary_op tests
1 parent 3a3d605 commit 4c336d5

File tree

1 file changed

+58
-0
lines changed

1 file changed

+58
-0
lines changed
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
use crate::lint::rules::tests::common::{set_up, assert_snippet};
2+
use crate::lint::rules::RuleType;
3+
4+
static PARAM_ASSIGN_LOGIC_OP_CORRECT: &str = "
5+
param LOGIC_RESULT = initial_condition
6+
| second_condition;
7+
";
8+
9+
#[test]
10+
fn param_assign_logic_op_correct() {
11+
let rules = set_up();
12+
let expected_errors = vec![];
13+
assert_snippet(PARAM_ASSIGN_LOGIC_OP_CORRECT, expected_errors, &rules);
14+
}
15+
16+
static PARAM_ASSIGN_LOGIC_OP_INCORRECT: &str = "
17+
param LOGIC_RESULT = initial_condition |
18+
second_condition;
19+
";
20+
21+
#[test]
22+
fn param_assign_logic_op_incorrect() {
23+
let rules = set_up();
24+
let expected_errors = define_expected_errors!(
25+
RuleType::LL2,
26+
(1, 1, 39, 40),
27+
);
28+
assert_snippet(PARAM_ASSIGN_LOGIC_OP_INCORRECT, expected_errors, &rules);
29+
}
30+
31+
static ASSIGN_ARITHMETIC_OP_CORRECT: &str = "
32+
session int variable
33+
= initial_condition
34+
+ second_condition;
35+
";
36+
37+
#[test]
38+
fn assign_arithmetic_op_correct() {
39+
let rules = set_up();
40+
let expected_errors = vec![];
41+
assert_snippet(ASSIGN_ARITHMETIC_OP_CORRECT, expected_errors, &rules);
42+
}
43+
44+
static ASSIGN_ARITHMETIC_OP_INCORRECT: &str = "
45+
session int variable =
46+
initial_value +
47+
second_condition;
48+
";
49+
50+
#[test]
51+
fn assign_arithmetic_op_incorrect() {
52+
let rules = set_up();
53+
let expected_errors = define_expected_errors!(
54+
RuleType::LL2,
55+
(2, 2, 18, 19),
56+
);
57+
assert_snippet(ASSIGN_ARITHMETIC_OP_INCORRECT, expected_errors, &rules);
58+
}

0 commit comments

Comments
 (0)