Struct Config

Source
pub struct Config { /* private fields */ }
Expand description

Configuration for FluentTest’s output and behavior

Implementations§

Source§

impl Config

Source

pub fn new() -> Self

Creates a new configuration with default settings

Source

pub fn use_colors(self, enable: bool) -> Self

Enable or disable colored output

Source

pub fn use_unicode_symbols(self, enable: bool) -> Self

Enable or disable Unicode symbols

Source

pub fn show_success_details(self, enable: bool) -> Self

Control whether to show details for successful tests

Source

pub fn enhanced_output(self, enable: bool) -> Self

Enable or disable enhanced output (fluent assertions)

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}
Source

pub fn apply(self)

Apply the 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}

Trait Implementations§

Source§

impl Clone for Config

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Default for Config

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.