Skip to content

Commit fc3be95

Browse files
Merge pull request #355 from tzemanovic/tomas/fix-sm-logs
state-machine: fix logging by adding "std" feature
2 parents 7292965 + a6cd942 commit fc3be95

3 files changed

Lines changed: 20 additions & 3 deletions

File tree

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,5 @@
11
## Unreleased
2+
3+
### Bug Fixes
4+
5+
- Fixed logging of state machine transitions to be enabled when verbose config is >= 1. The "std" feature is added to proptest-state-machine as a default feature that allows to switch the logging off in non-std env.

proptest-state-machine/Cargo.toml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,18 @@ description = """
1313
State machine based testing support for proptest.
1414
"""
1515

16+
[features]
17+
default = ["std"]
18+
19+
# Enables the use of standard-library dependent features
20+
std = ["proptest/std"]
21+
1622
[dependencies]
17-
proptest = { version = "1.2.0", path = "../proptest" }
23+
proptest = { version = "1.2.0", path = "../proptest", default-features = true, features = [
24+
"fork",
25+
"timeout",
26+
"bit-set",
27+
] }
1828

1929
[dev-dependencies]
2030
message-io = "0.17.0"

proptest-state-machine/src/test_runner.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,12 @@ pub trait StateMachineTest {
7373
<Self::Reference as ReferenceStateMachine>::Transition,
7474
>,
7575
) {
76+
#[cfg(feature = "std")]
77+
use proptest::test_runner::INFO_LOG;
78+
7679
let trans_len = transitions.len();
7780
#[cfg(feature = "std")]
78-
if config.verbose >= super::INFO_LOG {
81+
if config.verbose >= INFO_LOG {
7982
eprintln!();
8083
eprintln!("Running a test case with {} transitions.", trans_len);
8184
}
@@ -89,7 +92,7 @@ pub trait StateMachineTest {
8992

9093
for (ix, transition) in transitions.into_iter().enumerate() {
9194
#[cfg(feature = "std")]
92-
if config.verbose >= super::INFO_LOG {
95+
if config.verbose >= INFO_LOG {
9396
eprintln!();
9497
eprintln!(
9598
"Applying transition {}/{}: {:?}",

0 commit comments

Comments
 (0)