~ubuntu-branches/ubuntu/trusty/monodevelop/trusty-proposed

« back to all changes in this revision

Viewing changes to external/nrefactory/ICSharpCode.NRefactory.Tests/CSharp/CodeIssues/AccessToModifiedClosureTests.cs

  • Committer: Package Import Robot
  • Author(s): Jo Shields
  • Date: 2013-05-12 09:46:03 UTC
  • mto: This revision was merged to the branch mainline in revision 29.
  • Revision ID: package-import@ubuntu.com-20130512094603-mad323bzcxvmcam0
Tags: upstream-4.0.5+dfsg
ImportĀ upstreamĀ versionĀ 4.0.5+dfsg

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
ļ»æ// 
 
2
// AccessToModifiedClosureTests.cs
 
3
//  
 
4
// Author:
 
5
//       Mansheng Yang <lightyang0@gmail.com>
 
6
// 
 
7
// Copyright (c) 2012 Mansheng Yang <lightyang0@gmail.com>
 
8
// 
 
9
// Permission is hereby granted, free of charge, to any person obtaining a copy
 
10
// of this software and associated documentation files (the "Software"), to deal
 
11
// in the Software without restriction, including without limitation the rights
 
12
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 
13
// copies of the Software, and to permit persons to whom the Software is
 
14
// furnished to do so, subject to the following conditions:
 
15
// 
 
16
// The above copyright notice and this permission notice shall be included in
 
17
// all copies or substantial portions of the Software.
 
18
// 
 
19
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 
20
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 
21
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 
22
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 
23
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 
24
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 
25
// THE SOFTWARE.
 
26
 
 
27
using ICSharpCode.NRefactory.CSharp.CodeActions;
 
28
using ICSharpCode.NRefactory.CSharp.Refactoring;
 
29
using NUnit.Framework;
 
30
 
 
31
namespace ICSharpCode.NRefactory.CSharp.CodeIssues
 
