Skip to content

Commit

Permalink
Merge pull request #1335 from YBoy-git/former_fix_tests
Browse files Browse the repository at this point in the history
READY : (former) : Fix former tests
  • Loading branch information
Wandalen authored May 14, 2024
2 parents a3a2a52 + 71147de commit 42716ac
Show file tree
Hide file tree
Showing 14 changed files with 57 additions and 55 deletions.
28 changes: 14 additions & 14 deletions module/core/former/Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -677,10 +677,10 @@ These setters ensure that developers can precisely and efficiently set propertie
This example demonstrates how to employ the `Former` trait to configure a `Vec` using a collection setter in a structured manner.

```rust
# #[ cfg( not( all( feature = "enabled", feature = "derive_former", not( feature = "no_std" ) ) ) ) ]
# #[ cfg( not( all( feature = "enabled", feature = "derive_former", any( feature = "use_alloc", not( feature = "no_std" ) ) ) ) ) ]
# fn main() {}

# #[ cfg( all( feature = "enabled", feature = "derive_former", not( feature = "no_std" ) ) ) ]
# #[ cfg( all( feature = "enabled", feature = "derive_former", any( feature = "use_alloc", not( feature = "no_std" ) ) ) ) ]
# fn main()
# {

Expand Down Expand Up @@ -713,10 +713,10 @@ Try out `cargo run --example former_collection_vector`.
This example demonstrates how to effectively employ the `Former` trait to configure a `HashMap` using a collection setter.

```rust
# #[ cfg( not( all( feature = "enabled", feature = "derive_former", not( feature = "no_std" ) ) ) ) ]
# #[ cfg( not( all( feature = "enabled", feature = "derive_former", any( feature = "use_alloc", not( feature = "no_std" ) ) ) ) ) ]
# fn main() {}

# #[ cfg( all( feature = "enabled", feature = "derive_former", not( feature = "no_std" ) ) ) ]
# #[ cfg( all( feature = "enabled", feature = "derive_former", any( feature = "use_alloc", not( feature = "no_std" ) ) ) ) ]
# fn main()
# {
use collection_tools::{ HashMap, hmap };
Expand Down Expand Up @@ -750,10 +750,10 @@ Try out `cargo run --example former_collection_hashmap`.
This example demonstrates the use of the `Former` trait to build a `collection_tools::HashSet` through subforming.

```rust
# #[ cfg( not( all( feature = "enabled", feature = "derive_former", not( feature = "no_std" ) ) ) ) ]
# #[ cfg( not( all( feature = "enabled", feature = "derive_former", any( feature = "use_alloc", not( feature = "no_std" ) ) ) ) ) ]
# fn main() {}

# #[ cfg( all( feature = "enabled", feature = "derive_former", not( feature = "no_std" ) ) ) ]
# #[ cfg( all( feature = "enabled", feature = "derive_former", any( feature = "use_alloc", not( feature = "no_std" ) ) ) ) ]
# fn main()
{
use collection_tools::{ HashSet, hset };
Expand Down Expand Up @@ -789,10 +789,10 @@ This example demonstrates the implementation of a scalar setter using the `Forme
The `child` function within `ParentFormer` is a custom subform setter that plays a crucial role. It uniquely employs the `ChildFormer` to add and configure children by their names within the parent's builder pattern. This method demonstrates a powerful technique for integrating subformers that manage specific elements of a collection—each child entity in this case.

```rust
# #[ cfg( not( all( feature = "enabled", feature = "derive_former", not( feature = "no_std" ) ) ) ) ]
# #[ cfg( not( all( feature = "enabled", feature = "derive_former", any( feature = "use_alloc", not( feature = "no_std" ) ) ) ) ) ]
# fn main() {}

# #[ cfg( all( feature = "enabled", feature = "derive_former", not( feature = "no_std" ) ) ) ]
# #[ cfg( all( feature = "enabled", feature = "derive_former", any( feature = "use_alloc", not( feature = "no_std" ) ) ) ) ]
# fn main()
# {
use collection_tools::HashMap;
Expand Down Expand Up @@ -878,12 +878,12 @@ their own formers, allowing for detailed configuration within a nested builder p

```rust

