IMPORTANT: To view this page as Markdown, append `.md` to the URL (e.g. /docs/manual/basics.md). For the complete Mojo documentation index, see llms.txt.
Skip to main content
Version: Nightly
For the complete Mojo documentation index, see llms.txt. Markdown versions of all pages are available by appending .md to any URL (e.g. /docs/manual/basics.md).

TestResult

struct TestResult

A test result code.

Implemented traits​

AnyType, Copyable, Deinitable, EnumLike, Equatable, ImplicitlyCopyable, Movable, Writable

comptime members​

fail​

comptime fail = TestResult(Int(1))

The test failed.

FAIL​

comptime FAIL = TestResult.fail

Deprecated: The former name of fail.

Deprecated: 'FAIL' is deprecated, use 'fail' instead

pass​

comptime pass = TestResult(Int(0))

The test passed.

PASS​

comptime PASS = TestResult.pass

Deprecated: The former name of pass.

Deprecated: Use TestResult.pass instead.

skip​

comptime skip = TestResult(Int(2))

The test was skipped.

SKIP​

comptime SKIP = TestResult.skip

Deprecated: The former name of skip.

Deprecated: 'SKIP' is deprecated, use 'skip' instead

Methods​

__eq__​

def __eq__(self, rhs: Self) -> Bool

Compare two test result codes for equality.

Args:

  • ​rhs (Self): The other test result code to compare against.

Returns:

Bool: True if the result codes are equal, False otherwise.

write_to​

def write_to(self, mut writer: T)

Write the result code to the writer.

Args:

  • ​writer (T): The writer to output the result code to.

write_repr_to​

def write_repr_to(self, mut writer: T)

Write the repr of this test result to a writer.

Args:

  • ​writer (T): The writer to output to.