[svn]
r7267: vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/Tests:
Heavy.Tests/CommonTest.n He...
phantom
svnadmin at nemerle.org
Sun Jan 14 19:35:32 CET 2007
Log:
Fixes to the test-suite.
Author: phantom
Date: Sun Jan 14 19:35:30 2007
New Revision: 7267
Modified:
vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/Tests/Heavy.Tests/CommonTest.n
vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/Tests/Heavy.Tests/Heavy.Tests.nproj
vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/Tests/Heavy.Tests/Runner.n
vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/Tests/Refactoring/TestProjectOne/ConsoleMenuRotator.n
vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/Tests/Refactoring/TestProjectOne/Main.n
vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/Tests/Refactoring/TestProjectTwo/Christianity.n
Modified: vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/Tests/Heavy.Tests/CommonTest.n
==============================================================================
--- vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/Tests/Heavy.Tests/CommonTest.n (original)
+++ vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/Tests/Heavy.Tests/CommonTest.n Sun Jan 14 19:35:30 2007
@@ -35,12 +35,12 @@
| _ => twicer(i - 1) + twicer(i - 1)
}
Console.WriteLine($"TEST STARTS $(twicer(8))");
- def total = runner.TestCases.Length;
- when (testCase <= total)
+ match (runner .TestCases.Find((_, number, _, _) => number == testCase))
{
- def (line, number, location, starter) = runner.TestCases.Nth(testCase - 1);
- Assert.AreEqual(number, testCase);
- Assert.IsTrue(runner.Test(line, number, location, starter));
+ | Some(case) =>
+ def (line, number, location, starter) = case;
+ Assert.IsTrue(runner.Test(line, number, location, starter), "Test case FAILED");
+ | _ => Console.WriteLine("Test case is NOT FOUND and not played");
}
Console.WriteLine($"\nTEST FINISHED $(twicer(8))");
}
Modified: vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/Tests/Heavy.Tests/Heavy.Tests.nproj
==============================================================================
--- vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/Tests/Heavy.Tests/Heavy.Tests.nproj (original)
+++ vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/Tests/Heavy.Tests/Heavy.Tests.nproj Sun Jan 14 19:35:30 2007
@@ -41,6 +41,7 @@
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
<Reference Include="$(Nemerle)\Nemerle.dll" />
+ <Reference Include="$(Nemerle)\Nemerle.Macros.dll" />
</ItemGroup>
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.n" />
Modified: vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/Tests/Heavy.Tests/Runner.n
==============================================================================
--- vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/Tests/Heavy.Tests/Runner.n (original)
+++ vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/Tests/Heavy.Tests/Runner.n Sun Jan 14 19:35:30 2007
@@ -163,13 +163,6 @@
0
else
1
- //def comparedLocations = gotoOne.Location.CompareLines(gotoTwo.Location);
- //if (comparedLocations != 0)
- //comparedLocations
- //else if (gotoOne.UsageType == gotoTwo.UsageType)
- //0
- //else
- //gotoOne.Location.CompareTo(gotoTwo.Location)
};
def notFound = one.Filter(one' => !two.Exists(two' => comparator(one', two') == 0));
@@ -222,7 +215,7 @@
public ScanSources(phrase : string, testCase : int = 0) : list[string * int * Location * string]
{
- Write($"Scanning sources searching for test cases ($phrase)... ");
+ Write($"Scanning sources searching for test cases ($phrase)... \n");
mutable found : list[string * int * Location * string] = [];
foreach ((fileIndex, source) in SourceWalker())
foreach ((lineNumber, line) in LineWalker(source, phrase))
@@ -233,30 +226,31 @@
// example of a phrase: // find usages {13} foo666
def search = $"$phrase {";
def position = comment.IndexOf(if (testCase == 0) search else $"$search$testCase}");
- unless (position < 0)
+ when (position == 1)
{
def cutted = comment.Substring(position + search.Length);
def number = int.Parse(cutted.Substring(0, cutted.IndexOf('}')));
found ::= (line, number, Location(fileIndex, lineNumber, 0, lineNumber, 10), comment);
+ when (testCase == 0)
+ WriteLine(comment);
}
});
}
- def comparer = fun ((_, numberOne, _, _), (_, numberTwo, _, _)) { numberOne.CompareTo(numberTwo) };
when (testCase == 0) // searching for the whole test suite
{
+ def comparer = fun ((_, numberOne, _, _), (_, numberTwo, _, _))
+ {
+ def k = numberOne.CompareTo(numberTwo);
+ Assert.IsFalse(k == 0, $"Duplicating test case $numberOne");
+ k
+ };
found = found.Sort(comparer);
def length = found.Length;
- WriteLine($"$length test cases found");
- def (_, last, _, _) = found.Last;
- Assert.AreEqual(length, last);
+ WriteLine($"$length test cases found: $(found.Map((_, number, _, _) => number))");
}
found
}
- public stopAfterFirstFailedTest = false;
-
- skipTestCases : list[int] = [];//[7]; // neglect some tests for a while
-
public FindUsages(line: string, testCase : int, declaration : Location, starter : string) : bool
{
//when (skipTestCases.Contains(testCase)) // TODO: report about compiler bug here (no errors, just internal compiler error)
@@ -341,7 +335,7 @@
@"$(Nemerle)\Nemerle.Macros.dll",
];
def references = references.Map(_.Replace("$(Nemerle)", @"C:\Program Files\Nemerle")).RemoveDuplicates();
- //def references = references.Filter(reference => !reference.Contains("Nemerle"));
+ def references = references.Filter(reference => !reference.Contains("Nemerle"));
WriteLine($"$(references.Length) reference files found");
def runner = TestRunner();
@@ -349,14 +343,20 @@
runner
}
+ public stopAfterFirstFailedTest = false;
+
+ skipTestProjects : list[string] = []; // neglect some projects for a while
+
+ skipTestCases : list[int] = []; // neglect some tests for a while
+
// Run a particular broken test here
public static runSpecificTest : bool = true;
public static RunTheTest() : void
{
- def suite = FindUsagesTestProjectTwo();
+ def suite = FindUsagesTestProjectOne();
suite.SetUp();
- suite.Test007();
+ suite.Test003();
}
public static Main() : void
@@ -393,7 +393,9 @@
runner.StarterPhrase = suite[1];
runner.CheckPhrase = suite[2];
runner.TestCases = runner.ScanSources(suite[1]);
- if (runner.TestCases.ForAll(runner.Test(_)))
+ if (runner.skipTestProjects.Exists(projectPath.Contains(_)))
+ WriteLine($"Skipping test suite '$(suite[1])'\n");
+ else if (runner.TestCases.ForAll(runner.Test(_)))
WriteLine($"\nTest suite '$(suite[1])' passed\n");
else
WriteLine($"\nTest suite '$(suite[1])' failed !!! !!! !!!\n");
@@ -409,7 +411,7 @@
WriteLine($"Initializing engine with $(sources.Length) sources");
def manager = ProjectManager();
- engine = Engine(manager, null);
+ engine = Engine(manager, TraceWriter());
manager.Engine = engine;
//WriteLine($"Compiler is in completion mode: $(engine.IsInIntellisenseMode)");
Modified: vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/Tests/Refactoring/TestProjectOne/ConsoleMenuRotator.n
==============================================================================
--- vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/Tests/Refactoring/TestProjectOne/ConsoleMenuRotator.n (original)
+++ vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/Tests/Refactoring/TestProjectOne/ConsoleMenuRotator.n Sun Jan 14 19:35:30 2007
@@ -47,14 +47,14 @@
Write($"Your choice [automatic launch '$Auto' in $AutoInterval s]: ");
def pressed = { // definition {1} pressed
mutable acquired = false; // definition {2} acquired
- mutable elapsed = 0; // definition {3} elapsed
+ mutable elapsed = 0; // definition {3} elapsed //possibly not found definition {3}
def check = 100; // definition {4} check
do {
Thread.Sleep(check); // usage {4}
- elapsed += check; // usage {3} // usage {4}
+ elapsed += check; // usage {3} // usage {4} //possibly not found usage {3}
when (KeyAvailable)
acquired = true; // usage {2}
- } while (!acquired && elapsed < AutoInterval * 1000); // usage {2} // usage {3}
+ } while (!acquired && elapsed < AutoInterval * 1000); // usage {2} // usage {3} //possibly not found usage {3}
if (acquired) // usage {2}
ReadKey()
else
Modified: vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/Tests/Refactoring/TestProjectOne/Main.n
==============================================================================
--- vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/Tests/Refactoring/TestProjectOne/Main.n (original)
+++ vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/Tests/Refactoring/TestProjectOne/Main.n Sun Jan 14 19:35:30 2007
@@ -8,8 +8,8 @@
{
Main() : void
{
- def manager = DownloadList(); // define {10} manager
- def rotator = ConsoleMenuRotator("KoLXo3 files downloader"); // define {11} rotator
+ def manager = DownloadList(); // definition {50} manager
+ def rotator = ConsoleMenuRotator("KoLXo3 files downloader"); // definition {51} rotator
rotator.Add('1', "Download index file", manager.DownloadIndex);
rotator.Add('2', "Parse index file", manager.ParseIndex);
rotator.Add('3', "Subtract existing files", manager.SubtractExisting);
Modified: vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/Tests/Refactoring/TestProjectTwo/Christianity.n
==============================================================================
--- vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/Tests/Refactoring/TestProjectTwo/Christianity.n (original)
+++ vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/Tests/Refactoring/TestProjectTwo/Christianity.n Sun Jan 14 19:35:30 2007
@@ -34,7 +34,7 @@
public RobeFirstHumanInFlesh() : void // definition {7} RobeFirstHumanInFlesh
{
- RemoveFirstHumanFrom(Instance); // usage {4}
+ RemoveFirstHumanFrom(Instance); // usage {4} // usage {8}
}
RemoveFirstHumanFrom(creator : God) : void // definition {8} RemoveFirstHumanFrom
@@ -64,17 +64,17 @@
public this(imageAndLikeness : God)
{
- imageOfGod = imageAndLikeness;
+ imageOfGod = imageAndLikeness; // usage {13}
}
public override SpeakWithCreator(message : string) : void // definition {14} SpeakWithCreator
{
- imageOfGod.Listen(message); // usage {6}
+ imageOfGod.Listen(message); // usage {6} // usage {13}
}
public override Fall() : void
{
- imageOfGod = null;
+ imageOfGod = null; // usage {13}
}
public override Cry() : void
More information about the svn
mailing list