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

Draft PR for issue #496 #768

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open

Draft PR for issue #496 #768

wants to merge 6 commits into from

Conversation

Grubba27
Copy link

@Grubba27 Grubba27 commented Feb 2, 2022

This is related to issue #496

@TomPridham
Copy link
Contributor

if you pull all of the instances of opt out of the for_each and assign them to variables like this

    let Opt {
        service_number,
        service_pull_request,
        commit_sha,
        output_path,
        ignore_not_existing,
        ignore_dir,
        keep_dir,
        branch,
        token,
        service_name,
        service_job_id,
        vcs_branch,
        parallel,
        ..
    } = opt;
    let service_number = service_number.unwrap_or_default();
    let service_pull_request = service_pull_request.unwrap_or_default();
    let commit_sha = commit_sha.unwrap_or_default();
    let output_path = output_path.as_deref();

it compiles for me

@Grubba27
Copy link
Author

Grubba27 commented Feb 3, 2022

if you pull all of the instances of opt out of the for_each and assign them to variables like this

    let Opt {
        service_number,
        service_pull_request,
        commit_sha,
        output_path,
        ignore_not_existing,
        ignore_dir,
        keep_dir,
        branch,
        token,
        service_name,
        service_job_id,
        vcs_branch,
        parallel,
        ..
    } = opt;
    let service_number = service_number.unwrap_or_default();
    let service_pull_request = service_pull_request.unwrap_or_default();
    let commit_sha = commit_sha.unwrap_or_default();
    let output_path = output_path.as_deref();

it compiles for me

It did compile for me also now! I've never seen atribuiton like this way that you tought me!!

@Grubba27
Copy link
Author

Grubba27 commented Feb 3, 2022

Now that I have to change the tests, how could I start this ?

@Grubba27
Copy link
Author

Grubba27 commented Feb 3, 2022

I would start changing tests like this ?

#[test]
    fn test_rewrite_paths_basic() {
        let mut result_map: CovResultMap = FxHashMap::default();
        result_map.insert("main.cpp".to_string(), empty_result!());
        let results = Box::new(rewrite_paths(
            result_map,
            None,
            None,
            None,
            false,
            &[""; 0],
            &[""; 0],
            None,
            Default::default(),
        ).into_iter());
        let mut count = 0;
        for (abs_path, rel_path, result) in results {
            count += 1;
            assert_eq!(abs_path, PathBuf::from("main.cpp"));
            assert_eq!(rel_path, PathBuf::from("main.cpp"));
            assert_eq!(result, empty_result!());
        }
        assert_eq!(count, 1);
    }

@Grubba27
Copy link
Author

Grubba27 commented Feb 3, 2022

For some reason cargo fmt did not linted :(

@Grubba27 Grubba27 changed the title Created Draft PR Draft PR for issue #496 Feb 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants