| 767 | |
| 768 | #[test] |
| 769 | fn test_extract_enum() { |
| 770 | let mut parser = SwiftParser::new(); |
| 771 | let source = r#" |
| 772 | enum Direction { |
| 773 | case north |
| 774 | case south |
| 775 | case east |
| 776 | case west |
| 777 | } |
| 778 | "#; |
| 779 | let entities = parser.extract(source, "types.swift"); |
| 780 | let dir = entities |
| 781 | .iter() |
| 782 | .find(|e| e.name == "Direction") |
| 783 | .expect("Should find Direction"); |
| 784 | assert_eq!(dir.kind, EntityKind::Enum); |
| 785 | assert!(dir.exported); |
| 786 | assert!( |
| 787 | dir.signature.as_ref().unwrap().contains("enum Direction"), |
| 788 | "Signature: {:?}", |
| 789 | dir.signature |
| 790 | ); |
| 791 | } |
| 792 | |
| 793 | #[test] |
| 794 | fn test_extract_protocol() { |