Commit 4c8e863 1 parent 3885a30 commit 4c8e863 Copy full SHA for 4c8e863
File tree 1 file changed +25
-0
lines changed
1 file changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -2050,6 +2050,31 @@ mod tests {
2050
2050
}
2051
2051
}
2052
2052
2053
+ #[ test]
2054
+ fn duplicate_add_attribute ( ) {
2055
+ let _log = crate :: tests:: test_init_log ( ) ;
2056
+ let mut msg = Message :: builder_request ( BINDING ) ;
2057
+ let software = Software :: new ( "s" ) . unwrap ( ) ;
2058
+ msg. add_attribute ( & software) . unwrap ( ) ;
2059
+ assert ! ( matches!(
2060
+ msg. add_attribute( & software) ,
2061
+ Err ( StunWriteError :: AttributeExists ( ty) ) if ty == Software :: TYPE
2062
+ ) ) ;
2063
+ }
2064
+
2065
+ #[ test]
2066
+ fn duplicate_add_raw_attribute ( ) {
2067
+ let _log = crate :: tests:: test_init_log ( ) ;
2068
+ let mut msg = Message :: builder_request ( BINDING ) ;
2069
+ let software = Software :: new ( "s" ) . unwrap ( ) ;
2070
+ let raw = software. to_raw ( ) ;
2071
+ msg. add_raw_attribute ( raw. clone ( ) ) . unwrap ( ) ;
2072
+ assert ! ( matches!(
2073
+ msg. add_raw_attribute( raw) ,
2074
+ Err ( StunWriteError :: AttributeExists ( ty) ) if ty == Software :: TYPE
2075
+ ) ) ;
2076
+ }
2077
+
2053
2078
#[ test]
2054
2079
fn duplicate_fingerprint ( ) {
2055
2080
let _log = crate :: tests:: test_init_log ( ) ;
You can’t perform that action at this time.
0 commit comments