@@ -13,19 +13,19 @@ func TestCyclomaticComplexity(t *testing.T) {
13
13
Children : []* uast.Node {
14
14
{InternalType : "root" }, // 1 (initial)
15
15
// Prefix is the default so it doesnt need any role
16
- {InternalType : "if1" , Roles : []uast.Role {uast .If }, Children : []* uast.Node { // 2 (If)
17
- {InternalType : "if1else1" , Roles : []uast.Role {uast .IfElse }, Children : []* uast.Node { // 0
18
- {InternalType : "if1else1foreach" , Roles : []uast.Role {uast .ForEach }, Children : []* uast.Node { // 3 (ForEach )
19
- {InternalType : "foreach_child1" }, // 0
20
- {InternalType : "foreach_child2_continue" , Roles : []uast.Role {uast .Continue }}, // 4 (Continue)
16
+ {InternalType : "if1" , Roles : []uast.Role {uast .Statement , uast . If }, Children : []* uast.Node { // 2 (If, Statement )
17
+ {InternalType : "if1else1" , Roles : []uast.Role {uast .If , uast . Then }, Children : []* uast.Node { // 0
18
+ {InternalType : "if1else1foreach" , Roles : []uast.Role {uast .Statement , uast . For , uast . Iterator }, Children : []* uast.Node { // 3 (For, Statement )
19
+ {InternalType : "foreach_child1" }, // 0
20
+ {InternalType : "foreach_child2_continue" , Roles : []uast.Role {uast .Statement , uast . Continue }}, // 4 (Statement, Continue)
21
21
}},
22
- {InternalType : "if1else1if" , Roles : []uast.Role {uast .If }, Children : []* uast.Node { // 5 (If)
23
- {InternalType : "elseif_child1" }, // 0
24
- {InternalType : "opAnd" , Roles : []uast.Role {uast .OpBooleanAnd }}, // 6 (OpBooleanAnd )
25
- {InternalType : "elseif_child2" }, // 0
22
+ {InternalType : "if1else1if" , Roles : []uast.Role {uast .Statement , uast . If }, Children : []* uast.Node { // 5 (Statement, If)
23
+ {InternalType : "elseif_child1" }, // 0
24
+ {InternalType : "opAnd" , Roles : []uast.Role {uast .Operator , uast . Boolean , uast . And }}, // 6 (Operator, Boolean )
25
+ {InternalType : "elseif_child2" }, // 0
26
26
}},
27
27
}},
28
- {InternalType : "break" , Roles : []uast.Role {uast .Break }},
28
+ {InternalType : "break" , Roles : []uast.Role {uast .Statement , uast . Break }},
29
29
},
30
30
}}}
31
31
require .Equal (cyclomaticComplexity (n ), 6 )
0 commit comments