File tree Expand file tree Collapse file tree 1 file changed +32
-0
lines changed Expand file tree Collapse file tree 1 file changed +32
-0
lines changed Original file line number Diff line number Diff line change @@ -76,6 +76,26 @@ impl ModuleBuilder<'_> {
76
76
}
77
77
}
78
78
79
+ /// Overrides module name.
80
+ ///
81
+ /// # Arguments
82
+ ///
83
+ /// * `name` - The name of the extension.
84
+ pub fn name ( mut self , name : impl Into < String > ) -> Self {
85
+ self . name = name. into ( ) ;
86
+ self
87
+ }
88
+
89
+ /// Overrides module version.
90
+ ///
91
+ /// # Arguments
92
+ ///
93
+ /// * `version` - The current version of the extension.
94
+ pub fn version ( mut self , version : impl Into < String > ) -> Self {
95
+ self . version = version. into ( ) ;
96
+ self
97
+ }
98
+
79
99
/// Sets the startup function for the extension.
80
100
///
81
101
/// # Arguments
@@ -373,6 +393,18 @@ mod tests {
373
393
assert ! ( builder. enums. is_empty( ) ) ;
374
394
}
375
395
396
+ #[ test]
397
+ fn test_name ( ) {
398
+ let builder = ModuleBuilder :: new ( "test" , "1.0" ) . name ( "new_test" ) ;
399
+ assert_eq ! ( builder. name, "new_test" ) ;
400
+ }
401
+
402
+ #[ test]
403
+ fn test_version ( ) {
404
+ let builder = ModuleBuilder :: new ( "test" , "1.0" ) . version ( "2.0" ) ;
405
+ assert_eq ! ( builder. version, "2.0" ) ;
406
+ }
407
+
376
408
#[ test]
377
409
fn test_startup_function ( ) {
378
410
let builder =
You can’t perform that action at this time.
0 commit comments