bitwizeshift / bitwizeshift/oxtest

Add mocking attributes or macros

Open
#13 0 comments 0 reactions 0 assignees View on GitHub
✨ Feature
Dominant language
Rust
Stars
0
Forks
0
PR merge metrics
No merged PRs in 30d

Description

This is a larger task that will make use of #11 in order to generate/define mock functionality.

The exact syntax/specifics are yet to be determined, but the idea is to support something like:

```rust
trait Turtle {
fn pen_down(&mut self);
fn pen_up(&mut self);
}

#[neotest::mock]
struct MockTurtle;

impl Turtle for MockTurtle {
// Set this as a mock function
#[neotest::mock_fn]
fn pen_down(&mut self);
#[neotest::mock_fn]
fn pen_up(&mut self);
}

// ...

fn test_draw_circle() {
let mut turtle = MockTurtle::new();
let painter = Painter::new(&mut turtle);

subtest!{ |calls_pen_down|
let expectation = neotest::expect_call!( turtle.pen_down() => Times(1) );

painter.draw_circle(0, 0, 10);

assert!(expectation.satisfied());
}
}
```

(Syntax/names are subject to change, but this is the general idea).

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.