Skip to content

Commit

Permalink
Merge pull request #66 from rust-bitcoin/fix-msrv
Browse files Browse the repository at this point in the history
Fix MSRV build and tests
  • Loading branch information
stevenroose committed Feb 9, 2024
2 parents 7f55439 + 28991bd commit a84eb00
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 6 deletions.
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

0 comments on commit a84eb00

Please sign in to comment.