Skip to content

Commit 0c74191

Browse files
committed
fix(query): improve mutants coverage
1 parent 1a8c9c9 commit 0c74191

1 file changed

Lines changed: 25 additions & 5 deletions

File tree

src/query/mod.rs

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -226,10 +226,30 @@ mod test {
226226
}],
227227
});
228228

229+
// Another single method trait with parameters.
230+
hir.traits.insert(Trait {
231+
name: TraitBindingId::from_id(3),
232+
method_scope: ScopeId::from_id(3),
233+
method_bindings: HashMap::from_iter([(
234+
IdentifierBindingId::from_id(0),
235+
TraitMethodId::from_id(0),
236+
)]),
237+
methods: indexed_vec![FunctionSignature {
238+
parameters: vec![
239+
(
240+
IdentifierBindingId::from_id(2),
241+
MaybeSelfType::Type(TypeId::from_id(0))
242+
),
243+
(IdentifierBindingId::from_id(1), MaybeSelfType::SelfType),
244+
],
245+
return_ty: MaybeSelfType::Type(TypeId::from_id(0)),
246+
}],
247+
});
248+
229249
// Multi method trait.
230250
hir.traits.insert(Trait {
231-
name: TraitBindingId::from_id(1),
232-
method_scope: ScopeId::from_id(1),
251+
name: TraitBindingId::from_id(4),
252+
method_scope: ScopeId::from_id(4),
233253
method_bindings: HashMap::from_iter([
234254
(IdentifierBindingId::from_id(0), TraitMethodId::from_id(0)),
235255
(IdentifierBindingId::from_id(1), TraitMethodId::from_id(1)),
@@ -251,7 +271,7 @@ mod test {
251271

252272
#[rstest]
253273
fn all_traits(hir: Hir) {
254-
assert_eq!(Query::traits().query(&hir).count(), 4);
274+
assert_eq!(Query::traits().query(&hir).count(), 5);
255275
}
256276

257277
#[rstest]
@@ -261,7 +281,7 @@ mod test {
261281
.methods([SignatureFilter::new()])
262282
.query(&hir)
263283
.count(),
264-
2
284+
3
265285
);
266286
}
267287

@@ -272,7 +292,7 @@ mod test {
272292
.methods([SignatureFilter::new().return_ty(TypeId::from_id(0))])
273293
.query(&hir)
274294
.count(),
275-
2
295+
3
276296
);
277297
}
278298

0 commit comments

Comments
 (0)