102030405060708090100110120130140150160170180190200210220230240250260270280290300310320330340350360370380390400410420430440450460470480490500510520530540550560570580590600610620630640650660670680690700710720730 module trial.reporters.dotmatrix; import std.stdio; import std.array; import std.conv; import std.datetime; import std.string; import std.algorithm; import trial.interfaces; import trial.reporters.writer; struct DotMatrixGlyphs { string success = "."; string failure = "!"; string unknown = "?"; string pending = "-"; } string dotMatrixGlyphsToCode(DotMatrixGlyphs glyphs) { return "DotMatrixGlyphs(`"~ glyphs.success ~"`,`"~ glyphs.failure ~"`,`"~ glyphs.unknown ~"`)"; } class DotMatrixReporter : ITestCaseLifecycleListener { private { ReportWriter writer; DotMatrixGlyphs glyphs; } this(DotMatrixGlyphs glyphs) { writer = defaultWriter; this.glyphs = glyphs; } this(ReportWriter writer) { this.writer = writer; } void begin(string suite, ref TestResult test) { } void end(string suite, ref TestResult test) { switch (test.status) { case TestResult.Status.success: writer.write(glyphs.success, ReportWriter.Context.inactive); break; case TestResult.Status.failure: writer.write(glyphs.failure, ReportWriter.Context.danger); break; case TestResult.Status.pending: writer.write(glyphs.pending, ReportWriter.Context.info); break; default: writer.write(glyphs.unknown, ReportWriter.Context.warning); } } }
module trial.reporters.dotmatrix; import std.stdio; import std.array; import std.conv; import std.datetime; import std.string; import std.algorithm; import trial.interfaces; import trial.reporters.writer; struct DotMatrixGlyphs { string success = "."; string failure = "!"; string unknown = "?"; string pending = "-"; } string dotMatrixGlyphsToCode(DotMatrixGlyphs glyphs) { return "DotMatrixGlyphs(`"~ glyphs.success ~"`,`"~ glyphs.failure ~"`,`"~ glyphs.unknown ~"`)"; } class DotMatrixReporter : ITestCaseLifecycleListener { private { ReportWriter writer; DotMatrixGlyphs glyphs; } this(DotMatrixGlyphs glyphs) { writer = defaultWriter; this.glyphs = glyphs; } this(ReportWriter writer) { this.writer = writer; } void begin(string suite, ref TestResult test) { } void end(string suite, ref TestResult test) { switch (test.status) { case TestResult.Status.success: writer.write(glyphs.success, ReportWriter.Context.inactive); break; case TestResult.Status.failure: writer.write(glyphs.failure, ReportWriter.Context.danger); break; case TestResult.Status.pending: writer.write(glyphs.pending, ReportWriter.Context.info); break; default: writer.write(glyphs.unknown, ReportWriter.Context.warning); } } }