Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Increase unit test coverage #293

Open
saschagrunert opened this issue Apr 5, 2022 · 1 comment
Open

Increase unit test coverage #293

saschagrunert opened this issue Apr 5, 2022 · 1 comment
Labels
good first issue Good for newcomers help wanted Extra attention is needed kind/ci rust Rust code related PR's and issues

Comments

@saschagrunert
Copy link
Member

We should actively work on increasing the unit test coverage by using the mockall framework. This should be done in the same way like we did it for the server init:

#[cfg(test)]
use mockall::{automock, predicate::*};

#[cfg(test)]
mod tests {
use super::*;
use std::{ptr, str};
use tempfile::tempfile;
fn new_sut(mock: MockInitImpl) -> Init<MockInitImpl> {
Init::<MockInitImpl> { imp: mock }
}
#[test]
fn unset_locale() -> Result<()> {
let mut mock = MockInitImpl::new();
mock.expect_setlocale()
.withf(|x, _| *x == LC_ALL)
.returning(|_, _| ptr::null_mut());
let sut = new_sut(mock);
sut.unset_locale()
}

@saschagrunert saschagrunert added good first issue Good for newcomers help wanted Extra attention is needed labels Apr 5, 2022
@saschagrunert saschagrunert added the rust Rust code related PR's and issues label Jul 20, 2022
This was referenced Aug 31, 2022
@swastik959
Copy link

@saschagrunert hi I want to work on this issue but getting confused how did you wrote these test cases

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers help wanted Extra attention is needed kind/ci rust Rust code related PR's and issues
Projects
None yet
Development

No branches or pull requests

2 participants