pub struct Config { /* private fields */ }
Expand description
Configuration for FluentTest’s output and behavior
Implementations§
Source§impl Config
impl Config
Sourcepub fn use_colors(self, enable: bool) -> Self
pub fn use_colors(self, enable: bool) -> Self
Enable or disable colored output
Sourcepub fn use_unicode_symbols(self, enable: bool) -> Self
pub fn use_unicode_symbols(self, enable: bool) -> Self
Enable or disable Unicode symbols
Sourcepub fn show_success_details(self, enable: bool) -> Self
pub fn show_success_details(self, enable: bool) -> Self
Control whether to show details for successful tests
Sourcepub fn enhanced_output(self, enable: bool) -> Self
pub fn enhanced_output(self, enable: bool) -> Self
Enable or disable enhanced output (fluent assertions)
Examples found in repository?
More 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}
Sourcepub fn apply(self)
pub fn apply(self)
Apply the configuration
Examples found in repository?
More 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}
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Config
impl RefUnwindSafe for Config
impl Send for Config
impl Sync for Config
impl Unpin for Config
impl UnwindSafe for Config
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more