@@ -22,7 +22,7 @@ pub struct Input {
2222}
2323
2424/// A representation of the module with all its metadata and the generated AsciiDoc content
25- #[ derive( Debug ) ]
25+ #[ derive( Debug , PartialEq ) ]
2626pub struct Module {
2727 mod_type : ModuleType ,
2828 title : String ,
@@ -303,16 +303,21 @@ impl Module {
303303mod tests {
304304 use crate :: module:: Module ;
305305 use crate :: module:: ModuleType ;
306+ use crate :: module:: Input ;
306307 use crate :: Options ;
307308
308- #[ test]
309- fn check_basic_assembly_fields ( ) {
310- let options = Options {
309+ fn basic_options ( ) -> Options {
310+ Options {
311311 comments : false ,
312312 prefixes : true ,
313313 target_dir : "." . to_string ( ) ,
314314 detect_directory : false ,
315- } ;
315+ }
316+ }
317+
318+ #[ test]
319+ fn check_basic_assembly_fields ( ) {
320+ let options = basic_options ( ) ;
316321 let assembly = Module :: new ( ModuleType :: Assembly , "A testing assembly with /special-characters*" , & options) ;
317322
318323 assert_eq ! ( assembly. mod_type, ModuleType :: Assembly ) ;
@@ -322,4 +327,12 @@ mod tests {
322327 assert_eq ! ( assembly. include_statement, "include::<path>/assembly_a-testing-assembly-with-special-characters.adoc[leveloffset=+1]" ) ;
323328 assert_eq ! ( assembly. includes, None ) ;
324329 }
330+
331+ #[ test]
332+ fn check_module_builder_and_new ( ) {
333+ let options = basic_options ( ) ;
334+ let from_new: Module = Module :: new ( ModuleType :: Assembly , "A testing assembly with /special-characters*" , & options) ;
335+ let from_builder: Module = Input :: new ( ModuleType :: Assembly , "A testing assembly with /special-characters*" , & options) . into ( ) ;
336+ assert_eq ! ( from_new, from_builder) ;
337+ }
325338}
0 commit comments