@@ -105,11 +105,36 @@ mod tests {
105
105
use super :: * ;
106
106
use crate :: format:: { ByteSequence , PositionType } ;
107
107
108
+ #[ test]
108
109
fn test_format_id ( ) {
109
110
let source_type = SourceType :: Custom ;
110
111
assert_eq ! ( source_type. format_id( 1 ) , "custom/1" ) ;
111
112
}
112
113
114
+ #[ test]
115
+ fn test_priority ( ) {
116
+ assert_eq ! ( SourceType :: Custom . priority( ) , 1 ) ;
117
+ assert_eq ! ( SourceType :: Default . priority( ) , 0 ) ;
118
+ assert_eq ! ( SourceType :: Httpd . priority( ) , 5 ) ;
119
+ assert_eq ! ( SourceType :: Linguist . priority( ) , 4 ) ;
120
+ assert_eq ! ( SourceType :: Pronom . priority( ) , 2 ) ;
121
+ assert_eq ! ( SourceType :: Wikidata . priority( ) , 3 ) ;
122
+ }
123
+
124
+ #[ test]
125
+ fn test_partial_cmp ( ) {
126
+ assert_eq ! ( SourceType :: Custom . partial_cmp( & SourceType :: Custom ) , Some ( Ordering :: Equal ) ) ;
127
+ assert_eq ! ( SourceType :: Custom . partial_cmp( & SourceType :: Default ) , Some ( Ordering :: Greater ) ) ;
128
+ assert_eq ! ( SourceType :: Default . partial_cmp( & SourceType :: Custom ) , Some ( Ordering :: Less ) ) ;
129
+ }
130
+
131
+ #[ test]
132
+ fn test_cmp ( ) {
133
+ assert_eq ! ( SourceType :: Custom . cmp( & SourceType :: Custom ) , Ordering :: Equal ) ;
134
+ assert_eq ! ( SourceType :: Custom . cmp( & SourceType :: Default ) , Ordering :: Greater ) ;
135
+ assert_eq ! ( SourceType :: Default . cmp( & SourceType :: Custom ) , Ordering :: Less ) ;
136
+ }
137
+
113
138
#[ test]
114
139
fn test_to_source ( ) {
115
140
let file_format = FileFormat {
0 commit comments