#[allow(clippy::used_underscore_binding, clippy::all, warnings)]
#[ allow( unused_imports ) ]
use super::*;
#[ allow( unused_imports ) ]
tests_impls!
{
fn api()
{
let command = Struct1::former().form();
a_id!( command.int_1, 0 );
a_id!( command.string_1, "".to_string() );
a_id!( command.int_optional_1, None );
a_id!( command.string_optional_1, None );
let command = Struct1::former().end();
a_id!( command.int_1, 0 );
a_id!( command.string_1, "".to_string() );
a_id!( command.int_optional_1, None );
a_id!( command.string_optional_1, None );
let command = Struct1::former().perform();
a_id!( command.int_1, 0 );
a_id!( command.string_1, "".to_string() );
a_id!( command.int_optional_1, None );
a_id!( command.string_optional_1, None );
let got = Struct1::former().preform();
let exp = Struct1::former().form();
a_id!( got, exp );
let got = Struct1Former
::< Struct1FormerDefinition< (), Struct1, _ > >
::new( | storage, _context | { former::StoragePreform::preform( storage ) } )
.int_1( 13 )
.form();
let exp = Struct1::former().int_1( 13 ).form();
a_id!( got, exp );
}
fn test_int()
{
let command = Struct1::former()
.int_1( 13 )
.form();
let expected = Struct1
{
int_1 : 13,
string_1 : "".to_string(),
int_optional_1 : None,
string_optional_1 : None,
};
a_id!( command, expected );
}
fn test_string()
{
let command = Struct1::former()
.string_1( "Abcd".to_string() )
.form();
let expected = Struct1
{
int_1 : 0,
string_1 : "Abcd".to_string(),
int_optional_1 : None,
string_optional_1 : None,
};
a_id!( command, expected );
let command = Struct1::former()
.string_1( "Abcd" )
.form();
let expected = Struct1
{
int_1 : 0,
string_1 : "Abcd".to_string(),
int_optional_1 : None,
string_optional_1 : None,
};
a_id!( command, expected );
}
fn test_optional_string()
{
let command = Struct1::former()
.string_optional_1( "dir1" )
.form();
let expected = Struct1
{
int_1 : 0,
string_1 : "".to_string(),
int_optional_1 : None,
string_optional_1 : Some( "dir1".to_string() ),
};
a_id!( command, expected );
let command = Struct1::former()
.form();
let expected = Struct1
{
int_1 : 0,
string_1 : "".to_string(),
int_optional_1 : None,
string_optional_1 : None,
};
a_id!( command, expected );
}
fn test_underscored_form()
{
let command = Struct1::former()
.int_1( 13 )
.form();
let expected = Struct1
{
int_1 : 13,
string_1 : "".to_string(),
int_optional_1 : None,
string_optional_1 : None,
};
a_id!( command, expected );
}
fn test_complex()
{
let command = Struct1::former()
.int_1( 13 )
.string_1( "Abcd".to_string() )
.string_optional_1( "dir1" )
.form();
let expected = Struct1
{
int_1 : 13,
string_1 : "Abcd".to_string(),
int_optional_1 : None,
string_optional_1 : Some( "dir1".to_string() ),
};
a_id!( command, expected );
#[ cfg( debug_assertions ) ]
println!( "Debugging enabled" );
#[ cfg( not( debug_assertions ) ) ]
println!( "Debugging disabled" );
}
}
tests_index!
{
api,
test_int,
test_string,
test_optional_string,
test_underscored_form,
test_complex,
}