config

Function config 

Source
pub fn config() -> Config
Expand description

Creates a new test configuration

Examples found in repository?
examples/attribute_fixtures.rs (line 57)
55fn main() {
56    // Enable enhanced output for better test reporting
57    config().enhanced_output(true).apply();
58
59    println!("Running test with attribute-style fixtures:");
60    test_module::run_test();
61
62    println!("\nTest passed!");
63}
More examples
Hide additional examples
examples/module_fixtures.rs (line 73)
71fn main() {
72    // Enable enhanced output for better test reporting
73    config().enhanced_output(true).apply();
74
75    // Explain the module fixture concept
76    setup_module_fixtures();
77
78    // Run a simulated test
79    run_simulated_test();
80
81    println!("\nAll tests passed!");
82}
examples/fixtures_example.rs (line 93)
91fn main() {
92    // Enable enhanced output for better test reporting
93    config().enhanced_output(true).apply();
94
95    println!("Running first test with fixtures:");
96    test1::run_test();
97
98    println!("\nRunning second test with fixtures:");
99    test2::run_test();
100
101    println!("\nBoth tests passed!");
102}
examples/module_lifecycle.rs (line 189)
187fn main() {
188    // Enable enhanced output for better test reporting
189    config().enhanced_output(true).apply();
190
191    // Run the simulated tests
192    run_simulated_tests();
193
194    // Notes about how after_all works in real tests
195    println!("\nNOTE: In real tests with cargo test:");
196    println!("- #[before_all] will run once before any test in the module");
197    println!("- #[after_all] will run at process exit");
198    println!("\nAll tests passed!");
199}
examples/basic.rs (line 5)
3fn main() {
4    // Enable enhanced output for this example
5    config().enhanced_output(true).apply();
6
7    // Just to demonstrate the API
8    let x = 42;
9    let name = "Arthur";
10
11    // Integer tests - direct and by reference
12    expect!(x).to_be_greater_than(30);
13    expect!(x).to_be_less_than(50);
14    expect!(x).to_be_even();
15
16    // Create a reference to demonstrate the & removal in output
17    let x_ref = &x;
18    expect!(x_ref).to_equal(&42);
19
20    // String tests - direct and by reference
21    expect!(name).to_contain("th");
22    expect!(name).to_have_length(6);
23
24    // Create a reference to demonstrate the & removal in output
25    let name_ref = &name;
26    let arthur = "Arthur";
27    expect!(name_ref).to_equal(&arthur);
28
29    // Report test results
30    fluent_test::Reporter::summarize();
31}
examples/config_example.rs (line 48)
44fn enhanced_mode_example() {
45    println!("  Enabling enhanced output...");
46
47    // Apply configuration with enhanced output enabled
48    config().enhanced_output(true).apply();
49
50    // Simply describe the enhanced output without running another process
51    println!("  ✅ Enhanced error: value is not greater than 100");
52    println!("  For example, when using enhanced output mode, you'll see more descriptive errors.");
53
54    // Show descriptions of assertions that work with enhanced output
55    println!("\n  With enhanced output enabled, you get better error messages.");
56    println!("  For example:");
57    println!("  • expect!(42).to_be_greater_than(100)  → '42 is not greater than 100'");
58    println!("  • expect!(vec).to_contain(item)        → 'vec does not contain item'");
59    println!("  • expect!(value).to_be_some()          → 'value is not Some'");
60
61    println!("\n  Note: Enhanced output provides more descriptive messages");
62    println!("        that improve the developer experience during debugging.");
63}