32
{
 
33
        [TestFixture]
 
34
        public class AccessToModifiedClosureTests : InspectionActionTestBase
 
35
        {
 
36
                static void Test(string input, int issueCount, string output = null, int fixIndex = -1)
 
37
                {
 
38
                        TestRefactoringContext context;
 
39
                        var issues = GetIssues (new AccessToModifiedClosureIssue (), input, out context);
 
40
                        Assert.AreEqual (issueCount, issues.Count);
 
41
                        if (issueCount > 0) {
 
42
                                if (output != null) {
 
43
                                        if (fixIndex == -1)
 
44
                                                CheckFix (context, issues, output);
 
45
                                        else
 
46
                                                CheckFix (context, issues [fixIndex], output);
 
47
                                } else {
 
48
                                        foreach (var issue in issues)
 
49
                                                Assert.AreEqual (0, issue.Actions.Count);
 
50
                                }
 
51
                        }
 
52
                }
 
53
 
 
54
                [Test]
 
55
                public void TestForeachVariable ()
 
56
                {
 
57
                        var input = @"
 
58
class TestClass
 
59
{
 
60
        void TestMethod (int[] a)
 
61
        {
 
62
                System.Func<int, int> f;
 
63
                foreach (var i in a)
 
64
                        f = new System.Func<int, int> (x => x + i);
 
65
        }
 
66
}";
 
67
                        var output = @"
 
68
class TestClass
 
69
{
 
70
        void TestMethod (int[] a)
 
71
        {
 
72
                System.Func<int, int> f;
 
73
                foreach (var i in a) {
 
74
                        var i1 = i;
 
75
                        f = new System.Func<int, int> (x => x + i1);
 
76
                }
 
77
        }
 
78
}";
 
79
                        Test (input, 1, output);
 
80
                }
 
81
 
 
82
                [Test]
 
83
                public void TestFor ()
 
84
                {
 
85
                        var input = @"
 
86
class TestClass
 
87
{
 
88
        void TestMethod ()
 
89
        {
 
90
                for (int i = 0; i < 10; i++) {
 
91
                        var f = new System.Func<int, int> (x => x + i);
 
92
                }
 
93
        }
 
94
}";
 
95
                        var output = @"
 
96
class TestClass
 
97
{
 
98
        void TestMethod ()
 
99
        {
 
100
                for (int i = 0; i < 10; i++) {
 
101
                        var i1 = i;
 
102
                        var f = new System.Func<int, int> (x => x + i1);
 
103
                }
 
104
        }
 
105
}";
 
106
                        Test (input, 1, output);
 
107
                }
 
108
        
 
109
                [Test]
 
110
                public void TestForInitializer ()
 
111
                {
 
112
                        var input = @"
 
113
class TestClass
 
114
{
 
115
        void TestMethod (int j)
 
116
        {
 
117
                int i;
 
118
                for (i = 0; j < 10; j++) {
 
119
                        var f = new System.Func<int, int> (x => x + i);
 
120
                }
 
121
        }
 
122
}";
 
123
                        Test (input, 0);
 
124
                }
 
125
 
 
126
                [Test]
 
127
                public void TestForBody ()
 
128
                {
 
129
                        var input = @"
 
130
class TestClass
 
131
{
 
132
        void TestMethod ()
 
133
        {
 
134
                for (int i = 0; i < 10;) {
 
135
                        var f = new System.Func<int, int> (delegate (int x) { return x + i; });
 
136
                        i++;
 
137
                }
 
138
        }
 
139
}";
 
140
                        var output = @"
 
141
class TestClass
 
142
{
 
143
        void TestMethod ()
 
144
        {
 
145
                for (int i = 0; i < 10;) {
 
146
                        var i1 = i;
 
147
                        var f = new System.Func<int, int> (delegate (int x) { return x + i1; });
 
148
                        i++;
 
149
                }
 
150
        }
 
151
}";
 
152
                        Test (input, 1, output);
 
153
                }
 
154
                
 
155
                [Test]
 
156
                public void TestWhileBody ()
 
157
                {
 
158
                        var input = @"
 
159
class TestClass
 
160
{
 
161
        void TestMethod ()
 
162
        {
 
163
                int i = 0;
 
164
                while (i < 10) {
 
165
                        i++;
 
166
                        var f = new System.Func<int, int> (x => x + i);
 
167
                }
 
168
        }
 
169
}";
 
170
                        var output = @"
 
171
class TestClass
 
172
{
 
173
        void TestMethod ()
 
174
        {
 
175
                int i = 0;
 
176
                while (i < 10) {
 
177
                        i++;
 
178
                        var i1 = i;
 
179
                        var f = new System.Func<int, int> (x => x + i1);
 
180
                }
 
181
        }
 
182
}";
 
183
                        Test (input, 1, output);
 
184
                }
 
185
                
 
186
                [Test]
 
187
                public void TestWhileCondition ()
 
188
                {
 
189
                        var input = @"
 
190
class TestClass
 
191
{
 
192
        void TestMethod ()
 
193
        {
 
194
                int i = 0;
 
195
                while (i++ < 10) {
 
196
                        var f = new System.Func<int, int> (delegate (int x) { return x + i; });
 
197
                }
 
198
        }
 
199
}";
 
200
                        var output = @"
 
201
class TestClass
 
202
{
 
203
        void TestMethod ()
 
204
        {
 
205
                int i = 0;
 
206
                while (i++ < 10) {
 
207
                        var i1 = i;
 
208
                        var f = new System.Func<int, int> (delegate (int x) { return x + i1; });
 
209
                }
 
210
        }
 
211
}";
 
212
                        Test (input, 1, output);
 
213
                }
 
214
 
 
215
                [Test]
 
216
                public void TestDoWhileBody ()
 
217
                {
 
218
                        var input = @"
 
219
class TestClass
 
220
{
 
221
        void TestMethod ()
 
222
        {
 
223
                int i = 0;
 
224
                do {
 
225
                        i += 1;
 
226
                        var f = new System.Func<int, int> (x => x + i);
 
227
                } while (i < 10);
 
228
        }
 
229
}";
 
230
                        var output = @"
 
231
class TestClass
 
232
{
 
233
        void TestMethod ()
 
234
        {
 
235
                int i = 0;
 
236
                do {
 
237
                        i += 1;
 
238
                        var i1 = i;
 
239
                        var f = new System.Func<int, int> (x => x + i1);
 
240
                } while (i < 10);
 
241
        }
 
242
}";
 
243
                        Test (input, 1, output);
 
244
                }
 
245
 
 
246
                [Test]
 
247
                public void TestDoWhileCondition ()
 
248
                {
 
249
                        var input = @"
 
250
class TestClass
 
251
{
 
252
        void TestMethod ()
 
253
        {
 
254
                int i = 0;
 
255
                while (i++ < 10) {
 
256
                        var f = new System.Func<int, int> (x => x + i);
 
257
                }
 
258
        }
 
259
}";
 
260
                        var output = @"
 
261
class TestClass
 
262
{
 
263
        void TestMethod ()
 
264
        {
 
265
                int i = 0;
 
266
                while (i++ < 10) {
 
267
                        var i1 = i;
 
268
                        var f = new System.Func<int, int> (x => x + i1);
 
269
                }
 
270
        }
 
271
}";
 
272
                        Test (input, 1, output);
 
273
                }
 
274
 
 
275
                [Test]
 
276
                public void TestMultipleLambdas ()
 
277
                {
 
278
                        var input = @"
 
279
class TestClass
 
280
{
 
281
        void TestMethod (int[] a)
 
282
        {
 
283
                foreach (var i in a) {
 
284
                        var f = new System.Func<int, int> (x => x + i);
 
285
                        var f2 = new System.Func<int, bool> (x => x + i > 10);
 
286
                }
 
287
        }
 
288
}";
 
289
                        var output = @"
 
290
class TestClass
 
291
{
 
292
        void TestMethod (int[] a)
 
293
        {
 
294
                foreach (var i in a) {
 
295
                        var i1 = i;
 
296
                        var f = new System.Func<int, int> (x => x + i1);
 
297
                        var i1 = i;
 
298
                        var f2 = new System.Func<int, bool> (x => x + i1 > 10);
 
299
                }
 
300
        }
 
301
}";
 
302
                        Test (input, 2, output);
 
303
                }
 
304
 
 
305
                [Test]
 
306
                public void TestFixAllInLambda ()
 
307
                {
 
308
                        var input = @"
 
309
class TestClass
 
310
{
 
311
        void TestMethod (int[] array)
 
312
        {
 
313
                foreach (var i in array) {
 
314
                        var f = new System.Func<int, int> (x => {
 
315
                                int a = i + 1;
 
316
                                int b = i + 2;
 
317
                                return a + b + i;
 
318
                        });
 
319
                }
 
320
        }
 
321
}";
 
322
                        var output = @"
 
323
class TestClass
 
324
{
 
325
        void TestMethod (int[] array)
 
326
        {
 
327
                foreach (var i in array) {
 
328
                        var i1 = i;
 
329
                        var f = new System.Func<int, int> (x => {
 
330
                                int a = i1 + 1;
 
331
                                int b = i1 + 2;
 
332
                                return a + b + i1;
 
333
                        });
 
334
                }
 
335
        }
 
336
}";
 
337
                        Test (input, 3, output, 0);
 
338
                }
 
339
                
 
340
                [Test]
 
341
                public void TestModifiedInLambda ()
 
342
                {
 
343
                        var input = @"
 
344
class TestClass
 
345
{
 
346
        void TestMethod (int[] array)
 
347
        {
 
348
                foreach (var i in array) {
 
349
                        var f = new System.Func<int, int> (x => {
 
350
                                i = 0;
 
351
                                int a = i + 1;
 
352
                                int b = i + 2;
 
353
                                return a + b + i;
 
354
                        });
 
355
                }
 
356
        }
 
357
}";
 
358
                        Test (input, 0);
 
359
                        input = @"
 
360
class TestClass
 
361
{
 
362
        void TestMethod (int[] array)
 
363
        {
 
364
                foreach (var i in array) {
 
365
                        var f = new System.Func<int, int> (x => {
 
366
                                i++;
 
367
                                int a = i + 1;
 
368
                                i = 3;
 
369
                                int b = i + 2;
 
370
                                return a + b + i;
 
371
                        });
 
372
                }
 
373
        }
 
374
}";
 
375
                        var output = @"
 
376
class TestClass
 
377
{
 
378
        void TestMethod (int[] array)
 
379
        {
 
380
                foreach (var i in array) {
 
381
                        var i1 = i;
 
382
                        var f = new System.Func<int, int> (x => {
 
383
                                i1++;
 
384
                                int a = i1 + 1;
 
385
                                i1 = 3;
 
386
                                int b = i1 + 2;
 
387
                                return a + b + i1;
 
388
                        });
 
389
                }
 
390
        }
 
391
}";
 
392
                        Test (input, 1, output);
 
393
                }
 
394
                
 
395
                [Test]
 
396
                public void TestNestedLambda ()
 
397
                {
 
398
                        var input = @"
 
399
class TestClass
 
400
{
 
401
        void TestMethod (int[] a)
 
402
        {
 
403
                foreach (var i in a) {
 
404
                        var f = new System.Func<int, int> (x => {
 
405
                                var f2 =  new System.Func<int, int> (y => y - i);
 
406
                                return f2 (x) + i;
 
407
                        });
 
408
                }
 
409
        }
 
410
}";
 
411
                        var output1 = @"
 
412
class TestClass
 
413
{
 
414
        void TestMethod (int[] a)
 
415
        {
 
416
                foreach (var i in a) {
 
417
                        var i1 = i;
 
418
                        var f = new System.Func<int, int> (x => {
 
419
                                var f2 =  new System.Func<int, int> (y => y - i1);
 
420
                                return f2 (x) + i1;
 
421
                        });
 
422
                }
 
423
        }
 
424
}";
 
425
                        Test (input, 2, output1, 1);
 
426
                        var output2 = @"
 
427
class TestClass
 
428
{
 
429
        void TestMethod (int[] a)
 
430
        {
 
431
                foreach (var i in a) {
 
432
                        var f = new System.Func<int, int> (x => {
 
433
                                var i1 = i;
 
434
                                var f2 =  new System.Func<int, int> (y => y - i1);
 
435
                                return f2 (x) + i;
 
436
                        });
 
437
                }
 
438
        }
 
439
}";
 
440
                        Test (input, 2, output2, 0);
 
441
                }
 
442
        
 
443
                [Test]
 
444
                public void TestMultipleVariables ()
 
445
                {
 
446
                        var input = @"
 
447
class TestClass
 
448
{
 
449
        void TestMethod (int[] a)
 
450
        {
 
451
                foreach (var i in a) {
 
452
                        foreach (var j in a) {
 
453
                                var f = new System.Func<int, int> (x => x + i + j);
 
454
                        }
 
455
                }
 
456
        }
 
457
}";
 
458
                        var output = @"
 
459
class TestClass
 
460
{
 
461
        void TestMethod (int[] a)
 
462
        {
 
463
                foreach (var i in a) {
 
464
                        foreach (var j in a) {
 
465
                                var i1 = i;
 
466
                                var j1 = j;
 
467
                                var f = new System.Func<int, int> (x => x + i1 + j1);
 
468
                        }
 
469
                }
 
470
        }
 
471
}";
 
472
                        Test (input, 2, output);
 
473
                }
 
474
 
 
475
                [Test]
 
476
                public void TestModificationAfterLambdaDecl ()
 
477
                {
 
478
                        var input = @"
 
479
class TestClass
 
480
{
 
481
        void TestMethod ()
 
482
        {
 
483
                int i = 0;
 
484
                System.Func<int, int> f = x => i + x;
 
485
                i += 1;
 
486
        }
 
487
}";
 
488
                        var output = @"
 
489
class TestClass
 
490
{
 
491
        void TestMethod ()
 
492
        {
 
493
                int i = 0;
 
494
                var i1 = i;
 
495
                System.Func<int, int> f = x => i1 + x;
 
496
                i += 1;
 
497
        }
 
498
}";
 
499
                        Test (input, 1, output);
 
500
                }
 
501
 
 
502
                [Test]
 
503
                public void TestModificationBeforeLambdaDecl ()
 
504
                {
 
505
                        var input = @"
 
506
class TestClass
 
507
{
 
508
        void TestMethod ()
 
509
        {
 
510
                int i = 0;
 
511
                i += 1;
 
512
                System.Func<int, int> f = x => i + x;
 
513
        }
 
514
}";
 
515
                        Test (input, 0);
 
516
                }
 
517
 
 
518
                [Test]
 
519
                public void TestUnreachable ()
 
520
                {
 
521
                        var returnCase = @"
 
522
class TestClass
 
523
{
 
524
        void TestMethod ()
 
525
        {
 
526
                int i = 0;
 
527
                System.Func<int, int> f = x => i + x;
 
528
                return;
 
529
                i += 1;
 
530
        }
 
531
}";
 
532
                        var ifCase = @"
 
533
class TestClass
 
534
{
 
535
        void TestMethod ()
 
536
        {
 
537
                int i = 0;
 
538
                System.Func<int, int> f;
 
539
                if (i > 0)
 
540
                        f = x => i + x;
 
541
                else
 
542
                        i += 1;
 
543
        }
 
544
}";
 
545
                        Test (returnCase, 0);
 
546
                        Test (ifCase, 0);
 
547
                }
 
548
 
 
549
                [Test]
 
550
                public void TestParameter ()
 
551
                {
 
552
                        var input = @"
 
553
class TestClass
 
554
{
 
555
        void TestMethod (int i)
 
556
        {
 
557
                System.Func<int, int> f = x => i + x;
 
558
                i += 1;
 
559
        }
 
560
}";
 
561
                        var output = @"
 
562
class TestClass
 
563
{
 
564
        void TestMethod (int i)
 
565
        {
 
566
                var i1 = i;
 
567
                System.Func<int, int> f = x => i1 + x;
 
568
                i += 1;
 
569
        }
 
570
}";
 
571
                        Test (input, 1, output);
 
572
                }
 
573
 
 
574
                [Test]
 
575
                public void TestModificationInSameStatement ()
 
576
                {
 
577
                        var input1 = @"
 
578
class TestClass
 
579
{
 
580
        void TestMethod2 (int b, System.Func<int, int> a)
 
581
        {
 
582
                TestMethod2 (b++, c => c + b);
 
583
        }
 
584
}";
 
585
                        var input2 = @"
 
586
class TestClass
 
587
{
 
588
        void TestMethod3 (System.Func<int, int> a, int b)
 
589
        {
 
590
                TestMethod3 (c => c + b, b++);
 
591
        }
 
592
}";
 
593
                        var output2 = @"
 
594
class TestClass
 
595
{
 
596
        void TestMethod3 (System.Func<int, int> a, int b)
 
597
        {
 
598
                var b1 = b;
 
599
                TestMethod3 (c => c + b1, b++);
 
600
        }
 
601
}";
 
602
                        Test (input1, 0);
 
603
                        Test (input2, 1, output2);
 
604
                }
 
605
                
 
606
                [Test]
 
607
                public void TestInsertion ()
 
608
                {
 
609
                        var input1 = @"
 
610
class TestClass
 
611
{
 
612
        void TestMethod ()
 
613
        {
 
614
                int i = 0;
 
615
                System.Func<int, int> f = null;
 
616
                if ((f = x => x + i) != null)
 
617
                        i++;
 
618
        }
 
619
}";
 
620
                        var output1 = @"
 
621
class TestClass
 
622
{
 
623
        void TestMethod ()
 
624
        {
 
625
                int i = 0;
 
626
                System.Func<int, int> f = null;
 
627
                var i1 = i;
 
628
                if ((f = x => x + i1) != null)
 
629
                        i++;
 
630
        }
 
631
}";
 
632
                        Test (input1, 1, output1);
 
633
 
 
634
                        var input2 = @"
 
635
class TestClass
 
636
{
 
637
        void TestMethod (int k)
 
638
        {
 
639
                int i = 0;
 
640
                System.Func<int, int> f = null;
 
641
                switch (k) {
 
642
                default:
 
643
                        f = x => x + i;
 
644
                        break;
 
645
                }
 
646
                i++;
 
647
        }
 
648
}";
 
649
                        var output2 = @"
 
650
class TestClass
 
651
{
 
652
        void TestMethod (int k)
 
653
        {
 
654
                int i = 0;
 
655
                System.Func<int, int> f = null;
 
656
                switch (k) {
 
657
                default:
 
658
                        var i1 = i;
 
659
                        f = x => x + i1;
 
660
                        break;
 
661
                }
 
662
                i++;
 
663
        }
 
664
}";
 
665
                        Test (input2, 1, output2);
 
666
                }
 
667
 
 
668
                [Test]
 
669
                public void TestLambdaInLoopCondition ()
 
670
                {
 
671
                        var forCase = @"
 
672
class TestClass
 
673
{
 
674
        void TestMethod ()
 
675
        {
 
676
                System.Func<int, int> f = null;
 
677
                for (int i = 0; i < 10 && ((f = x => x + i) != null); i++) {
 
678
                }
 
679
        }
 
680
}";
 
681
                        var whileCase = @"
 
682
class TestClass
 
683
{
 
684
        void TestMethod ()
 
685
        {
 
686
                System.Func<int, int> f = null;
 
687
                int i = 0;
 
688
                while (i < 10 && (f = x => x + i) != null) i++;
 
689
        }
 
690
}";
 
691
                        var doWhileCase = @"
 
692
class TestClass
 
693
{
 
694
        void TestMethod ()
 
695
        {
 
696
                System.Func<int, int> f = null;
 
697
                int i = 0;
 
698
                do { i++; } while (i < 10 && (f = x => x + i) != null);
 
699
        }
 
700
}";
 
701
                        Test (forCase, 1);
 
702
                        Test (whileCase, 1);
 
703
                        Test (doWhileCase, 1);
 
704
                }
 
705
 
 
706
                [Test]
 
707
                public void TestLambdaInForIterator ()
 
708
                {
 
709
 
 
710
                        var input = @"
 
711
class TestClass
 
712
{
 
713
        void TestMethod ()
 
714
        {
 
715
                System.Func<int, int> f = null;
 
716
                for (int i = 0; i < 10; i++, f = x => x + i) {
 
717
                }
 
718
        }
 
719
}";
 
720
                        Test (input, 1);
 
721
                }
 
722
 
 
723
                [Test]
 
724
                public void TestExistingVariableName ()
 
725
                {
 
726
                        var input = @"
 
727
class TestClass
 
728
{
 
729
        void TestMethod (int[] a)
 
730
        {
 
731
                foreach (var i in a) {
 
732
                        int i1;
 
733
                        var f = new System.Func<int, int> (x => x + i);
 
734
                }
 
735
        }
 
736
}";
 
737
                        var output = @"
 
738
class TestClass
 
739
{
 
740
        void TestMethod (int[] a)
 
741
        {
 
742
                foreach (var i in a) {
 
743
                        int i1;
 
744
                        var i2 = i;
 
745
                        var f = new System.Func<int, int> (x => x + i2);
 
746
                }
 
747
        }
 
748
}";
 
749
                        Test (input, 1, output);
 
750
                }
 
751
 
 
752
                [Test]
 
753
                public void TestConstructor ()
 
754
                {
 
755
                        var input = @"
 
756
class TestClass
 
757
{
 
758
        public TestClass (int[] a)
 
759
        {
 
760
                foreach (var i in a) {
 
761
                        int i1;
 
762
                        var f = new System.Func<int, int> (x => x + i);
 
763
                }
 
764
        }
 
765
}";
 
766
                        var output = @"
 
767
class TestClass
 
768
{
 
769
        public TestClass (int[] a)
 
770
        {
 
771
                foreach (var i in a) {
 
772
                        int i1;
 
773
                        var i2 = i;
 
774
                        var f = new System.Func<int, int> (x => x + i2);
 
775
                }
 
776
        }
 
777
}";
 
778
                        Test (input, 1, output);
 
779
                }
 
780
 
 
781
                [Test]
 
782
                public void TestField ()
 
783
                {
 
784
                        var input = @"
 
785
class TestClass
 
786
{
 
787
        System.Action<int> a = i =>
 
788
        {
 
789
                System.Func<int> f = () => i + 1;
 
790
                i++;
 
791
        };
 
792
}";
 
793
                        var output = @"
 
794
class TestClass
 
795
{
 
796
        System.Action<int> a = i =>
 
797
        {
 
798
                var i1 = i;
 
799
                System.Func<int> f = () => i1 + 1;
 
800
                i++;
 
801
        };
 
802
}";
 
803
                        Test (input, 1, output);
 
804
                }
 
805
 
 
806
                
 
807
        }
 
808
}