File: fill-in-protocol-stubs-initiate-class-extension.m

package info (click to toggle)
swiftlang 6.1.3-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,791,604 kB
  • sloc: cpp: 9,901,740; ansic: 2,201,431; asm: 1,091,827; python: 308,252; objc: 82,166; f90: 80,126; lisp: 38,358; pascal: 25,559; sh: 20,429; ml: 5,058; perl: 4,745; makefile: 4,484; awk: 3,535; javascript: 3,018; xml: 918; fortran: 664; cs: 573; ruby: 396
file content (51 lines) | stat: -rw-r--r-- 1,683 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
@protocol Proto

@required
-(void)method:(int)x;

@end

@protocol Proto2

@required
- (void)method2:(int)y;

@end

@interface Base
@end

// Initiate the action from extension if the @implementation is in the same TU.
@interface WithExtension: Base<Proto>
@end
@interface WithExtension()
@end
@interface WithExtension() <Proto2>
@end
@implementation WithExtension
// CHECK1: Initiated the 'fill-in-missing-protocol-stubs' action at [[@LINE-1]]:1
@end
// RUN: clang-refactor-test initiate -action fill-in-missing-protocol-stubs -in=%s:21:1-27 -in=%s:22:1-5 -in=%s:23:1-36 %s | FileCheck --check-prefix=CHECK1 %s

@interface WithoutImplementation: Base<Proto>
@end
@interface WithoutImplementation()
@end
@interface WithoutImplementation() <Proto2>
@end
// CHECK-NO-IMPL: Failed to initiate the refactoring action (Class extension without suitable @implementation)!
// RUN: not clang-refactor-test initiate -action fill-in-missing-protocol-stubs -at=%s:32:1 -at=%s:34:1 %s 2>&1 | FileCheck --check-prefix=CHECK-NO-IMPL %s

// Initiate from the implementation even when the class has no protocols, but
// its extension does.

@interface NoProtocols: Base
@end
@interface NoProtocols() <Proto2>
@end
@implementation NoProtocols
@end
// CHECK2: Initiated the 'fill-in-missing-protocol-stubs' action at [[@LINE-2]]:1
// RUN: clang-refactor-test initiate -action fill-in-missing-protocol-stubs -at=%s:44:1 -at=%s:46:1 %s | FileCheck --check-prefix=CHECK2 %s
// CHECK-NO-EXT-FROM-INTERFACE: Failed to initiate the refactoring action!
// RUN: not clang-refactor-test initiate -action fill-in-missing-protocol-stubs -at=%s:42:1 %s 2>&1 | FileCheck --check-prefix=CHECK-NO-EXT-FROM-INTERFACE %s