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

package info (click to toggle)
swiftlang 6.0.3-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,519,992 kB
  • sloc: cpp: 9,107,863; ansic: 2,040,022; asm: 1,135,751; python: 296,500; objc: 82,456; f90: 60,502; lisp: 34,951; pascal: 19,946; sh: 18,133; perl: 7,482; ml: 4,937; javascript: 4,117; makefile: 3,840; awk: 3,535; xml: 914; fortran: 619; cs: 573; ruby: 573
file content (51 lines) | stat: -rw-r--r-- 1,683 bytes parent folder | download
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