Skip to content

Rust mockall example to test mocking external function in integration tests

Notifications You must be signed in to change notification settings

jgerrish/mockall-mock-external-fn-in-integration-test

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

mockall-mock-external-fn-in-integration-test

This application tests mocking external functions in both unit and integration tests.

Currently, we can create a _context wrapper in the unit tests, but not in the integration tests.

The unit test code is in src/lib.rs The integration test code is in tests/mywidget_handle_event.rs

Trying to mock the crossterm read function, found in the namespace:

crossterm::event::read

We created a wrapper in src/lib.rs for read in the crossterm and event modules.

The errors we're getting are either no mock_event in crossterm or cannot find function read_context in module event

About

Rust mockall example to test mocking external function in integration tests

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages