Support for Swift and Objective-C dependencies

This commit is contained in:
Alan Hamlett 2018-03-11 15:35:35 -07:00
parent 4704cc427c
commit ca4bb4a271
4 changed files with 141 additions and 0 deletions

View file

@ -0,0 +1,18 @@
//
// Objective-C.m
//
#import "SomeViewController.h"
#import <UIKit.h>
#import <PromiseKit/Something.h>
@interface ViewController : UIViewController
@property (nonnull, strong) URL *url;
@end
@implementation ViewController {
- (void)viewDidLoad {
[super viewDidLoad];
// noop
}
@end

View file

@ -0,0 +1,16 @@
//
// Swift.swift
//
import Foundation
import UIKit
import PromiseKit
class ViewController: UIViewController {
private var attribute: URL?
override func viewDidLoad() {
// noop
}
}

View file

@ -397,3 +397,26 @@ class DependenciesTestCase(TestCase):
expected_lines=37,
entity='typescript.ts',
)
def test_swift_dependencies_detected(self):
self.shared(
expected_dependencies=[
'UIKit',
'PromiseKit',
],
expected_language='Swift',
expected_lines=16,
entity='swift.swift',
)
def test_objective_c_dependencies_detected(self):
self.shared(
expected_dependencies=[
'SomeViewController',
'UIKit',
'PromiseKit',
],
expected_language='Objective-C',
expected_lines=18,
entity='objective-c.m',
)