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

« back to all changes in this revision

Viewing changes to external/nrefactory/ICSharpCode.NRefactory.VB.Tests/Lexer/LATextReaderTests.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
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
 
2
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
 
3
 
 
4
using System;
 
5
using System.IO;
 
6
using ICSharpCode.NRefactory.VB.Parser;
 
7
using NUnit.Framework;
 
8
 
 
9
namespace ICSharpCode.NRefactory.VB.Tests.Lexer
 
10
{
 
11
        [TestFixture]
 
12
        public class LATextReaderTests
 
13
        {
 
14
                [Test]
 
15
                public void TestPeek()
 
16
                {
 
17
                        LATextReader reader = new LATextReader(new StringReader("abcd"));
 
18
                        
 
19
                        CheckPeek(reader, 0, 'a');
 
20
                        CheckPeek(reader, 2, 'c');
 
21
                        CheckPeek(reader, 3, 'd');
 
22
                        CheckPeek(reader, 1, 'b');
 
23
                        CheckPeek(reader, 0, 'a');
 
24
                        Assert.AreEqual((int)'a', reader.Read());
 
25
                        CheckPeek(reader, 1, 'c');
 
26
                        CheckPeek(reader, 2, 'd');
 
27
                        CheckPeek(reader, 0, 'b');
 
28
                }
 
29
                
 
30
                void CheckPeek(LATextReader reader, int num1, char char2)
 
31
                {
 
32
                        Assert.AreEqual((int)char2, reader.Peek(num1));
 
33
                }
 
34
        }
 
35
}