Permalink
Browse files

Some polish and tweaks to the ConePad logging.

  • Loading branch information...
1 parent 3990f34 commit 9ab32bb6260f4eee18300ecd77adaf70ac77d781 @drunkcod committed Mar 4, 2012
View
@@ -25,7 +25,7 @@ public class ConeTask : MarshalByRefObject, ITask, ICrossDomainLogger
}
void ICrossDomainLogger.Info(string message) {
- BuildEngine.LogMessageEvent(new BuildMessageEventArgs(message.TrimEnd(), string.Empty, SenderName, MessageImportance.High));
+ BuildEngine.LogMessageEvent(new BuildMessageEventArgs(message, string.Empty, SenderName, MessageImportance.High));
}
void ICrossDomainLogger.Failure(string file, int line, int column, string message) {
View
@@ -9,18 +9,31 @@ namespace Cone
{
public static class ConePad
{
+ class ConePadLogger : IConeLogger
+ {
+ public void Info(string format, object[] args) {
+ Console.Out.Write(format, args);
+ }
+
+ public void Failure(ConeTestFailure failure) {
+ Console.Out.WriteLine(" {0}", failure.Context);
+ Console.Out.WriteLine("\t\t{0}: {1}", failure.TestName, failure.Message);
+ }
+
+ }
+
public static void RunTests() {
Verify.GetPluginAssemblies = () => new[]{ typeof(Verify).Assembly };
- RunTests(new ConsoleLogger(), Assembly.GetCallingAssembly().GetTypes().Where(ConePadSuiteBuilder.SupportedType));
+ RunTests(new ConePadLogger(), Assembly.GetCallingAssembly().GetTypes().Where(ConePadSuiteBuilder.SupportedType));
}
public static void RunTests(TextWriter output, IEnumerable<Assembly> assemblies) {
Verify.GetPluginAssemblies = () => assemblies.Concat(new[]{ typeof(Verify).Assembly });
- RunTests(new ConsoleLogger(), assemblies.SelectMany(x => x.GetTypes()).Where(ConePadSuiteBuilder.SupportedType));
+ RunTests(new ConePadLogger(), assemblies.SelectMany(x => x.GetTypes()).Where(ConePadSuiteBuilder.SupportedType));
}
public static void RunTests(params Type[] suiteTypes) {
- RunTests(new ConsoleLogger(), suiteTypes);
+ RunTests(new ConePadLogger(), suiteTypes);
}
public static void RunTests(IConeLogger log, IEnumerable<Type> suites) {
@@ -10,7 +10,7 @@ class Program
{
static void Main(string[] args) {
try {
- new SimpleConeRunner().RunTests(new ConsoleLogger(), args.Select(x => Assembly.LoadFrom(x)));
+ new SimpleConeRunner().RunTests(new ConsoleLogger(), args.Select(Assembly.LoadFrom));
} catch(ReflectionTypeLoadException tle) {
foreach(var item in tle.LoaderExceptions)
Console.Error.WriteLine("{0}\n---", item);
@@ -12,6 +12,10 @@ public static class CollectionExtensions
return result;
}
+ public static TOutput[] ConvertAll<TInput, TOutput>(this TInput[] self, Converter<TInput, TOutput> converter) {
+ return Array.ConvertAll(self, converter);
+ }
+
public static void ForEachIf<T>(this T[] self, Func<T, bool> predicate, Action<T> @do) {
for(var i = 0; i != self.Length; ++i) {
var x = self[i];
@@ -1,5 +1,6 @@
using System;
using System.Reflection;
+using Cone.Core;
namespace Cone.Runners
{
@@ -9,7 +10,7 @@ public interface ICrossDomainLogger
void Failure(string file, int line, int column, string message);
}
- public class CrossDomainLoggerAdapater : IConeLogger
+ class CrossDomainLoggerAdapater : IConeLogger
{
readonly ICrossDomainLogger crossDomainLog;
@@ -39,9 +40,9 @@ class RunTestsCommand
public string[] AssemblyPaths;
public void Execute() {
- new SimpleConeRunner() {
+ new SimpleConeRunner() {
ShowProgress = false
- }.RunTests(new CrossDomainLoggerAdapater(Logger), Array.ConvertAll(AssemblyPaths, Assembly.LoadFrom));
+ }.RunTests(new CrossDomainLoggerAdapater(Logger), AssemblyPaths.ConvertAll(Assembly.LoadFrom));
}
}

0 comments on commit 9ab32bb

Please sign in to comment.