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

Convert GitHub workflow tests to Rust tests #636

Open
5 of 11 tasks
smoelius opened this issue Mar 12, 2023 · 1 comment
Open
5 of 11 tasks

Convert GitHub workflow tests to Rust tests #636

smoelius opened this issue Mar 12, 2023 · 1 comment
Labels
good first issue Good for newcomers

Comments

@smoelius
Copy link
Collaborator

smoelius commented Mar 12, 2023

Do more with Rust tests and less with Yaml/Bash.

The point is to make more tests runnable via cargo test (not to use Rust for Rust's sake).

Necessist uses this approach, e.g., for checking licenses and checking lockfiles.

The new tests should probably go in ci.rs.

@smoelius
Copy link
Collaborator Author

#1077 is a recent example of such a conversion. Here is a summary of its changes:

  • Installation of cargo-rdme was moved from the lint step to the test step:
    cargo install cargo-rdme || true
  • Invocation of update_util_READMEs.sh was removed from the lint step.
  • update_util_READMEs.sh was removed altogether.
  • update_util_READMEs.sh's functionality was duplicated in a test. The bulk of the logic is in a closure that is passed to preserves_cleanliness:
    #[test]
    fn format_util_readmes() {
    preserves_cleanliness("format_util_readmes", false, || {
    for entry in read_dir("utils").unwrap() {
    let entry = entry.unwrap();
    let path = entry.path();
    Command::new("cargo")
    .arg("rdme")
    .current_dir(path)
    .assert()
    .success();
    }
    });
    }

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
Projects
None yet
Development

No branches or pull requests

1 participant