File tree Expand file tree Collapse file tree 1 file changed +25
-3
lines changed Expand file tree Collapse file tree 1 file changed +25
-3
lines changed Original file line number Diff line number Diff line change @@ -175,6 +175,7 @@ impl Exit for CppCode {
175175impl Exit for JavaCode {
176176 fn compute ( node : & Node , stats : & mut Stats ) {
177177 if matches ! ( node. object( ) . kind_id( ) . into( ) , Java :: ReturnStatement ) {
178+ println ! ( "{}" , node. object( ) . kind( ) ) ;
178179 stats. exit += 1 ;
179180 }
180181 }
@@ -318,7 +319,7 @@ mod tests {
318319 check_metrics ! (
319320 "int a = 42;" ,
320321 "foo.java" ,
321- CppParser ,
322+ JavaParser ,
322323 nexits,
323324 [
324325 ( exit_sum, 0 , usize ) ,
@@ -333,16 +334,37 @@ mod tests {
333334 fn java_simple_function ( ) {
334335 check_metrics ! (
335336 "public int sum(int x, int y) {
336- return x + y;
337+ return x + y;
337338 }" ,
338339 "foo.java" ,
339- CppParser ,
340+ JavaParser ,
340341 nexits,
341342 [
342343 ( exit_sum, 1 , usize ) ,
343344 ( exit_min, 0 , usize ) ,
344345 ( exit_max, 1 , usize )
345346 ] ,
347+ [ ( exit_average, f64 :: NAN ) ] // 1 function
348+ ) ;
349+ }
350+
351+ #[ test]
352+ fn java_split_function ( ) {
353+ check_metrics ! (
354+ "public int multiply(int x, int y) {
355+ if(x == 0 || y == 0){
356+ return 0;
357+ }
358+ return x * y;
359+ }" ,
360+ "foo.java" ,
361+ JavaParser ,
362+ nexits,
363+ [
364+ ( exit_sum, 2 , usize ) ,
365+ ( exit_min, 0 , usize ) ,
366+ ( exit_max, 1 , usize )
367+ ] ,
346368 [ ( exit_average, 1.0 ) ] // 1 function
347369 ) ;
348370 }
You can’t perform that action at this time.
0 commit comments