@@ -5267,59 +5267,83 @@ enddef
52675267
52685268" Test for using more than one has() check in a compound if condition.
52695269def Test_has_func_shortcircuit ()
5270- def Has_And1_Cond (): string
5271- # true && false
5272- if has (' jumplist' ) && has (' foobar' )
5273- return ' present'
5274- endif
5275- return ' missing'
5276- enddef
5277- assert_equal (' missing' , Has_And1_Cond ())
5270+ var lines = << trim END
5271+ vim9script
5272+ def Has_And1_Cond (): string
5273+ # true && false
5274+ if has (' jumplist' ) && has (' foobar' )
5275+ return ' present'
5276+ endif
5277+ return ' missing'
5278+ enddef
5279+ assert_equal (' missing' , Has_And1_Cond ())
5280+ END
5281+ v9.CheckSourceSuccess (lines )
52785282
5279- def Has_And2_Cond (): string
5280- # false && true
5281- if has (' foobar' ) && has (' jumplist' )
5282- return ' present'
5283- endif
5284- return ' missing'
5285- enddef
5286- assert_equal (' missing' , Has_And2_Cond ())
5283+ lines = << trim END
5284+ vim9script
5285+ def Has_And2_Cond (): string
5286+ # false && true
5287+ if has (' foobar' ) && has (' jumplist' )
5288+ return ' present'
5289+ endif
5290+ return ' missing'
5291+ enddef
5292+ assert_equal (' missing' , Has_And2_Cond ())
5293+ END
5294+ v9.CheckSourceSuccess (lines )
52875295
5288- def Has_And3_Cond (): string
5289- # false && false
5290- if has (' foobar' ) && has (' foobaz' )
5291- return ' present'
5292- endif
5293- return ' missing'
5294- enddef
5295- assert_equal (' missing' , Has_And3_Cond ())
5296+ lines = << trim END
5297+ vim9script
5298+ def Has_And3_Cond (): string
5299+ # false && false
5300+ if has (' foobar' ) && has (' foobaz' )
5301+ return ' present'
5302+ endif
5303+ return ' missing'
5304+ enddef
5305+ assert_equal (' missing' , Has_And3_Cond ())
5306+ END
5307+ v9.CheckSourceSuccess (lines )
52965308
5297- def Has_Or1_Cond (): string
5298- # true || false
5299- if has (' jumplist' ) || has (' foobar' )
5300- return ' present'
5301- endif
5302- return ' missing'
5303- enddef
5304- assert_equal (' present' , Has_Or1_Cond ())
5309+ lines = << trim END
5310+ vim9script
5311+ def Has_Or1_Cond (): string
5312+ # true || false
5313+ if has (' jumplist' ) || has (' foobar' )
5314+ return ' present'
5315+ endif
5316+ return ' missing'
5317+ enddef
5318+ assert_equal (' present' , Has_Or1_Cond ())
5319+ END
5320+ v9.CheckSourceSuccess (lines )
53055321
5306- def Has_Or2_Cond (): string
5307- # false || true
5308- if has (' foobar' ) || has (' jumplist' )
5309- return ' present'
5310- endif
5311- return ' missing'
5312- enddef
5313- assert_equal (' present' , Has_Or2_Cond ())
5322+ lines = << trim END
5323+ vim9script
5324+ def Has_Or2_Cond (): string
5325+ # false || true
5326+ if has (' foobar' ) || has (' jumplist' )
5327+ return ' present'
5328+ endif
5329+ return ' missing'
5330+ enddef
5331+ assert_equal (' present' , Has_Or2_Cond ())
5332+ END
5333+ v9.CheckSourceSuccess (lines )
53145334
5315- def Has_Or3_Cond (): string
5316- # false || false
5317- if has (' foobar' ) || has (' foobaz' )
5318- return ' present'
5319- endif
5320- return ' missing'
5321- enddef
5322- assert_equal (' missing' , Has_Or3_Cond ())
5335+ lines = << trim END
5336+ vim9script
5337+ def Has_Or3_Cond (): string
5338+ # false || false
5339+ if has (' foobar' ) || has (' foobaz' )
5340+ return ' present'
5341+ endif
5342+ return ' missing'
5343+ enddef
5344+ assert_equal (' missing' , Has_Or3_Cond ())
5345+ END
5346+ v9.CheckSourceSuccess (lines )
53235347enddef
53245348
53255349" Test for using more than one len() function in a compound if condition.
0 commit comments