Skip to content

Commit

Permalink
Add max recursion test
Browse files Browse the repository at this point in the history
  • Loading branch information
loicgasser committed Aug 24, 2017
1 parent d092b77 commit 961b318
Show file tree
Hide file tree
Showing 8 changed files with 27 additions and 0 deletions.
4 changes: 4 additions & 0 deletions tests/samples/include1_recursive.map
@@ -0,0 +1,4 @@
MAP
NAME 'include_test'
INCLUDE 'include2_recursive.map'
END
3 changes: 3 additions & 0 deletions tests/samples/include2_recursive.map
@@ -0,0 +1,3 @@
LAYER
INCLUDE 'include3_recursive.map'
END
4 changes: 4 additions & 0 deletions tests/samples/include3_recursive.map
@@ -0,0 +1,4 @@
CLASS
NAME 'test_class'
INCLUDE 'include4_recursive.map'
END
3 changes: 3 additions & 0 deletions tests/samples/include4_recursive.map
@@ -0,0 +1,3 @@
STYLE
INCLUDE 'include5_recursive.map'
END
2 changes: 2 additions & 0 deletions tests/samples/include5_recursive.map
@@ -0,0 +1,2 @@
COLOR 0 0 0
INCLUDE 'include6_recursive.map'
2 changes: 2 additions & 0 deletions tests/samples/include6_recursive.map
@@ -0,0 +1,2 @@
SIZE 8
INCLUDE 'include7_recursive.map'
1 change: 1 addition & 0 deletions tests/samples/include7_recursive.map
@@ -0,0 +1 @@
OUTLINECOLOR 255 255 255
8 changes: 8 additions & 0 deletions tests/test_sample_maps.py
Expand Up @@ -46,6 +46,14 @@ def test_includes_nested_path():
print(mappyfile.dumps(d))


def test_includes_max_recursion():
p = Parser()

with pytest.raises(Exception) as excinfo:
p.parse_file('./tests/samples/include1_recursive.map')

assert 'Maximum nested include exceeded' in str(excinfo.value)

def run_tests():
pytest.main(["tests/test_sample_maps.py"])

Expand Down

0 comments on commit 961b318

Please sign in to comment.