public TestException toTestException(Throwable t)

Converts a Throwable to a TestException which improves the failure verbosity

public Frame toDarwinFrame(string line)

Parse a MacOS string frame

public Frame toWindows1Frame(string line)

Parse a Windows string frame

public Frame toWindows2Frame(string line)

Parse a Windows string frame

public Frame toGLibCFrame(string line)

Parse a GLibC string frame

public Frame toNetBsdFrame(string line)

Parse a NetBsd string frame

public Frame toLinuxFrame(string line)

Parse a Linux frame

public Frame toMissingInfoLinuxFrame(string line)

Parse a Linux frame

public Frame toFrame(string line)

Converts a stack trace line to a Frame structure

Example

Get the main frame info from linux format

auto line = `generated.d:45 _Dmain [0x8e80c4]`;

auto frame = line.toFrame;

frame.moduleName.should.equal("");
frame.file.should.equal("generated.d");
frame.line.should.equal(45);
frame.name.should.equal("_Dmain");
frame.address.should.equal("0x8e80c4");
frame.index.should.equal(-1);
frame.offset.should.equal("");

Example

Get a function frame info from linux format

auto line = `lifecycle/trial/runner.d:106 trial.interfaces.SuiteResult[] trial.runner.runTests(const(trial.interfaces.TestCase)[], immutable(char)[]) [0x8b0ec1]`;
auto frame = line.toFrame;

frame.moduleName.should.equal("");
frame.file.should.equal("lifecycle/trial/runner.d");
frame.line.should.equal(106);
frame.name.should.equal("trial.interfaces.SuiteResult[] trial.runner.runTests(const(trial.interfaces.TestCase)[], immutable(char)[])");
frame.address.should.equal("0x8b0ec1");
frame.index.should.equal(-1);
frame.offset.should.equal("");

Example

Get an external function frame info from linux format

auto line = `../../.dub/packages/fluent-asserts-0.6.6/fluent-asserts/core/fluentasserts/core/base.d:39 void fluentasserts.core.base.Result.perform() [0x8f4b47]`;
auto frame = line.toFrame;

frame.moduleName.should.equal("");
frame.file.should.equal("../../.dub/packages/fluent-asserts-0.6.6/fluent-asserts/core/fluentasserts/core/base.d");
frame.line.should.equal(39);
frame.name.should.equal("void fluentasserts.core.base.Result.perform()");
frame.address.should.equal("0x8f4b47");
frame.index.should.equal(-1);
frame.offset.should.equal("");

Example

Get an external function frame info from linux format

auto line = `lifecycle/trial/discovery/unit.d:268 _D5trial9discovery4unit17UnitTestDiscovery231__T12addTestCasesVAyaa62_2f686f6d652f626f737a2f776f726b73706163652f64746573742f6c6966656379636c652f747269616c2f6578656375746f722f706172616c6c656c2e64VAyaa23_747269616c2e6578656375746f722e706172616c6c656cS245trial8executor8parallelZ12addTestCasesMFZ9__lambda4FZv [0x872000]`;
auto frame = line.toFrame;

frame.moduleName.should.equal("");
frame.file.should.equal("lifecycle/trial/discovery/unit.d");
frame.line.should.equal(268);
frame.name.should.equal("_D5trial9discovery4unit17UnitTestDiscovery231__T12addTestCasesVAyaa62_2f686f6d652f626f737a2f776f726b73706163652f64746573742f6c6966656379636c652f747269616c2f6578656375746f722f706172616c6c656c2e64VAyaa23_747269616c2e6578656375746f722e706172616c6c656cS245trial8executor8parallelZ12addTestCasesMFZ9__lambda4FZv");
frame.address.should.equal("0x872000");
frame.index.should.equal(-1);
frame.offset.should.equal("");

Example

Get an missing info function frame info from linux format

auto line = `??:? __libc_start_main [0x174bbf44]`;
auto frame = line.toFrame;

frame.moduleName.should.equal("");
frame.file.should.equal("");
frame.line.should.equal(-1);
frame.name.should.equal("__libc_start_main");
frame.address.should.equal("0x174bbf44");
frame.index.should.equal(-1);
frame.offset.should.equal("");

A module containing custom exceptions for display convenience

Copyright

© 2017 Szabo Bogdan

License

Subject to the terms of the MIT license, as written in the included LICENSE.txt file.

Authors

Szabo Bogdan