MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / test_extract_method_in_class

Function test_extract_method_in_class

atomic-semantic/src/parsers/swift.rs:845–872  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

843
844 #[test]
845 fn test_extract_method_in_class() {
846 let mut parser = SwiftParser::new();
847 let source = r#"
848class Calculator {
849 func add(a: Int, b: Int) -> Int {
850 return a + b
851 }
852}
853"#;
854 let entities = parser.extract(source, "calc.swift");
855
856 let calc = entities
857 .iter()
858 .find(|e| e.name == "Calculator")
859 .expect("Should find Calculator");
860 assert_eq!(calc.kind, EntityKind::Class);
861
862 let add = entities
863 .iter()
864 .find(|e| e.name == "add")
865 .expect("Should find add");
866 assert_eq!(
867 add.kind,
868 EntityKind::Method,
869 "Function inside a class should be Method"
870 );
871 assert!(add.exported);
872 }
873
874 #[test]
875 fn test_extract_init() {

Callers

nothing calls this directly

Calls 2

extractMethod · 0.45
iterMethod · 0.45

Tested by

no test coverage detected