File tree Expand file tree Collapse file tree 1 file changed +32
-0
lines changed Expand file tree Collapse file tree 1 file changed +32
-0
lines changed Original file line number Diff line number Diff line change 1+ import os
2+ import tempfile
3+
4+ import pytest
5+ from setup_tests import Path , run_request , write_rpc_request
6+
7+ from fortls .constants import Severity
8+
9+
10+ @pytest .fixture ()
11+ def setup_tmp_file ():
12+ levels = 2000
13+ fd , filename = tempfile .mkstemp (suffix = ".f90" )
14+ try :
15+ with os .fdopen (fd , "w" ) as tmp :
16+ tmp .write (
17+ "program nested_if\n "
18+ + str ("if (.true.) then\n " * levels )
19+ + str ("end if\n " * levels )
20+ + "end program nested_if"
21+ )
22+ yield filename
23+ finally :
24+ os .remove (filename )
25+
26+
27+ def test_recursion_error_handling (setup_tmp_file ):
28+ root = Path (setup_tmp_file ).parent
29+ request_string = write_rpc_request (1 , "initialize" , {"rootPath" : str (root )})
30+ errcode , results = run_request (request_string )
31+ assert errcode == 0
32+ assert results [0 ]["type" ] == Severity .error
You can’t perform that action at this time.
0 commit comments