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

Fix MSRV build and tests #66

Merged
merged 2 commits into from
Feb 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,10 @@ Use the `all-languages` feature to enable all languages.

This crate supports Rust v1.41.1 and up and works with `no_std`.

When using older version of Rust, you might have to pin the version of the
`bitcoin_hashes` crate used as such:
```
$ cargo update --package "bitcoin_hashes" --precise "0.12.0"
```

If you enable the `zeroize` feature the MSRV becomes 1.51.
21 changes: 18 additions & 3 deletions contrib/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@

set -ex

FEATURES="serde rand zeroize all-languages chinese-simplified chinese-traditional czech french italian japanese korean portuguese spanish"
FEATURES="serde rand all-languages chinese-simplified chinese-traditional czech french italian japanese korean portuguese spanish"

cargo --version
rustc --version

# Pin dependencies as required if we are using MSRV toolchain.
# if cargo --version | grep "1\.41"; then
# fi
if cargo --version | grep "1\.41"; then
cargo update --package "bitcoin_hashes" --precise "0.12.0"
fi

echo "********* Testing std *************"
# Test without any features other than std first
Expand All @@ -19,6 +20,16 @@ echo "********* Testing default *************"
# Then test with the default features
cargo test --verbose

# Build specific features
for feature in ${FEATURES}
do
cargo build --verbose --features="$feature" --no-default-features
done

if cargo --version | grep -v "1\.41"; then
cargo build --verbose --features="zeroize" --no-default-features
fi

if [ "$DO_NO_STD" = true ]
then
echo "********* Testing no-std build *************"
Expand All @@ -38,6 +49,10 @@ then
do
cargo build --verbose --features="$feature" --no-default-features
done

if cargo --version | grep -v "1\.41"; then
cargo build --verbose --features="zeroize" --no-default-features
fi
fi

# Test each feature
Expand Down
4 changes: 2 additions & 2 deletions src/language/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -337,10 +337,10 @@ mod tests {
Language::Korean,
];

for lang in languages {
for lang in languages.iter() {
let mut list = lang.word_list().to_vec();
list.sort();
assert_eq!(list, lang.word_list());
assert_eq!(&list[..], &lang.word_list()[..]);
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -899,7 +899,7 @@ mod tests {
);
assert_eq!(&entropy, &mnemonic.to_entropy(), "failed vector: {}", mnemonic_str);
assert_eq!(
&entropy,
&entropy[..],
&mnemonic.to_entropy_array().0[0..entropy.len()],
"failed vector: {}",
mnemonic_str
Expand Down
Loading