Skip to content

Commit

Permalink
Merge pull request #34 from ParkMyCar/testing/miri
Browse files Browse the repository at this point in the history
testing: Add Miri to CI
  • Loading branch information
ParkMyCar authored Jan 3, 2022
2 parents a2f7dc7 + 7adbe96 commit 63dce00
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 0 deletions.
18 changes: 18 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,24 @@ jobs:
command: test
args: --all-features

miri:
name: cargo miri test
runs-on: ubuntu-latest
env:
# We reduce the number of "randomized runs" because Miri is quite slow
RANDOMIZED_RUNS: 1000
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: nightly
override: true
components: miri
- name: Run Miri
run: |
cargo miri test
example-serde:
name: example - serde
runs-on: ubuntu-latest
Expand Down
1 change: 1 addition & 0 deletions compact_str/src/repr/heap/arc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,7 @@ mod test {

proptest! {
#[test]
#[cfg_attr(miri, ignore)]
fn test_strings_roundtrip(word in rand_unicode()) {
let arc_str = ArcString::from(word.as_str());
prop_assert_eq!(&word, arc_str.as_str());
Expand Down
4 changes: 4 additions & 0 deletions compact_str/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,15 @@ fn rand_unicode_collection() -> impl Strategy<Value = Vec<String>> {

proptest! {
#[test]
#[cfg_attr(miri, ignore)]
fn test_strings_roundtrip(word in rand_unicode()) {
let compact = CompactStr::new(&word);
prop_assert_eq!(&word, &compact);
}


#[test]
#[cfg_attr(miri, ignore)]
fn test_strings_allocated_properly(word in rand_unicode()) {
let compact = CompactStr::new(&word);

Expand All @@ -42,12 +44,14 @@ proptest! {
}

#[test]
#[cfg_attr(miri, ignore)]
fn test_char_iterator_roundtrips(word in rand_unicode()) {
let compact: CompactStr = word.clone().chars().collect();
prop_assert_eq!(&word, &compact)
}

#[test]
#[cfg_attr(miri, ignore)]
fn test_string_iterator_roundtrips(collection in rand_unicode_collection()) {
let compact: CompactStr = collection.clone().into_iter().collect();
let word: String = collection.into_iter().collect();
Expand Down

0 comments on commit 63dce00

Please sign in to comment.