@@ -173,17 +173,18 @@ mod tests {
173
173
} ) ;
174
174
}
175
175
176
- const HASH_MISSMATCH_MSG : & str = r#"
177
- Changed in the serialized format detected!
178
- 1. Update ADBLOCK_RUST_DAT_VERSION before updating the expectations
179
- 2. DON'T rely on an approach: it's backwards compatible with the old one
176
+ const HASH_MISMATCH_MSG : & str = r#"
177
+ A change has been detected in the serialized format! If the change is intentional:
178
+ 1. Update ADBLOCK_RUST_DAT_VERSION before updating the expected hashes
179
+ 2. DON'T rely on backwards compatibility with the old format
180
180
Backwards compatibility isn't covered by the tests"# ;
181
181
182
182
#[ test]
183
183
fn deserialization_generate_simple ( ) {
184
184
let mut engine = Engine :: from_rules ( [ "ad-banner" ] , Default :: default ( ) ) ;
185
185
let data = engine. serialize ( ) . unwrap ( ) ;
186
- assert_eq ! ( hash( & data) , 5723845290597955159 , "{}" , HASH_MISSMATCH_MSG ) ;
186
+ const EXPECTED_HASH : u64 = 5723845290597955159 ;
187
+ assert_eq ! ( hash( & data) , EXPECTED_HASH , "{}" , HASH_MISMATCH_MSG ) ;
187
188
engine. deserialize ( & data) . unwrap ( ) ;
188
189
}
189
190
@@ -192,7 +193,8 @@ mod tests {
192
193
let mut engine = Engine :: from_rules ( [ "ad-banner$tag=abc" ] , Default :: default ( ) ) ;
193
194
engine. use_tags ( & [ "abc" ] ) ;
194
195
let data = engine. serialize ( ) . unwrap ( ) ;
195
- assert_eq ! ( hash( & data) , 9626816743810307798 , "{}" , HASH_MISSMATCH_MSG ) ;
196
+ const EXPECTED_HASH : u64 = 9626816743810307798 ;
197
+ assert_eq ! ( hash( & data) , EXPECTED_HASH , "{}" , HASH_MISMATCH_MSG ) ;
196
198
engine. deserialize ( & data) . unwrap ( ) ;
197
199
}
198
200
@@ -222,7 +224,7 @@ mod tests {
222
224
6839468684492187294
223
225
} ;
224
226
225
- assert_eq ! ( hash( & data) , expected_hash, "{}" , HASH_MISSMATCH_MSG ) ;
227
+ assert_eq ! ( hash( & data) , expected_hash, "{}" , HASH_MISMATCH_MSG ) ;
226
228
227
229
engine. deserialize ( & data) . unwrap ( ) ;
228
230
}
0 commit comments