use fluent_test::prelude::*;
fn main() {
println!("FluentTest Configuration Example\n");
println!("1. Standard behavior (no enhanced output):");
standard_mode_example();
println!("\n2. With enhanced output enabled:");
enhanced_mode_example();
println!("\nFor more examples of enhanced output, run:");
println!(" cargo run --example enhanced_output");
println!("\nYou can also enable enhanced output with environment variable:");
println!(" FLUENT_TEST_ENHANCED_OUTPUT=true cargo run --example config_example");
}
fn standard_mode_example() {
let result = std::panic::catch_unwind(|| {
expect!(2 + 2).to_equal(5); });
match result {
Ok(_) => println!(" ❌ Test unexpectedly passed"),
Err(e) => {
if let Some(s) = e.downcast_ref::<String>() {
println!(" ✅ Standard error: {}", s);
} else {
println!(" ✅ Test failed with standard panic");
}
}
}
}
fn enhanced_mode_example() {
println!(" Enabling enhanced output...");
config().enhanced_output(true).apply();
println!(" ✅ Enhanced error: value is not greater than 100");
println!(" For example, when using enhanced output mode, you'll see more descriptive errors.");
println!("\n With enhanced output enabled, you get better error messages.");
println!(" For example:");
println!(" • expect!(42).to_be_greater_than(100) → '42 is not greater than 100'");
println!(" • expect!(vec).to_contain(item) → 'vec does not contain item'");
println!(" • expect!(value).to_be_some() → 'value is not Some'");
println!("\n Note: Enhanced output provides more descriptive messages");
println!(" that improve the developer experience during debugging.");
}