Silk

silk/testing

Profiles: aarch64-apple-darwin, aarch64-unknown-linux-gnu, aarch64-unknown-linux-gnu-no-libc, wasm32-unknown-unknown, x86_64-unknown-linux-gnu, x86_64-unknown-linux-gnu-no-libc.

Minimal source-defined test assertions and runtime selection predicates.

When to use

Mark a parameterless unit function with test, then use expect for a boolean condition. Custom runners may reuse matches to apply the builtin runner's file and name policy.

Details

Assertions are ordinary typed failures. They require no service and carry the caller's borrowed diagnostic message. Runtime filters are literal: file paths compare exactly, while names use ASCII-only case folding and bytewise substring matching.

Import as Testing with import silk.testing { Testing }.

Public declarations: 2.

AssertionError

pub struct AssertionError<'message>

A failed boolean expectation with the caller-provided diagnostic message.

Testing

pub struct Testing

Source-defined test helpers with no compiler-known behavior.

Associated function Testing.expect

pub effect<'message> fn expect<'message>(condition: bool, message: string<'message>) -> () ! silk/testing.AssertionError<'message>

Fails with message when condition is false.

Associated function Testing.assertionMessage

pub fn assertionMessage<'message>(error: &'message silk/testing.AssertionError<'message>) -> string<'message>

Returns the diagnostic message retained by one assertion failure.

Associated function Testing.matches

pub fn matches<'life0, 'life1, 'life2, 'life3>(path: string<'life0>, name: string<'life1>, fileFilter: string<'life2>, nameFilter: string<'life3>) -> bool

Applies exact logical-file matching and literal ASCII case-insensitive name matching. Empty file or name filters match every test.

On this page