# #[ cfg( not( all( feature = "enabled", feature = "derive_former", not( feature = "no_std" ) ) ) ) ]
# #[ cfg( not( all( feature = "enabled", feature = "derive_former", any( feature = "use_alloc", not( feature = "no_std" ) ) ) ) ) ]
# fn main()
# {}
#
# // Ensures the example only compiles when the appropriate features are enabled.
# #[ cfg( all( feature = "enabled", feature = "derive_former", not( feature = "no_std" ) ) ) ]
# #[ cfg( all( feature = "enabled", feature = "derive_former", any( feature = "use_alloc", not( feature = "no_std" ) ) ) ) ]
# fn main()
# {

Expand Down Expand Up @@ -950,11 +950,11 @@ This example demonstrates the use of collection setters to manage complex nested
The `child` function within `ParentFormer` is a custom subform setter that plays a crucial role. It uniquely employs the `ChildFormer` to add and configure children by their names within the parent's builder pattern. This method demonstrates a powerful technique for integrating subformers that manage specific elements of a collection—each child entity in this case.

```rust
# #[ cfg( not( all( feature = "enabled", feature = "derive_former", not( feature = "no_std" ) ) ) ) ]
# #[ cfg( not( all( feature = "enabled", feature = "derive_former", any( feature = "use_alloc", not( feature = "no_std" ) ) ) ) ) ]
# fn main() {}

// Ensure the example only compiles when the appropriate features are enabled.
# #[ cfg( all( feature = "enabled", feature = "derive_former", not( feature = "no_std" ) ) ) ]
# #[ cfg( all( feature = "enabled", feature = "derive_former", any( feature = "use_alloc", not( feature = "no_std" ) ) ) ) ]
# fn main()
# {
use collection_tools::HashMap;
Expand Down Expand Up @@ -1031,11 +1031,11 @@ This example illustrates the implementation of nested builder patterns using the
The `child` function within `ParentFormer` is a custom subform setter that plays a crucial role. It uniquely employs the `ChildFormer` to add and configure children by their names within the parent's builder pattern. This method demonstrates a powerful technique for integrating subformers that manage specific elements of a collection—each child entity in this case.

```rust
# #[ cfg( not( all( feature = "enabled", feature = "derive_former", not( feature = "no_std" ) ) ) ) ]
# #[ cfg( not( all( feature = "enabled", feature = "derive_former", any( feature = "use_alloc", not( feature = "no_std" ) ) ) ) ) ]
# fn main() {}

