forked from aniani/vim
		
	patch 8.2.0353: Vim9: while loop not tested
Problem: Vim9: while loop not tested. Solution: Add test with "while", "break" and "continue"
This commit is contained in:
		| @@ -855,28 +855,6 @@ def Test_delfunc() | |||||||
|   delete('XToDelFunc') |   delete('XToDelFunc') | ||||||
| enddef | enddef | ||||||
|  |  | ||||||
| def Test_substitute_cmd() |  | ||||||
|   new |  | ||||||
|   setline(1, 'something') |  | ||||||
|   :substitute(some(other( |  | ||||||
|   assert_equal('otherthing', getline(1)) |  | ||||||
|   bwipe! |  | ||||||
|  |  | ||||||
|   " also when the context is Vim9 script |  | ||||||
|   let lines =<< trim END |  | ||||||
|     vim9script |  | ||||||
|     new |  | ||||||
|     setline(1, 'something') |  | ||||||
|     :substitute(some(other( |  | ||||||
|     assert_equal('otherthing', getline(1)) |  | ||||||
|     bwipe! |  | ||||||
|   END |  | ||||||
|   writefile(lines, 'Xvim9lines') |  | ||||||
|   source Xvim9lines |  | ||||||
|  |  | ||||||
|   delete('Xvim9lines') |  | ||||||
| enddef |  | ||||||
|  |  | ||||||
| def Test_execute_cmd() | def Test_execute_cmd() | ||||||
|   new |   new | ||||||
|   setline(1, 'default') |   setline(1, 'default') | ||||||
| @@ -920,4 +898,42 @@ def Test_for_outside_of_function() | |||||||
|   delete('Xvim9for.vim') |   delete('Xvim9for.vim') | ||||||
| enddef | enddef | ||||||
|  |  | ||||||
|  | def Test_while_loop() | ||||||
|  |   let result = '' | ||||||
|  |   let cnt = 0 | ||||||
|  |   while cnt < 555 | ||||||
|  |     if cnt == 3 | ||||||
|  |       break | ||||||
|  |     endif | ||||||
|  |     cnt += 1 | ||||||
|  |     if cnt == 2 | ||||||
|  |       continue | ||||||
|  |     endif | ||||||
|  |     result ..= cnt .. '_' | ||||||
|  |   endwhile | ||||||
|  |   assert_equal('1_3_', result) | ||||||
|  | enddef | ||||||
|  |  | ||||||
|  | def Test_substitute_cmd() | ||||||
|  |   new | ||||||
|  |   setline(1, 'something') | ||||||
|  |   :substitute(some(other( | ||||||
|  |   assert_equal('otherthing', getline(1)) | ||||||
|  |   bwipe! | ||||||
|  |  | ||||||
|  |   " also when the context is Vim9 script | ||||||
|  |   let lines =<< trim END | ||||||
|  |     vim9script | ||||||
|  |     new | ||||||
|  |     setline(1, 'something') | ||||||
|  |     :substitute(some(other( | ||||||
|  |     assert_equal('otherthing', getline(1)) | ||||||
|  |     bwipe! | ||||||
|  |   END | ||||||
|  |   writefile(lines, 'Xvim9lines') | ||||||
|  |   source Xvim9lines | ||||||
|  |  | ||||||
|  |   delete('Xvim9lines') | ||||||
|  | enddef | ||||||
|  |  | ||||||
| " vim: ts=8 sw=2 sts=2 expandtab tw=80 fdm=marker | " vim: ts=8 sw=2 sts=2 expandtab tw=80 fdm=marker | ||||||
|   | |||||||
| @@ -738,6 +738,8 @@ static char *(features[]) = | |||||||
|  |  | ||||||
| static int included_patches[] = | static int included_patches[] = | ||||||
| {   /* Add new patch number below this line */ | {   /* Add new patch number below this line */ | ||||||
|  | /**/ | ||||||
|  |     353, | ||||||
| /**/ | /**/ | ||||||
|     352, |     352, | ||||||
| /**/ | /**/ | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user