|
|
|
@ -6,7 +6,6 @@
@@ -6,7 +6,6 @@
|
|
|
|
|
// </file>
|
|
|
|
|
|
|
|
|
|
using System; |
|
|
|
|
using System.Drawing; |
|
|
|
|
using System.IO; |
|
|
|
|
using NUnit.Framework; |
|
|
|
|
using ICSharpCode.NRefactory.Parser; |
|
|
|
@ -28,7 +27,7 @@ namespace ICSharpCode.NRefactory.Tests.Lexer.CSharp
@@ -28,7 +27,7 @@ namespace ICSharpCode.NRefactory.Tests.Lexer.CSharp
|
|
|
|
|
{ |
|
|
|
|
ILexer l = GenerateLexer("public"); |
|
|
|
|
Token t = l.NextToken(); |
|
|
|
|
Assert.AreEqual(new Point(1, 1), t.Location); |
|
|
|
|
Assert.AreEqual(new Location(1, 1), t.Location); |
|
|
|
|
} |
|
|
|
|
[Test] |
|
|
|
|
public void Test2() |
|
|
|
@ -36,7 +35,7 @@ namespace ICSharpCode.NRefactory.Tests.Lexer.CSharp
@@ -36,7 +35,7 @@ namespace ICSharpCode.NRefactory.Tests.Lexer.CSharp
|
|
|
|
|
ILexer l = GenerateLexer("public static"); |
|
|
|
|
Token t = l.NextToken(); |
|
|
|
|
t = l.NextToken(); |
|
|
|
|
Assert.AreEqual(new Point(8, 1), t.Location); |
|
|
|
|
Assert.AreEqual(new Location(8, 1), t.Location); |
|
|
|
|
} |
|
|
|
|
[Test] |
|
|
|
|
public void TestReturn() |
|
|
|
@ -44,77 +43,77 @@ namespace ICSharpCode.NRefactory.Tests.Lexer.CSharp
@@ -44,77 +43,77 @@ namespace ICSharpCode.NRefactory.Tests.Lexer.CSharp
|
|
|
|
|
ILexer l = GenerateLexer("public\nstatic"); |
|
|
|
|
Token t = l.NextToken(); |
|
|
|
|
t = l.NextToken(); |
|
|
|
|
Assert.AreEqual(new Point(1, 2), t.Location); |
|
|
|
|
Assert.AreEqual(new Location(1, 2), t.Location); |
|
|
|
|
} |
|
|
|
|
[Test] |
|
|
|
|
public void TestSpace() |
|
|
|
|
{ |
|
|
|
|
ILexer l = GenerateLexer(" public"); |
|
|
|
|
Token t = l.NextToken(); |
|
|
|
|
Assert.AreEqual(new Point(3, 1), t.Location); |
|
|
|
|
Assert.AreEqual(new Location(3, 1), t.Location); |
|
|
|
|
} |
|
|
|
|
[Test] |
|
|
|
|
public void TestOctNumber() |
|
|
|
|
{ |
|
|
|
|
ILexer l = GenerateLexer("0142"); |
|
|
|
|
Token t = l.NextToken(); |
|
|
|
|
Assert.AreEqual(new Point(1, 1), t.Location); |
|
|
|
|
Assert.AreEqual(new Location(1, 1), t.Location); |
|
|
|
|
} |
|
|
|
|
[Test] |
|
|
|
|
public void TestHexNumber() |
|
|
|
|
{ |
|
|
|
|
ILexer l = GenerateLexer("0x142 public"); |
|
|
|
|
Token t = l.NextToken(); |
|
|
|
|
Assert.AreEqual(new Point(1, 1), t.Location); |
|
|
|
|
Assert.AreEqual(new Location(1, 1), t.Location); |
|
|
|
|
t = l.NextToken(); |
|
|
|
|
Assert.AreEqual(new Point(7, 1), t.Location); |
|
|
|
|
Assert.AreEqual(new Location(7, 1), t.Location); |
|
|
|
|
} |
|
|
|
|
[Test] |
|
|
|
|
public void TestHexNumberChar() |
|
|
|
|
{ |
|
|
|
|
ILexer l = GenerateLexer("\'\\x224\' public"); |
|
|
|
|
Token t = l.NextToken(); |
|
|
|
|
Assert.AreEqual(new Point(1, 1), t.Location); |
|
|
|
|
Assert.AreEqual(new Location(1, 1), t.Location); |
|
|
|
|
t = l.NextToken(); |
|
|
|
|
Assert.AreEqual(new Point(9, 1), t.Location); |
|
|
|
|
Assert.AreEqual(new Location(9, 1), t.Location); |
|
|
|
|
} |
|
|
|
|
[Test] |
|
|
|
|
public void TestFloationPointNumber() |
|
|
|
|
{ |
|
|
|
|
ILexer l = GenerateLexer("0.142 public"); |
|
|
|
|
Token t = l.NextToken(); |
|
|
|
|
Assert.AreEqual(new Point(1, 1), t.Location); |
|
|
|
|
Assert.AreEqual(new Location(1, 1), t.Location); |
|
|
|
|
t = l.NextToken(); |
|
|
|
|
Assert.AreEqual(new Point(7, 1), t.Location); |
|
|
|
|
Assert.AreEqual(new Location(7, 1), t.Location); |
|
|
|
|
} |
|
|
|
|
[Test] |
|
|
|
|
public void TestVerbatimString() |
|
|
|
|
{ |
|
|
|
|
ILexer l = GenerateLexer("@\"a\"\"a\" public"); |
|
|
|
|
Token t = l.NextToken(); |
|
|
|
|
Assert.AreEqual(new Point(1, 1), t.Location); |
|
|
|
|
Assert.AreEqual(new Location(1, 1), t.Location); |
|
|
|
|
t = l.NextToken(); |
|
|
|
|
Assert.AreEqual(new Point(9, 1), t.Location); |
|
|
|
|
Assert.AreEqual(new Location(9, 1), t.Location); |
|
|
|
|
} |
|
|
|
|
[Test] |
|
|
|
|
public void TestAtIdent() |
|
|
|
|
{ |
|
|
|
|
ILexer l = GenerateLexer("@public ="); |
|
|
|
|
Token t = l.NextToken(); |
|
|
|
|
Assert.AreEqual(new Point(1, 1), t.Location); |
|
|
|
|
Assert.AreEqual(new Location(1, 1), t.Location); |
|
|
|
|
t = l.NextToken(); |
|
|
|
|
Assert.AreEqual(new Point(9, 1), t.Location); |
|
|
|
|
Assert.AreEqual(new Location(9, 1), t.Location); |
|
|
|
|
} |
|
|
|
|
[Test] |
|
|
|
|
public void TestNoFloationPointNumber() |
|
|
|
|
{ |
|
|
|
|
ILexer l = GenerateLexer("5.a"); |
|
|
|
|
Token t = l.NextToken(); |
|
|
|
|
Assert.AreEqual(new Point(1, 1), t.Location); |
|
|
|
|
Assert.AreEqual(new Location(1, 1), t.Location); |
|
|
|
|
t = l.NextToken(); |
|
|
|
|
Assert.AreEqual(new Point(2, 1), t.Location); |
|
|
|
|
Assert.AreEqual(new Location(2, 1), t.Location); |
|
|
|
|
t = l.NextToken(); |
|
|
|
|
Assert.AreEqual(new Point(3, 1), t.Location); |
|
|
|
|
Assert.AreEqual(new Location(3, 1), t.Location); |
|
|
|
|
} |
|
|
|
|
[Test] |
|
|
|
|
public void TestNumber() |
|
|
|
@ -122,7 +121,7 @@ namespace ICSharpCode.NRefactory.Tests.Lexer.CSharp
@@ -122,7 +121,7 @@ namespace ICSharpCode.NRefactory.Tests.Lexer.CSharp
|
|
|
|
|
ILexer l = GenerateLexer("142\nstatic"); |
|
|
|
|
Token t = l.NextToken(); |
|
|
|
|
t = l.NextToken(); |
|
|
|
|
Assert.AreEqual(new Point(1, 2), t.Location); |
|
|
|
|
Assert.AreEqual(new Location(1, 2), t.Location); |
|
|
|
|
} |
|
|
|
|
[Test] |
|
|
|
|
public void TestNumber2() |
|
|
|
@ -130,14 +129,14 @@ namespace ICSharpCode.NRefactory.Tests.Lexer.CSharp
@@ -130,14 +129,14 @@ namespace ICSharpCode.NRefactory.Tests.Lexer.CSharp
|
|
|
|
|
ILexer l = GenerateLexer("14 static"); |
|
|
|
|
Token t = l.NextToken(); |
|
|
|
|
t = l.NextToken(); |
|
|
|
|
Assert.AreEqual(new Point(4, 1), t.Location); |
|
|
|
|
Assert.AreEqual(new Location(4, 1), t.Location); |
|
|
|
|
} |
|
|
|
|
[Test] |
|
|
|
|
public void TestOperator() |
|
|
|
|
{ |
|
|
|
|
ILexer l = GenerateLexer("<<="); |
|
|
|
|
Token t = l.NextToken(); |
|
|
|
|
Assert.AreEqual(new Point(1, 1), t.Location); |
|
|
|
|
Assert.AreEqual(new Location(1, 1), t.Location); |
|
|
|
|
Assert.AreEqual(Tokens.EOF, l.NextToken().kind); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|