@@ -186,6 +186,36 @@ def test_nested(self):
186186 self .assert_fprettify_result ([], instring , outstring_exp_default )
187187 self .assert_fprettify_result (['--strict-indent' ], instring , outstring_exp_strict )
188188
189+ def test_disable (self ):
190+ """test disabling indentation and/or whitespace formatting"""
191+ instring = ("if(&\n l==111)&\n then\n do m =1, 2\n A=&\n B+C\n enddo; endif" )
192+ outstring_exp_default = ("if ( &\n l == 111) &\n then\n do m = 1, 2\n "
193+ " A = &\n B + C\n enddo; endif" )
194+ outstring_exp_nowhitespace = ("if(&\n l==111)&\n then\n do m =1, 2\n "
195+ " A=&\n B+C\n enddo; endif" )
196+ outstring_exp_noindent = ("if ( &\n l == 111) &\n then\n do m = 1, 2\n "
197+ " A = &\n B + C\n enddo; endif" )
198+
199+ self .assert_fprettify_result ([], instring , outstring_exp_default )
200+ self .assert_fprettify_result (['--disable-whitespace' ], instring , outstring_exp_nowhitespace )
201+ self .assert_fprettify_result (['--disable-indent' ], instring , outstring_exp_noindent )
202+ self .assert_fprettify_result (['--disable-indent' , '--disable-whitespace' ], instring , instring )
203+
204+ def test_comments (self ):
205+ """test options related to comments"""
206+ instring = ("TYPE mytype\n ! c1\n !c2\n INTEGER :: a ! c3\n "
207+ " REAL :: b, & ! c4\n ! c5\n ! c6\n "
208+ " d ! c7\n END TYPE ! c8" )
209+ outstring_exp_default = ("TYPE mytype\n ! c1\n !c2\n INTEGER :: a ! c3\n "
210+ " REAL :: b, & ! c4\n ! c5\n ! c6\n "
211+ " d ! c7\n END TYPE ! c8" )
212+ outstring_exp_strip = ("TYPE mytype\n ! c1\n !c2\n INTEGER :: a ! c3\n "
213+ " REAL :: b, & ! c4\n ! c5\n ! c6\n "
214+ " d ! c7\n END TYPE ! c8" )
215+
216+ self .assert_fprettify_result ([], instring , outstring_exp_default )
217+ self .assert_fprettify_result (['--strip-comments' ], instring , outstring_exp_strip )
218+
189219 def test_directive (self ):
190220 """
191221 test deactivate directives '!&' (inline) and '!&<', '!&>' (block)
0 commit comments