Skip to content

Instantly share code, notes, and snippets.

@colin-kiegel
Created August 9, 2016 19:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save colin-kiegel/ea4f13db5b14374c68ed345a2224f990 to your computer and use it in GitHub Desktop.
Save colin-kiegel/ea4f13db5b14374c68ed345a2224f990 to your computer and use it in GitHub Desktop.
cargo test -- with arrays of multiple dependency versions
#!/bin/bash
# This script will loop over arrays of dev-dependencies
#
# - loops can be nested (not nice but efficient)
# - http://doc.crates.io/specifying-dependencies.html
CUSTOM_DERIVE_VERSIONS=(
"=0.1.0"
"0.1"
)
function main {
for v_custom_derive in "${CUSTOM_DERIVE_VERSIONS[@]}"; do
dev_dependency custom_derive@${v_custom_derive}
# nest loops here
run_test
# ..
done
}
function dev_dependency {
echo "II: Setting dev-dependency for $1"
cargo add $1 --dev
}
function run_test {
cargo update # otherwise cargo ignores changed dependencies
cargo test
}
main
@colin-kiegel
Copy link
Author

This work is licensed under CC0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment