[svn] r6919: vs-plugin/trunk: ConsoleTest/Program.cs
Nemerle.Compiler.Utils/Nemerle.Completion2/Tests/Cont...
IT
svnadmin at nemerle.org
Fri Nov 17 03:03:57 CET 2006
Log:
Unit test for property location.
Author: IT
Date: Fri Nov 17 03:03:49 2006
New Revision: 6919
Modified:
vs-plugin/trunk/ConsoleTest/Program.cs
vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/Tests/Content/Class1.n
vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/Tests/Tests.Init.n
vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/Tests/Tests.n
Modified: vs-plugin/trunk/ConsoleTest/Program.cs
==============================================================================
--- vs-plugin/trunk/ConsoleTest/Program.cs (original)
+++ vs-plugin/trunk/ConsoleTest/Program.cs Fri Nov 17 03:03:49 2006
@@ -12,6 +12,7 @@
Test1 test = new Test1();
test.Init();
+ test.Property_location();
test.QuickTip_Imperative();
test.QuickTip_StackOverflow();
test.QuickTip_ArgPattern();
Modified: vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/Tests/Content/Class1.n
==============================================================================
--- vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/Tests/Content/Class1.n (original)
+++ vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/Tests/Content/Class1.n Fri Nov 17 03:03:49 2006
@@ -182,6 +182,20 @@
}
}
+class Class5
+{
+ public/*PropStartLocation*/ Prop
+ : int
+
+ {/*PropBodyLocation*/
+ get { 0 }
+ set { }
+ //
+ /*
+ */
+ }/*PropEndLocation*/
+}
+
module ClassExtension
{
Boo() : void
Modified: vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/Tests/Tests.Init.n
==============================================================================
--- vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/Tests/Tests.Init.n (original)
+++ vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/Tests/Tests.Init.n Fri Nov 17 03:03:49 2006
@@ -82,6 +82,15 @@
}
}
+ CheckProperty(member : IMember, name : string) : void
+ {
+ match (member)
+ {
+ | prop is PropertyBuilder => Assert.AreEqual(name, prop.Name);
+ | _ => Assert.Fail("member is PropertyBuilder Failure.");
+ }
+ }
+
/// Íàõîäèò òåã è âîçâðàùàåò åãî êîîðäèíàòû (ñòðîêà, êîëîíêà).
/// ôîðìàò òåãà /*Òåãà*/ èëè /*Òåãà:+ñäâèã*/ èëè /*Òåãà:-ñäâèã*/
/// Ñäâèã ïîçâîëÿåò çàäàòü êîëîíêó ñ îòíîñèòåëüíûì ñäâèãîì.
Modified: vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/Tests/Tests.n
==============================================================================
--- vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/Tests/Tests.n (original)
+++ vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/Tests/Tests.n Fri Nov 17 03:03:49 2006
@@ -506,5 +506,38 @@
Assert.IsNotNull(result, "result is null");
WriteLine(result.Text);
}
+
+ [Test]
+ public Property_location() : void
+ {
+ def file = FilePath1;
+ def (line, col) = ReadLocation(file, "PropStartLocation");
+
+ def decl = _project.GetActiveDecl(file, line, col);
+
+ CheckType (decl, "Class5");
+
+ def tb = (decl :> Decl.Type).Builder;
+ def prop = tb.GetActiveMember(Location.GetFileIndex(file), line, col);
+
+ CheckProperty(prop, "Method");
+
+ def prop = prop :> PropertyBuilder;
+
+ Assert.AreEqual(prop.Location.Line, line);
+ Assert.AreEqual(prop.Location.Column, col - 8);
+
+ def (line, col) = ReadLocation(file, "PropBodyLocation");
+
+ Assert.AreEqual(prop.BodyLocation.Line, line);
+ Assert.AreEqual(prop.BodyLocation.Column, col - 2);
+
+ def (line, col) = ReadLocation(file, "PropEndLocation");
+
+ Assert.AreEqual(prop.Location.Line, line);
+ Assert.AreEqual(prop.Location.Column, col - 2);
+ Assert.AreEqual(prop.BodyLocation.Line, line);
+ Assert.AreEqual(prop.BodyLocation.Column, col - 3);
+ }
}
}
More information about the svn
mailing list