-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
former : introduce subform_scalar ready
- Loading branch information
Showing
28 changed files
with
134 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
...sts/only_test/subformer_scalar_subform.rs → .../former_tests/only_test/subform_scalar.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
|
||
#[ test ] | ||
fn child() | ||
fn subforme_scalar() | ||
{ | ||
|
||
let got = Parent::former() | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
73 changes: 73 additions & 0 deletions
73
module/core/former/tests/inc/former_tests/subform_scalar_name.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
#![ allow( dead_code ) ] | ||
|
||
use super::*; | ||
|
||
/// Child | ||
#[ derive( Debug, Default, PartialEq, the_module::Former ) ] | ||
pub struct Child | ||
{ | ||
name : String, | ||
data : bool, | ||
} | ||
|
||
/// Parent | ||
#[ derive( Debug, Default, PartialEq, the_module::Former ) ] | ||
// #[ debug ] | ||
// #[ derive( Debug, Default, PartialEq ) ] | ||
pub struct Parent | ||
{ | ||
#[ subform_scalar( name = child2 ) ] | ||
child : Child, | ||
} | ||
|
||
impl< Definition > ParentFormer< Definition > | ||
where | ||
Definition : former::FormerDefinition< Storage = < Parent as former::EntityToStorage >::Storage >, | ||
{ | ||
|
||
pub fn child() | ||
{ | ||
} | ||
|
||
#[ inline( always ) ] | ||
pub fn child3( self ) -> | ||
ChildAsSubformer< Self, impl ChildAsSubformerEnd< Self > > | ||
{ | ||
self._child_subform_scalar | ||
::< < Child as former::EntityToFormer< _ > >::Former, _, >() | ||
} | ||
|
||
} | ||
|
||
// == begin of generated | ||
|
||
// == end of generated | ||
|
||
#[ test ] | ||
fn subforme_scalar_2() | ||
{ | ||
|
||
let got = Parent::former() | ||
.child2().name( "a" ).data( true ).end() | ||
.form(); | ||
|
||
let exp = Parent { child : Child { name : "a".to_string(), data : true } }; | ||
a_id!( got, exp ); | ||
|
||
} | ||
|
||
#[ test ] | ||
fn subforme_scalar_3() | ||
{ | ||
|
||
let got = Parent::former() | ||
.child3().name( "a" ).data( true ).end() | ||
.form(); | ||
|
||
let exp = Parent { child : Child { name : "a".to_string(), data : true } }; | ||
a_id!( got, exp ); | ||
|
||
} | ||
|
||
// qqq : write tests similar to `subform_all` which apply attributes `scalar`, `subform_entry` and `subform_scalar` on the same field and check all three attribtues don't interfere with each other |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters