Skip to content

Commit

Permalink
Working on new test utility. Fix some bugs.
Browse files Browse the repository at this point in the history
  • Loading branch information
someone-with-default-username committed Sep 4, 2012
1 parent b751ad6 commit cda89d7
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 8 deletions.
6 changes: 4 additions & 2 deletions snippets/Nemerle.Test/Nemerle.Compiler.Test/HostedNcc.n
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ namespace Nemerle.Compiler.Test
/// </summary>
internal sealed class HostedNcc : Ncc
{
public this([NotNull] nccArguments : list[string])
public this([NotNull] nccArguments : list[string], verbosity : int)
{
_nccArguments = nccArguments;
}
Expand Down Expand Up @@ -49,7 +49,8 @@ namespace Nemerle.Compiler.Test
| _ is FileNotFoundException => exitCode = 1
| _ is AssemblyFindException => exitCode = 3
| e =>
testOutputWriter.WriteLine(NccTestMessageType.Debug, e.ToString());
when(_verbosity > 0)
testOutputWriter.WriteLine(NccTestMessageType.Debug, e.ToString());
exitCode = 2
}
when (Message.SeenError && exitCode != 3)
Expand All @@ -59,5 +60,6 @@ namespace Nemerle.Compiler.Test
}

private _nccArguments : list[string];
private _verbosity : int;
}
}
5 changes: 3 additions & 2 deletions snippets/Nemerle.Test/Nemerle.Compiler.Test/Main.n
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ using Nemerle.Test.Framework;
using Nemerle.Test.Framework.Utils;

using System;
using System.IO;
using System.Collections.Generic;
using System.Console;
using System.Linq;
Expand Down Expand Up @@ -144,7 +145,7 @@ internal module Program
def ncc = match(externalNcc)
{
| Some(fileName) => ExternalNcc(fileName, nccArguments.ToNList(), processStartFactory)
| None => HostedNcc(nccArguments.ToNList())
| None => HostedNcc(nccArguments.ToNList(), verbosity)
};
def verifier = match(externalVerifier)
{
Expand All @@ -170,7 +171,7 @@ internal module Program
ThreadRunner(listener, 20 * 1024 * 1024 * if (IntPtr.Size == 8) 4 else 1)
else
Runner(listener);
def tests = FileSearcher.Search(testFiles).Select(NccTest(_, outputDirectory, outputWriter, ncc, referencies, verifier, processStartFactory, verbosity));
def tests = FileSearcher.Search(testFiles, SearchOption.TopDirectoryOnly).Select(NccTest(_, outputDirectory, outputWriter, ncc, referencies, verifier, processStartFactory, verbosity));
runner.Run(tests);
mainExecutionListener.GetExitCode()
}
Expand Down
3 changes: 2 additions & 1 deletion snippets/Nemerle.Test/Nemerle.Compiler.Test/NccTest.n
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,8 @@ namespace Nemerle.Compiler.Test
when(_verbosity > 0)
_log.WriteLine(NccTestMessageType.Debug, $"RUN: ..$compilationOptions on $_filePath");

_compiler.Compile(compilationOptions.ToNList(), [_filePath], _log)
def normalizedFilePath = _filePath.Replace('\\', '/');
_compiler.Compile(compilationOptions.ToNList(), [normalizedFilePath], _log)
}

private validateMessages(description : NccTestDescription, compilationResult : NccResult) : void
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
<WarningLevel>4</WarningLevel>
<StartProgram />
<WorkingDirectory />
<CmdArgs>-p:-nowarn:10003 -output:. C:\!Proj\nemerle\ncc\testsuite\positive\*.n</CmdArgs>
<CmdArgs>"-p:-nowarn:10003 -def:RUNTIME_MS;NET_4_0" -output:. C:\!Proj\nemerle\ncc\testsuite\positive\resource.n</CmdArgs>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugSymbols>false</DebugSymbols>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ namespace Nemerle.Test.Framework.Utils
{
public module FileSearcher
{
public Search([NotNull] fileMasks : IEnumerable[string]) : array[string]
public Search([NotNull] fileMasks : IEnumerable[string], searchOption: SearchOption = SearchOption.AllDirectories) : array[string]
{
def filePaths = List();
foreach(fileMask in fileMasks)
Expand All @@ -27,7 +27,7 @@ namespace Nemerle.Test.Framework.Utils
def maskFileName = Path.GetFileName(fileMask);
def fileNames =
if(fileMask.IndexOfAny(array['*', '?']) >= 0)
Directory.GetFiles(maskFileDir, maskFileName, SearchOption.AllDirectories)
Directory.GetFiles(maskFileDir, maskFileName, searchOption)
else
Directory.GetFiles(maskFileDir, maskFileName);
filePaths.AddRange(fileNames);
Expand Down

0 comments on commit cda89d7

Please sign in to comment.