File tree Expand file tree Collapse file tree 1 file changed +58
-0
lines changed
src/lint/rules/tests/linelength Expand file tree Collapse file tree 1 file changed +58
-0
lines changed Original file line number Diff line number Diff line change 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+ }
You can’t perform that action at this time.
0 commit comments