Merged from the latest developing branch.
[MacVim.git] / src / testdir / test3.ok
blob8c015a3389360a6113a119fb0452892c5bb17f51
1 /* start of AUTO matically checked vim: set ts=4 : */
3         if (test)
4                 cmd1;
5         cmd2;
9         if (test)
10                 cmd1;
11         else
12                 cmd2;
16         if (test)
17         {
18                 cmd1;
19                 cmd2;
20         }
24         if (test)
25         {
26                 cmd1;
27                 else
28         }
32         while (this)
33                 if (test)
34                         cmd1;
35         cmd2;
39         while (this)
40                 if (test)
41                         cmd1;
42                 else
43                         cmd2;
47         if (test)
48         {
49                 cmd;
50         }
52         if (test)
53                 cmd;
57         if (test) {
58                 cmd;
59         }
61         if (test) cmd;
65         cmd1;
66         for (blah)
67                 while (this)
68                         if (test)
69                                 cmd2;
70         cmd3;
74         cmd1;
75         for (blah)
76                 while (this)
77                         if (test)
78                                 cmd2;
79         cmd3;
81         if (test)
82         {
83                 cmd1;
84                 cmd2;
85                 cmd3;
86         }
90 /* Test for 'cindent' do/while mixed with if/else: */
93         do
94                 if (asdf)
95                         asdfasd;
96         while (cond);
98         do
99                 if (asdf)
100                         while (asdf)
101                                 asdf;
102         while (asdf);
105 /* Test for 'cindent' with two ) on a continuation line */
107         if (asdfasdf;asldkfj asdlkfj as;ldkfj sal;d
108                         aal;sdkjf  ( ;asldfkja;sldfk
109                                 al;sdjfka ;slkdf ) sa;ldkjfsa dlk;)
110                 line up here;
114 /* C++ tests: */
116 // foo()                these three lines should remain in column 0
117 // {
118 // }
120 /* Test for continuation and unterminated lines: */
122         i = 99 + 14325 +
123                 21345 +
124                 21345 +
125                 21345 + ( 21345 +
126                                 21345) +
127                 2345 +
128                 1234;
129         c = 1;
133    testje for indent with empty line
135    here */
138         if (testing &&
139                         not a joke ||
140                         line up here)
141                 hay;
142         if (testing &&
143                         (not a joke || testing
144                         )line up here)
145                 hay;
146         if (testing &&
147                         (not a joke || testing
148                          line up here))
149                 hay;
154         switch (c)
155         {
156                 case xx:
157                         do
158                                 if (asdf)
159                                         do
160                                                 asdfasdf;
161                                         while (asdf);
162                                 else
163                                         asdfasdf;
164                         while (cond);
165                 case yy:
166                 case xx:
167                 case zz:
168                         testing;
169         }
173         if (cond) {
174                 foo;
175         }
176         else
177         {
178                 bar;
179         }
183         if (alskdfj ;alsdkfjal;skdjf (;sadlkfsa ;dlkf j;alksdfj ;alskdjf
184                                 alsdkfj (asldk;fj
185                                         awith cino=(0 ;lf this one goes to below the paren with ==
186                                                 ;laksjfd ;lsakdjf ;alskdf asd)
187                                         asdfasdf;)))
188                 asdfasdf;
191         int
192 func(a, b)
193         int a;
194         int c;
196         if (c1 && (c2 ||
197                                 c3))
198                 foo;
199         if (c1 &&
200                         (c2 || c3)
201            )
205         while (asd)
206         {
207                 if (asdf)
208                         if (test)
209                                 if (that)
210                                 {
211                                         if (asdf)
212                                                 do
213                                                         cdasd;
214                                                 while (as
215                                                                 df);
216                                 }
217                                 else
218                                         if (asdf)
219                                                 asdf;
220                                         else
221                                                 asdf;
222                 asdf;
223         }
227         s = "/*"; b = ';'
228                 s = "/*"; b = ';';
229         a = b;
233         switch (a)
234         {
235                 case a:
236                         switch (t)
237                         {
238                                 case 1:
239                                         cmd;
240                                         break;
241                                 case 2:
242                                         cmd;
243                                         break;
244                         }
245                         cmd;
246                         break;
247                 case b:
248                         {
249                                 int i;
250                                 cmd;
251                         }
252                         break;
253                 case c: {
254                                         int i;
255                                         cmd;
256                                 }
257                 case d: if (cond &&
258                                                 test) {         /* this line doesn't work right */
259                                         int i;
260                                         cmd;
261                                 }
262                                 break;
263         }
267         if (!(vim_strchr(p_cpo, CPO_BUFOPTGLOB) != NULL && entering) &&
268                         (bp_to->b_p_initialized ||
269                          (!entering && vim_strchr(p_cpo, CPO_BUFOPT) != NULL)))
270                 return;
271 label :
272         asdf = asdf ?
273                 asdf : asdf;
274         asdf = asdf ?
275                 asdf: asdf;
278 /* Special Comments     : This function has the added complexity (compared  */
279 /*                                      : to addtolist) of having to check for a detail     */
280 /*                                      : texture and add that to the list first.                   */
282 char *(array[100]) = {
283         "testje",
284         "foo",
285         "bar",
288 enum soppie
290         yes = 0,
291         no,
292         maybe
295 typedef enum soppie
297         yes = 0,
298         no,
299         maybe
303         int a,
304                 b;
308         struct Type
309         {
310                 int i;
311                 char *str;
312         } var[] =
313         {
314                 0, "zero",
315                 1, "one",
316                 2, "two",
317                 3, "three"
318         };
320         float matrix[3][3] =
321         {
322                 {
323                         0,
324                         1,
325                         2
326                 },
327                 {
328                         3,
329                         4,
330                         5
331                 },
332                 {
333                         6,
334                         7,
335                         8
336                 }
337         };
341         /* blah ( blah */
342         /* where does this go? */
344         /* blah ( blah */
345         cmd;
347         func(arg1,
348                         /* comment */
349                         arg2);
350         a;
351         {
352                 b;
353                 {
354                         c; /* Hey, NOW it indents?! */
355                 }
356         }
358         {
359                 func(arg1,
360                                 arg2,
361                                 arg3);
362                 /* Hey, what am I doing here?  Is this coz of the ","? */
363         }
366 main ()
368         if (cond)
369         {
370                 a = b;
371         }
372         if (cond) {
373                 a = c;
374         }
375         if (cond)
376                 a = d;
377         return;
381         case 2: if (asdf &&
382                                         asdfasdf)
383                                 aasdf;
384                         a = 9;
385         case 3: if (asdf)
386                                 aasdf;
387                         a = 9;
388         case 4:    x = 1;
389                            y = 2;
391 label:  if (asdf)
392                         here;
394 label:  if (asdf &&
395                                 asdfasdf)
396                 {
397                 }
399 label:  if (asdf &&
400                                 asdfasdf) {
401                         there;
402                 }
404 label:  if (asdf &&
405                                 asdfasdf)
406                         there;
410         /*
411            hello with ":set comments= cino=c5"
412          */
414         /*
415            hello with ":set comments= cino="
416          */
421         if (a < b) {
422                 a = a + 1;
423         } else
424                 a = a + 2;
426         if (a)
427                 do {
428                         testing;
429                 } while (asdfasdf);
430         a = b + 1;
431         asdfasdf
434 class bob
436         int foo() {return 1;}
437         int bar;
440 main()
442         while(1)
443                 if (foo)
444                 {
445                         bar;
446                 }
447                 else {
448                         asdf;
449                 }
450         misplacedline;
454         if (clipboard.state == SELECT_DONE
455                         && ((row == clipboard.start.lnum
456                                         && col >= clipboard.start.col)
457                                 || row > clipboard.start.lnum))
461         if (1) {i += 4;}
462         where_am_i;
463         return 0;
467         {
468         } // sdf(asdf
469         if (asdf)
470                 asd;
474 label1:
475 label2:
479         int fooRet = foo(pBar1, false /*fKB*/,
480                         true /*fPTB*/, 3 /*nT*/, false /*fDF*/);
481         f() {
482                 for ( i = 0;
483                                 i < m;
484                                 /* c */ i++ ) {
485                         a = b;
486                 }
487         }
491         f1(/*comment*/);
492         f2();
496         do {
497                 if (foo) {
498                 } else
499                         ;
500         } while (foo);
501         foo();  // was wrong
504 int x;      // no extra indent because of the ;
505 void func()
509 char *tab[] = {"aaa",
510         "};", /* }; */ NULL}
511         int indented;
514 char *a[] = {"aaa", "bbb",
515         "ccc", NULL};
516 // here
518 char *tab[] = {"aaa",
519         "xx", /* xx */};    /* asdf */
520 int not_indented;
523         do {
524                 switch (bla)
525                 {
526                         case 1: if (foo)
527                                                 bar;
528                 }
529         } while (boo);
530         wrong;
533 int     foo,
534         bar;
535 int foo;
537 #if defined(foo) \
538         && defined(bar)
539 char * xx = "asdf\
540                          foo\
541                          bor";
542 int x;
544 char    *foo = "asdf\
545                                 asdf\
546                                 asdf",
547                 *bar;
549 void f()
551 #if defined(foo) \
552         && defined(bar)
553         char    *foo = "asdf\
554                                         asdf\
555                                         asdf",
556                         *bar;
557         {
558                 int i;
559                 char    *foo = "asdf\
560                                                 asdf\
561                                                 asdf",
562                                 *bar;
563         }
564 #endif
566 #endif
568 int y;          // comment
569 // comment
571 // comment
574         Constructor(int a,
575                         int b )  : BaseClass(a)
576         {
577         }
580 void foo()
582         char one,
583                  two;
584         struct bla piet,
585                            jan;
586         enum foo kees,
587                          jannie;
588         static unsigned sdf,
589                                         krap;
590         unsigned int piet,
591                                  jan;
592         int
593                 kees,
594                 jan;
598         t(int f,
599                         int d);         // )
600         d();
603 Constructor::Constructor(int a,
604                 int b 
605                 )  : 
606         BaseClass(a,
607                         b,
608                         c),
609         mMember(b),
613 Constructor::Constructor(int a,
614                 int b )  : 
615         BaseClass(a)
619 Constructor::Constructor(int a,
620                 int b ) /*x*/ : /*x*/ BaseClass(a),
621         member(b)
625 class CAbc :
626         public BaseClass1,
627         protected BaseClass2
629         int Test() { return FALSE; }
630         int Test1() { return TRUE; }
632         CAbc(int a, int b )  : 
633                 BaseClass(a)
634         { 
635                 switch(xxx)
636                 {
637                         case abc:
638                                 asdf();
639                                 break;
641                         case 999:
642                                 baer();
643                                 break;
644                 }
645         }
647         public: // <-- this was incoreectly indented before!!
648         void testfall();
649         protected:
650         void testfall();
653 class CAbc : public BaseClass1,
654         protected BaseClass2
658 static struct
660         int a;
661         int b;
662 } variable[COUNT] =
664         {
665                 123,
666                 456
667         },
668         {
669                 123,
670                 456
671         }
674 static struct
676         int a;
677         int b;
678 } variable[COUNT] =
680         { 123, 456 },
681         { 123, 456 }
684 void asdf()             /* ind_maxparen may cause trouble here */
686         if ((0
687                                 && 1
688                                 && 1
689                                 && 1
690                                 && 1
691                                 && 1
692                                 && 1
693                                 && 1
694                                 && 1
695                                 && 1
696                                 && 1
697                                 && 1
698                                 && 1
699                                 && 1
700                                 && 1
701                                 && 1
702                                 && 1
703                                 && 1
704                                 && 1
705                                 && 1
706                                 && 1
707                                 && 1
708                                 && 1
709                                 && 1
710                                 && 1
711                                 && 1)) break;
714 foo()
716         a = cond ? foo() : asdf
717                 + asdf;
719         a = cond ?
720                 foo() : asdf
721                 + asdf;
724 int  main(void)
726         if (a)
727                 if (b)
728                         2;
729                 else 3;
730         next_line_of_code();
733 barry()
735         Foo::Foo (int one,
736                         int two)
737                 : something(4)
738         {}
741 barry()
743         Foo::Foo (int one, int two)
744                 : something(4)
745         {}
748 Constructor::Constructor(int a,
749                 int b 
750                 )  : 
751         BaseClass(a,
752                         b,
753                         c),
754         mMember(b)
757 int main ()
759         if (lala)
760                 do
761                         ++(*lolo);
762                 while (lili
763                                 && lele);
764         lulu;
767 int main ()
769         switch (c)
770         {
771                 case 'c': if (cond)
772                                   {
773                                   }
774         }
777 main()
779         (void) MyFancyFuasdfadsfnction(
780                         argument);
783 main()
785         char    foo[] = "/*";
786         /* as
787            df */
788         hello
790 /* end of AUTO */
795 /* this is
796  * a real serious
797  * about life, the
798  * universe, and the
799  * rest important big
800  * comment
801  */
802         /* insert " about life, the universe, and the rest" after "serious" */
807         /*
808          * Testing for comments, without 'cin' set
809          */
810 about life
813 * what happens here?
815 there
817         /*
818            the end of the comment, try inserting a line below */
819 line
821                 /* how about
822 hello
823                                 this one */
828     var = this + that + vec[0] * vec[0]
829                                       + vec[1] * vec[1]
830                                           + vec2[2] * vec[2];
835                 asdf asdflkajds f;
836         if (tes & ting) {
837                 asdf asdf asdf ;
838                 asdfa sdf asdf;
839                 }
840         testing1;
841         if (tes & ting)
842         {
843                 asdf asdf asdf ;
844                 asdfa sdf asdf;
845                 }
846         testing2;
850 main ( int first_par, /*
851                                            * Comment for
852                                            * first par
853                                            */
854            int second_par /*
855                                            * Comment for
856                                            * second par
857                                            */
858          )
860         func( first_par, /*
861                                           * Comment for
862                                           * first par
863                                           */
864                   second_par /*
865                                           * Comment for
866                                           * second par
867                                           */
868                 );
874         do
875         {
876                 if ()
877                 {
878                         if ()
879                                 asdf;
880                         else
881                                 asdf;
882                 }
883         } while ();
884         cmd;            /* this should go under the } */
888 void f()
890         if ( k() ) {
891                 l();
893         } else { /* Start (two words) end */
894                 m();
895         }
897         n();
901 void f()
902         {
903         if ( k() )
904                 {
905                 l();
906                 } else { /* Start (two words) end */
907                 m();
908                 }
909         n();    /* should be under the if () */
913 void bar(void)
914         {
915         static array[2][2] =
916                 {
917                         { 1, 2 },
918                         { 3, 4 },
919                 }
921         while (a)
922                 {
923                 foo(&a);
924                 }
926                 {
927                 int a;
928                         {
929                         a = a + 1;
930                         }
931                 }
932         b = a;
933         }
935 void func(void)
936         {
937         a = 1;
938                 {
939                 b = 2;
940                 }
941         c = 3;
942         d = 4;
943         }
944 /* foo */
949   do {
950     a = a +
951       a;
952   } while ( a );                /* add text under this line */
953   here
954     if ( a )
955       a;
961 label1:
962             /* hmm */
963             // comment
964 label2: b();
965 label3 /* post */:
966 /* pre */ label4:
967                 f(/*com*/);
968                 if (/*com*/)
969                         cmd();
974  * A simple comment
975  */
978 ** A different comment
982 void f()
985         /*********
986           A comment.
987         *********/
991 void f()
994         /*********
995         A comment.
996         *********/
1000 void f()
1002         c = c1 &&
1003                 (
1004                  c2 ||
1005                  c3
1006                 ) && c4;
1010 void f()
1012         c = c1 &&
1013                 (
1014                  c2 ||
1015                  c3
1016                 ) && c4;
1020 void f()
1022         c = c1 &&
1023                 (
1024                         c2 ||
1025                         c3
1026                 ) && c4;
1030 void f()
1032         if (   c1
1033                    && (   c2
1034                                   || c3))
1035                 foo;
1039 void f()
1041         if (   c1
1042                 && (   c2
1043                         || c3))
1044                 foo;
1048 void f()
1050         c = c1 && (
1051                 c2 ||
1052                 c3
1053                 ) && c4;
1054         if (
1055                 c1 && c2
1056            )
1057                 foo;
1061 void f()
1063         c = c1 && (
1064                 c2 ||
1065                 c3
1066         ) && c4;
1067         if (
1068                 c1 && c2
1069         )
1070                 foo;
1074 void f()
1076         switch (x)
1077         {
1078                 case 1:
1079                         a = b;
1080                 break;
1081                 default:
1082                         a = 0;
1083                 break;
1084         }
1088 void f()
1090         invokeme(
1091                  argu,
1092                  ment);
1093         invokeme(
1094                  argu,
1095                  ment
1096                  );
1097         invokeme(argu,
1098                          ment
1099                         );
1103 void f()
1105         statement;
1106                   // comment 1
1107                   // comment 2
1111 void f()
1113         statement;
1114            // comment 1
1115            // comment 2
1119 class CAbc
1121         int Test() { return FALSE; }
1123 public: // comment
1124         void testfall();
1125 protected:
1126         void testfall();
1130         void
1131 foo()
1133         if (a)
1134         {
1135         } else
1136                 asdf;
1141         averylongfunctionnamelongfunctionnameaverylongfunctionname()->asd(
1142                         asdasdf,
1143                         func(asdf,
1144                                  asdfadsf),
1145                         asdfasdf
1146                         );
1148         /* those are ugly, but consequent */
1150         func()->asd(asdasdf,
1151                                 averylongfunctionname(
1152                                                 abc,
1153                                                 dec)->averylongfunctionname(
1154                                                                 asdfadsf,
1155                                                                 asdfasdf,
1156                                                                 asdfasdf,
1157                                                                 ),
1158                                 func(asdfadf,
1159                                          asdfasdf
1160                                         ),
1161                                 asdasdf
1162                            );
1164         averylongfunctionnameaverylongfunctionnameavery()->asd(fasdf(
1165                                         abc,
1166                                         dec)->asdfasdfasdf(
1167                                                         asdfadsf,
1168                                                         asdfasdf,
1169                                                         asdfasdf,
1170                                                         ),
1171                         func(asdfadf,
1172                                  asdfasdf),
1173                         asdasdf
1174                         );
1178 int main ()
1180         if (cond1 &&
1181                         cond2
1182                         )
1183                 foo;