@@ -15,43 +15,63 @@ def validate_folding(results: list, ref: list):
1515 assert results [i ] == ref [i ]
1616
1717
18- def test_if_folding ():
18+ def test_folding_if ():
1919 """Test the ranges for several blocks are correct"""
2020 string = write_rpc_request (1 , "initialize" , {"rootPath" : str (test_dir )})
21- file_path = test_dir / "subdir" / "test_if_folding .f90"
21+ file_path = test_dir / "subdir" / "test_folding_if .f90"
2222 string += folding_req (file_path )
2323 errcode , results = run_request (string )
2424 assert errcode == 0
25+ print (results [1 ])
2526 ref = [
26- {"startLine" : 0 , "endLine" : 42 },
27- {"startLine" : 10 , "endLine" : 20 },
28- {"startLine" : 21 , "endLine" : 22 },
29- {"startLine" : 11 , "endLine" : 19 },
30- {"startLine" : 13 , "endLine" : 14 },
31- {"startLine" : 15 , "endLine" : 16 },
32- {"startLine" : 17 , "endLine" : 18 },
33- {"startLine" : 30 , "endLine" : 34 },
34- {"startLine" : 35 , "endLine" : 38 },
35- {"startLine" : 39 , "endLine" : 40 },
36- {"startLine" : 2 , "endLine" : 5 },
37- {"startLine" : 25 , "endLine" : 27 },
38- {"startLine" : 31 , "endLine" : 33 },
27+ {"startLine" : 0 , "endLine" : 43 },
28+ {"startLine" : 11 , "endLine" : 21 },
29+ {"startLine" : 22 , "endLine" : 23 },
30+ {"startLine" : 12 , "endLine" : 20 },
31+ {"startLine" : 14 , "endLine" : 15 },
32+ {"startLine" : 16 , "endLine" : 17 },
33+ {"startLine" : 18 , "endLine" : 19 },
34+ {"startLine" : 31 , "endLine" : 35 },
35+ {"startLine" : 36 , "endLine" : 39 },
36+ {"startLine" : 40 , "endLine" : 41 },
37+ {"startLine" : 2 , "endLine" : 6 },
38+ {"startLine" : 26 , "endLine" : 28 },
39+ {"startLine" : 32 , "endLine" : 34 },
40+ ]
41+ validate_folding (results [1 ], ref )
42+
43+
44+ def test_folding_select_case ():
45+ """Test the ranges for several blocks are correct"""
46+ string = write_rpc_request (1 , "initialize" , {"rootPath" : str (test_dir )})
47+ file_path = test_dir / "subdir" / "test_folding_select_case.f90"
48+ string += folding_req (file_path )
49+ errcode , results = run_request (string )
50+ assert errcode == 0
51+ ref = [
52+ {"startLine" : 0 , "endLine" : 14 },
53+ {"startLine" : 4 , "endLine" : 4 },
54+ {"startLine" : 5 , "endLine" : 6 },
55+ {"startLine" : 7 , "endLine" : 8 },
56+ {"startLine" : 9 , "endLine" : 10 },
57+ {"startLine" : 11 , "endLine" : 12 },
3958 ]
4059 validate_folding (results [1 ], ref )
4160
4261
43- def test_mline_sub_folding ():
62+ def test_folding_subroutine ():
4463 """Test the ranges for several blocks are correct"""
4564 string = write_rpc_request (1 , "initialize" , {"rootPath" : str (test_dir )})
46- file_path = test_dir / "subdir" / "test_mline_sub_folding .f90"
65+ file_path = test_dir / "subdir" / "test_folding_subroutine .f90"
4766 string += folding_req (file_path )
4867 errcode , results = run_request (string )
4968 assert errcode == 0
69+ print (results [1 ])
5070 ref = [
51- {"startLine" : 0 , "endLine" : 3 },
52- {"startLine" : 4 , "endLine" : 14 },
53- {"startLine" : 0 , "endLine" : 4 },
54- {"startLine" : 6 , "endLine" : 9 },
55- {"startLine" : 12 , "endLine" : 13 },
71+ {"startLine" : 1 , "endLine" : 4 },
72+ {"startLine" : 5 , "endLine" : 17 },
73+ {"startLine" : 1 , "endLine" : 5 },
74+ {"startLine" : 8 , "endLine" : 11 },
75+ {"startLine" : 15 , "endLine" : 16 },
5676 ]
5777 validate_folding (results [1 ], ref )
0 commit comments