MCPcopy Create free account
hub / github.com/PHPantom-dev/phpantom_lsp / extends_generics_dependency

Function extends_generics_dependency

src/toposort.rs:402–423  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

400
401 #[test]
402 fn extends_generics_dependency() {
403 // Collection<int, Language> — Collection should come before the child.
404 let collection = make_class("Collection");
405 let mut child = make_class("LanguageCollection");
406 child.parent_class = Some(crate::atom::atom("Collection"));
407 child.extends_generics = vec![(crate::atom::atom("Collection"), vec![])];
408
409 let classes = vec![
410 ("LanguageCollection".to_string(), &child),
411 ("Collection".to_string(), &collection),
412 ];
413
414 let sorted = toposort_classes(classes.into_iter());
415
416 let pos_col = sorted.iter().position(|s| s == "Collection").unwrap();
417 let pos_child = sorted
418 .iter()
419 .position(|s| s == "LanguageCollection")
420 .unwrap();
421
422 assert!(pos_col < pos_child);
423 }
424
425 #[test]
426 fn all_classes_appear_exactly_once() {

Callers

nothing calls this directly

Calls 6

atomFunction · 0.85
toposort_classesFunction · 0.85
into_iterMethod · 0.80
iterMethod · 0.80
make_classFunction · 0.70
unwrapMethod · 0.45

Tested by

no test coverage detected