Merge pull request #66 from rust-bitcoin/fix-msrv

Fix MSRV build and tests
This commit is contained in:
Steven Roose 2024-02-10 01:41:50 +07:00 committed by GitHub
commit a84eb0012e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 27 additions and 6 deletions

View File

@ -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.

View File

@ -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
@ -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 *************"
@ -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

View File

@ -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()[..]);
}
}

View File

@ -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