You can search the crate on crates.io and look at code on github.com.
Currently work in progress but I would like to hear your feedback. In future I'm planning to add documentation and more matchers.
Some issues I would like to discuss:
- I don't like how looks code for 'be_empty' matcher. I can add
EmptyCollection
trait with is_empty_collection
method and create Matcher
with this but it seems to me not good solution either.
- I came across an unexpected behaviour of some tests in
tests/empty.rs
file, I've marked them as #[ignore]
. On my machine they fail with error:
Process didn't exit successfully: `/Users/zummenix/projects/expectest/target/debug/empty-79c4267514e27720 --ignored` (signal: 4)
I don't know is it rust bug or I'm missing something. My setup:
rustc 1.1.0-nightly (c4b23aec4 2015-04-29) (built 2015-04-28)
cargo 0.2.0-nightly (dac600c 2015-04-22) (built 2015-04-25)
Some update on issue #2:
I've updated rust:
rustc 1.1.0-nightly (c42c1e7a6 2015-05-02) (built 2015-05-01)
lldb output before crash if it helps:
(lldb) n
Process 25941 stopped
* thread #2: tid = 0x1e7ea4, 0x000000010005c281 empty-408e3f8937f844d5`rust_panic + 257, name = 'emptiness_of_string_should_panic', stop reason = instruction step over
frame #0: 0x000000010005c281 empty-408e3f8937f844d5`rust_panic + 257
empty-408e3f8937f844d5`rust_panic:
-> 0x10005c281 <+257>: callq 0x1000816c0 ; symbol stub for: _Unwind_RaiseException
0x10005c286 <+262>: movl %eax, %eax
0x10005c288 <+264>: movq %rax, -0xa0(%rbp)
0x10005c28f <+271>: leaq 0x221fa(%rip), %rax ; fmt::num::isize.fmt..Display::fmt::h9bc7182a44425f0cPgI
(lldb) n
Process 25941 stopped
* thread #2: tid = 0x1e7ea4, 0x0000000100068a36 empty-408e3f8937f844d5`je_arena_dalloc_bin_locked [inlined] je_bitmap_unset(bit=0) + 71 at bitmap.h:215, name = 'emptiness_of_string_should_panic', stop reason = EXC_BAD_ACCESS (code=EXC_I386_GPFLT)
frame #0: 0x0000000100068a36 empty-408e3f8937f844d5`je_arena_dalloc_bin_locked [inlined] je_bitmap_unset(bit=0) + 71 at bitmap.h:215
(lldb)
If I change code in test from:
expect("s".to_string()).to(be_empty());
to:
let e = be_empty();
expect("s".to_string()).to(e);
test passes.
Probably I should file an issue to github.
Fortunately I came up with small example that reproduce this problem, filled the issue:
https://github.com/rust-lang/rust/issues/25089