File tree Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change 77"""
88
99# flake8: noqa
10+ import pytest
1011
1112import nginx
1213import unittest
177178}
178179"""
179180
181+ TESTBLOCK_CASE_11 = """
182+ server{
183+ listen 80;
184+ #OPEN-PORT-443
185+ listen 443 ssl;
186+ server_name www.xxx.com;
187+ root /wwww/wwww;
188+
189+ location ~ .*\.(js|css)?$ {
190+ expires 12h;
191+ error_log off;
192+ access_log /dev/null # MISSING SEMICOLON
193+ }
194+ }
195+ """
196+
180197
181198class TestPythonNginx (unittest .TestCase ):
182199 def test_basic_load (self ):
@@ -290,5 +307,11 @@ def test_types_block(self):
290307 data_type = inp_data .filter ("Types" )[0 ].filter ("Key" )[0 ]
291308 self .assertEqual (data_type .value , "cea" )
292309
310+ def test_missing_semi_colon (self ):
311+ with pytest .raises (nginx .ParseError ) as e :
312+ nginx .loads (TESTBLOCK_CASE_11 )
313+ self .assertEqual (str (e .value ), "Config syntax, missing ';' at index: 189" )
314+
315+
293316if __name__ == '__main__' :
294317 unittest .main ()
You can’t perform that action at this time.
0 commit comments