# // Ensure the example only compiles when the appropriate features are enabled.
# #[ cfg( all( feature = "enabled", feature = "derive_former", not( feature = "no_std" ) ) ) ]
# #[ cfg( all( feature = "enabled", feature = "derive_former", any( feature = "use_alloc", not( feature = "no_std" ) ) ) ) ]
# fn main()
# {
use collection_tools::HashMap;
Expand Down
4 changes: 2 additions & 2 deletions module/core/former/examples/former_collection_hashmap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
//! This example demonstrates how to effectively employ the `Former` trait to configure a `HashMap` using a collection setter.
//!
#[ cfg( not( all( feature = "enabled", feature = "derive_former", not( feature = "no_std" ) ) ) ) ]
#[ cfg( not( all( feature = "enabled", feature = "derive_former", any( feature = "use_alloc", not( feature = "no_std" ) ) ) ) ) ]
fn main() {}
#[ cfg( all( feature = "enabled", feature = "derive_former", not( feature = "no_std" ) ) ) ]
#[ cfg( all( feature = "enabled", feature = "derive_former", any( feature = "use_alloc", not( feature = "no_std" ) ) ) ) ]
fn main()
{
use collection_tools::{ HashMap, hmap };
Expand Down
4 changes: 2 additions & 2 deletions module/core/former/examples/former_collection_hashset.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
//! This example demonstrates the use of the `Former` trait to build a `collection_tools::HashSet` through subforming.
//!
#[ cfg( not( all( feature = "enabled", feature = "derive_former", not( feature = "no_std" ) ) ) ) ]
#[ cfg( not( all( feature = "enabled", feature = "derive_former", any( feature = "use_alloc", not( feature = "no_std" ) ) ) ) ) ]
fn main() {}
#[ cfg( all( feature = "enabled", feature = "derive_former", not( feature = "no_std" ) ) ) ]
#[ cfg( all( feature = "enabled", feature = "derive_former", any( feature = "use_alloc", not( feature = "no_std" ) ) ) ) ]
fn main()
{
use collection_tools::{ HashSet, hset };
Expand Down
4 changes: 2 additions & 2 deletions module/core/former/examples/former_collection_vector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
//! This example demonstrates how to employ the `Former` trait to configure a `Vec` using a collection setter in a structured manner.
//!
#[ cfg( not( all( feature = "enabled", feature = "derive_former", not( feature = "no_std" ) ) ) ) ]
#[ cfg( not( all( feature = "enabled", feature = "derive_former", any( feature = "use_alloc", not( feature = "no_std" ) ) ) ) ) ]
fn main() {}
#[ cfg( all( feature = "enabled", feature = "derive_former", not( feature = "no_std" ) ) ) ]
#[ cfg( all( feature = "enabled", feature = "derive_former", any( feature = "use_alloc", not( feature = "no_std" ) ) ) ) ]
fn main()
{

Expand Down
4 changes: 2 additions & 2 deletions module/core/former/examples/former_component_from.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@
//! - `debug` : Optional attribute to enable debug-level output during the macro expansion process.
//!
#[ cfg( not( feature = "derive_component_from" ) ) ]
#[ cfg( not( all( feature = "enabled", feature = "derive_component_from" ) ) ) ]
fn main() {}

#[ cfg( feature = "derive_component_from" ) ]
#[ cfg( all( feature = "enabled", feature = "derive_component_from" ) ) ]
fn main()
{

Expand Down
1 change: 1 addition & 0 deletions module/core/former/examples/former_custom_collection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
//! by logging each addition. This example illustrates how to integrate such custom collections with the
//! Former trait system for use in structured data types.
// qqq : replace !no_std with !no_std || use_alloc when collection_tools reexports iterators
#[ cfg( not( all( feature = "enabled", feature = "derive_former", not( feature = "no_std" ) ) ) ) ]
fn main() {}
#[ cfg( all( feature = "enabled", feature = "derive_former", not( feature = "no_std" ) ) ) ]
Expand Down
4 changes: 2 additions & 2 deletions module/core/former/examples/former_custom_scalar_setter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@
//! These setters ensure that developers can precisely and efficiently set properties, manage collections, and configure complex structures within their applications.
//!
#[ cfg( not( all( feature = "enabled", feature = "derive_former", not( feature = "no_std" ) ) ) ) ]
#[ cfg( not( all( feature = "enabled", feature = "derive_former", any( feature = "use_alloc", not( feature = "no_std" ) ) ) ) ) ]
fn main() {}

// Ensure the example only compiles when the appropriate features are enabled.
#[ cfg( all( feature = "enabled", feature = "derive_former", not( feature = "no_std" ) ) ) ]
#[ cfg( all( feature = "enabled", feature = "derive_former", any( feature = "use_alloc", not( feature = "no_std" ) ) ) ) ]
fn main()
{
use collection_tools::HashMap;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@
//!
// Ensure the example only compiles when the appropriate features are enabled.
#[ cfg( not( all( feature = "enabled", feature = "derive_former", not( feature = "no_std" ) ) ) ) ]
#[ cfg( not( all( feature = "enabled", feature = "derive_former", any( feature = "use_alloc", not( feature = "no_std" ) ) ) ) ) ]
fn main() {}
#[ cfg( all( feature = "enabled", feature = "derive_former", not( feature = "no_std" ) ) ) ]
#[ cfg( all( feature = "enabled", feature = "derive_former", any( feature = "use_alloc", not( feature = "no_std" ) ) ) ) ]
fn main()
{
use collection_tools::HashMap;
Expand Down
4 changes: 2 additions & 2 deletions module/core/former/examples/former_custom_subform_entry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@
//! These setters ensure that developers can precisely and efficiently set properties, manage collections, and configure complex structures within their applications.
//!
#[ cfg( not( all( feature = "enabled", feature = "derive_former", not( feature = "no_std" ) ) ) ) ]
#[ cfg( not( all( feature = "enabled", feature = "derive_former", any( feature = "use_alloc", not( feature = "no_std" ) ) ) ) ) ]
fn main() {}

// Ensure the example only compiles when the appropriate features are enabled.
#[ cfg( all( feature = "enabled", feature = "derive_former", not( feature = "no_std" ) ) ) ]
#[ cfg( all( feature = "enabled", feature = "derive_former", any( feature = "use_alloc", not( feature = "no_std" ) ) ) ) ]
fn main()
{
use collection_tools::HashMap;
Expand Down
4 changes: 2 additions & 2 deletions module/core/former/examples/former_custom_subform_entry2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@
//!
// Ensure the example only compiles when the appropriate features are enabled.
#[ cfg( not( all( feature = "enabled", feature = "derive_former", not( feature = "no_std" ) ) ) ) ]
#[ cfg( not( all( feature = "enabled", feature = "derive_former", any( feature = "use_alloc", not( feature = "no_std" ) ) ) ) ) ]
fn main() {}
#[ cfg( all( feature = "enabled", feature = "derive_former", not( feature = "no_std" ) ) ) ]
#[ cfg( all( feature = "enabled", feature = "derive_former", any( feature = "use_alloc", not( feature = "no_std" ) ) ) ) ]
fn main()
{
use collection_tools::HashMap;
Expand Down
4 changes: 2 additions & 2 deletions module/core/former/examples/former_custom_subform_scalar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@
//!

#[ cfg( not( all( feature = "enabled", feature = "derive_former", not( feature = "no_std" ) ) ) ) ]
#[ cfg( not( all( feature = "enabled", feature = "derive_former", any( feature = "use_alloc",not( feature = "no_std" ) ) ) ) ) ]
fn main()
{}

// Ensures the example only compiles when the appropriate features are enabled.
#[ cfg( all( feature = "enabled", feature = "derive_former", not( feature = "no_std" ) ) ) ]
#[ cfg( all( feature = "enabled", feature = "derive_former", any( feature = "use_alloc",not( feature = "no_std" ) ) ) ) ]
fn main()
{
use former::Former;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use super::*;
use collection_tools::HashMap;

// qqq : zzz : remove #[ cfg( not( feature = "use_alloc" ) ) ]
#[ cfg( not( feature = "use_alloc" ) ) ]
// #[ cfg( not( feature = "use_alloc" ) ) ]
#[ test ]
fn add()
{
Expand Down
44 changes: 22 additions & 22 deletions module/core/former/tests/inc/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ mod former_tests
mod a_primitives;

mod subform_collection_basic_scalar;
#[ cfg( not( feature = "no_std" ) ) ]
#[ cfg( any( feature = "use_alloc", not( feature = "no_std" ) ) ) ]
mod subform_collection_basic_manual;
#[ cfg( not( feature = "no_std" ) ) ]
#[ cfg( any( feature = "use_alloc", not( feature = "no_std" ) ) ) ]
mod subform_collection_basic;

// = attribute
Expand Down Expand Up @@ -81,55 +81,55 @@ mod former_tests

#[ cfg( any( not( feature = "no_std" ), feature = "use_alloc" ) ) ]
mod subform_collection_playground;
#[ cfg( any( not( feature = "no_std" ) ) ) ]
#[ cfg( any( not( feature = "no_std" ), feature = "use_alloc" ) ) ]
mod subform_collection;
#[ cfg( any( not( feature = "no_std" ) ) ) ]
#[ cfg( any( not( feature = "no_std" ), feature = "use_alloc" ) ) ]
mod subform_collection_manual;
#[ cfg( any( not( feature = "no_std" ) ) ) ]
#[ cfg( any( not( feature = "no_std" ), feature = "use_alloc" ) ) ]
mod subform_collection_implicit;
#[ cfg( any( not( feature = "no_std" ) ) ) ]
#[ cfg( any( not( feature = "no_std" ), feature = "use_alloc" ) ) ]
mod subform_collection_setter_off;
#[ cfg( any( not( feature = "no_std" ) ) ) ]
#[ cfg( any( not( feature = "no_std" ), feature = "use_alloc" ) ) ]
mod subform_collection_named;
#[ cfg( any( not( feature = "no_std" ) ) ) ]
#[ cfg( any( not( feature = "no_std" ), feature = "use_alloc" ) ) ]
mod subform_collection_custom;

// = subform scalar

#[ cfg( any( not( feature = "no_std" ) ) ) ]
#[ cfg( any( not( feature = "no_std" ), feature = "use_alloc" ) ) ]
mod subform_scalar_manual;
#[ cfg( any( not( feature = "no_std" ) ) ) ]
#[ cfg( any( not( feature = "no_std" ), feature = "use_alloc" ) ) ]
mod subform_scalar;
#[ cfg( any( not( feature = "no_std" ) ) ) ]
#[ cfg( any( not( feature = "no_std" ), feature = "use_alloc" ) ) ]
mod subform_scalar_name;

// = subform entry

#[ cfg( any( not( feature = "no_std" ) ) ) ]
#[ cfg( any( not( feature = "no_std" ), feature = "use_alloc" ) ) ]
mod subform_entry;
#[ cfg( any( not( feature = "no_std" ) ) ) ]
#[ cfg( any( not( feature = "no_std" ), feature = "use_alloc" ) ) ]
mod subform_entry_manual;
#[ cfg( any( not( feature = "no_std" ) ) ) ]
#[ cfg( any( not( feature = "no_std" ), feature = "use_alloc" ) ) ]
mod subform_entry_named;
#[ cfg( any( not( feature = "no_std" ) ) ) ]
#[ cfg( any( not( feature = "no_std" ), feature = "use_alloc" ) ) ]
mod subform_entry_named_manual;
#[ cfg( any( not( feature = "no_std" ) ) ) ]
#[ cfg( any( not( feature = "no_std" ), feature = "use_alloc" ) ) ]
mod subform_entry_setter_off;
#[ cfg( any( not( feature = "no_std" ) ) ) ]
#[ cfg( any( not( feature = "no_std" ), feature = "use_alloc" ) ) ]
mod subform_entry_setter_on;

#[ cfg( any( not( feature = "no_std" ) ) ) ]
#[ cfg( any( not( feature = "no_std" ), feature = "use_alloc" ) ) ]
mod subform_entry_hashmap;
#[ cfg( any( not( feature = "no_std" ) ) ) ]
#[ cfg( any( not( feature = "no_std" ), feature = "use_alloc" ) ) ]
mod subform_entry_hashmap_custom;

// = subform all : scalar, subform_scalar, subform_entry, subform_collection

#[ cfg( any( not( feature = "no_std" ) ) ) ]
#[ cfg( any( not( feature = "no_std" ), feature = "use_alloc" ) ) ]
mod subform_all;
#[ cfg( any( not( feature = "no_std" ) ) ) ]
#[ cfg( any( not( feature = "no_std" ), feature = "use_alloc" ) ) ]
mod subform_all_private;
#[ cfg( any( not( feature = "no_std" ) ) ) ]
#[ cfg( any( not( feature = "no_std" ), feature = "use_alloc" ) ) ]
mod subform_all_parametrized;

}
Expand Down
1 change: 1 addition & 0 deletions module/core/former/tests/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ use test_tools::exposed::*;
#[ allow( unused_imports ) ]
use former as the_module;

#[ cfg( enabled ) ]
mod inc;

0 comments on commit 42716ac

Please sign in to comment.