diff options
Diffstat (limited to 'debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc')
101 files changed, 2819 insertions, 0 deletions
diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/1927.m b/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/1927.m new file mode 100644 index 00000000..9f8d7a7b --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/1927.m @@ -0,0 +1,17 @@ +- (void) foo:(NSString*) inString +{ + @try { + }@catch(NSException* const inException) + { + } +} + +- (void) bar:(NSString*) inString +{ + @try { + } + @catch (NSException* const inException){ + } + @finally { + } +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/Declarations.h b/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/Declarations.h new file mode 100644 index 00000000..e1ad3c6b --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/Declarations.h @@ -0,0 +1,22 @@ + +@interface EmptyClass : NSObject +-(void)aMessage:(id)arg; +@end + +@interface EmptyClass : NSObject {} +-(void)aMessage:(id)arg; +@end + +@interface NSObject (ObjectAdditions) +-(void)aMessage:(id)arg; +@end + +@protocol TestProtocol +-(void)aMessage:(id)arg; +@end + +@interface TestClass : NSObject <TestProtocol> { +} +-(void)aMessage:(id)arg; +@end + diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/Fraction.h b/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/Fraction.h new file mode 100644 index 00000000..364b1de8 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/Fraction.h @@ -0,0 +1,14 @@ +#import <Foundation/NSObject.h> + +@interface Fraction: NSObject { + int numerator; + int denominator; +} + +-(void) print; +-(void) setNumerator: (int) d; +-(void) setDenominator: (int) d; +-(int) numerator; +-(int) denominator; +-(void) setNumDen :(int)n:(int)d; +@end diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/Fraction.m b/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/Fraction.m new file mode 100644 index 00000000..20994f34 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/Fraction.m @@ -0,0 +1,24 @@ +#import "Fraction.h" +#import <stdio.h> + +@implementation Fraction +-(void) print { + printf( "%i/%i", numerator, denominator ); +} + +-(void) setNumerator: (int) n { + numerator = n; +} + +-(void) setDenominator: (int) d { + denominator = d; +} + +-(int) denominator { + return denominator; +} + +-(int) numerator { + return numerator; +} +@end diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/Issue_2172.m b/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/Issue_2172.m new file mode 100644 index 00000000..02584e91 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/Issue_2172.m @@ -0,0 +1,10 @@ +if (YES) { + NSString *sqlStr = [NSString stringWithFormat:@"INSERT INTO %@ (%@ , %@) VALUES + ('%@','%@')" + , ContactsRemark_Table + , ContactsRemark_FollowId + , ContactsRemark_MarkName +, followId + , markName + ]; + } diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/Issue_2289.m b/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/Issue_2289.m new file mode 100644 index 00000000..c046cb1e --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/Issue_2289.m @@ -0,0 +1,5 @@ ++ (void)foo:(bar)block { + for (int i = 0; i < 5; i++) @autoreleasepool { + // stuff + } +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/Issue_681.oc b/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/Issue_681.oc new file mode 100644 index 00000000..fb4c6685 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/Issue_681.oc @@ -0,0 +1,15 @@ +int q; +@interface MyClass () +@property (nonatomic, weak) UIView someView; +@property (nonatomic, weak) UIView anotherView; +@end +@implementation MyClass +- (void)someKindOfFunction +{ +some code; +} +- (void)anotherOfFunction +{ +some code; +} +@end diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/align-objc-like-xcode.m b/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/align-objc-like-xcode.m new file mode 100644 index 00000000..6852ac12 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/align-objc-like-xcode.m @@ -0,0 +1,8 @@ +- (void)foo { +[self dismissWithReason:DismissReason::Auto animated:TRUE]; +[self dismissWithReason:DismissReason::Auto +animated:TRUE]; +[self +dismissWithReason:DismissReason::Auto +animated:TRUE]; +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/attribute_specifier_seqs.mm b/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/attribute_specifier_seqs.mm new file mode 100644 index 00000000..c9b6f24d --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/attribute_specifier_seqs.mm @@ -0,0 +1,19 @@ +int w1[1]; +int w2 [[maybe_unused]] = 0; +int w3 [[foo(w1[0])]]; // unknown attribute foo +int w4 [[foo((w1[0]))]]; // unknown attribute foo +int w5 [[foo(w1[0] [[maybe_unused]])]]; // unknown attribute foo +int w6 [[foo(w1[0] [[maybe_unused]]), [[deprecated]]]]; // expected ] before [[deprecated +int w7 [[w1[0]]] = 0; // expected ] before [ in w1[ +int w8 [[ [[maybe_unused]] ]]; // expected ] before [[maybe_unused +int w9 [ [ foo ] ] = 0; + +@implementation Foo +- (void) message { +Foo* foo = [[Foo alloc] init]; +} +@end + +Foo* foo = [[Foo alloc] init]; + +[[Foo sharedInstance] broadcast:[world hello]]; diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/available.m b/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/available.m new file mode 100644 index 00000000..8216d17f --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/available.m @@ -0,0 +1,12 @@ +-(void) test{ + if (@available(macOS 10.12.2, *)) { + self.automaticTextCompletionEnabled = YES; + self.allowsCharacterPickerTouchBarItem = NO; + } + + if (@available( macOS 10.12,*)) { + self.automaticTextCompletionEnabled = YES; + self.allowsCharacterPickerTouchBarItem = NO; + } + +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/block_in_method.m b/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/block_in_method.m new file mode 100644 index 00000000..e0dfcd76 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/block_in_method.m @@ -0,0 +1,66 @@ + +void Events1(NSString * identifier, void (^handler)()); + +void Events2(NSString * identifier, void (^)()); + +@implementation NSArray (WWDC) +- (NSArray *)map:(id (^)(id))xform { + id result = [NSMutableArray array]; + for (id elem in self) + [result addObject:xform(elem)]; + return result; +} + +- (NSArray *)collect:(BOOL ( ^ )(id))predicate { + id result = [NSMutableArray array]; + for (id elem in self) + if (predicate(elem)) + [result addObject:elem]; + return result; +} + +- (void)each:(void (^)(id object))block { + [self enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) { + block(obj); + }]; +} + +// corner case: block literal in use with return type +id longLines = [allLines collect: ^ BOOL (id item) { + return [item length] > 20; +}]; + +// corner case: block literal in use with return type +id longLines = [allLines collect: ^ BOOL* (id item) { + return [item length] > 20; +}]; + +@end + +nestedMethodCall(methodCall( ^ BOOL * (id item) { + NSLog(@"methodCall") +})); + +nestedMethodCall( + arg1, + methodCall( ^ NSString * (id item) { + NSLog(@"methodCall") + })); + +nestedMethodCall( + arg1, + methodCall( ^ { + NSLog(@"methodCall") + }, + arg2) +); + +nestedMethodCall( + methodCall( ^ { + NSLog(@"methodCall") + }) +); + +// 1. block literal: ^{ ... }; +// 2. block declaration: return_t (^name) (int arg1, int arg2, ...) NB: return_t is optional and name is also optional +// 3. block inline call ^ return_t (int arg) { ... }; NB: return_t is optional diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/block_literal_protocol.m b/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/block_literal_protocol.m new file mode 100644 index 00000000..02d1cfca --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/block_literal_protocol.m @@ -0,0 +1,19 @@ +#import <Foundation/Foundation.h> + +@interface TestClass : NSObject +@end + +@implementation TestClass + +- (void)drawSomething:(id<MTLCommandBuffer>)commandBuffer { + [renderPass performDrawBlock:^(id<MTLRenderCommandEncoder> renderCommandEncoder) { + screenBlitObject.texture = src; + + // Make sure the pipeline state pixelformat is the same as destination pixel format + [screenBlitObject updatePipelineState:dst.pixelFormat]; + + [screenBlitObject drawWithRenderCommandEncoder:renderCommandEncoder]; + } withTargetTexture:dst andCommandBuffer:commandBuffer]; +} + +@end diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/blocks.m b/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/blocks.m new file mode 100644 index 00000000..617e0b78 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/blocks.m @@ -0,0 +1,15 @@ +int* ( ^ blkReturningPointer)(int) = ^ int* (int a) { + return a + 1; +}; + +void (^ blk2)(int *) = ^(int *b) { + *b = 1; +}; + + +int (^oneFrom)(int) = ^ (int anInt) { + return anInt - 1; +}; + +// this should not be flagged as OC_BLOCK_CARET +int x = 12 ^ 23;
\ No newline at end of file diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/blocks_align.m b/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/blocks_align.m new file mode 100644 index 00000000..2ddf75c6 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/blocks_align.m @@ -0,0 +1,14 @@ +[[HRNewsService sharedInstance] unregisterPushToken:data + success:^{ + self.notificationsEnabled = NO; + if (data.param) { + self.loudNotifications = YES; + } + } + fail:^{ + self.notificationsEnabled = NO; + if (data.param) { + self.loudNotifications = YES; + } + } +]; diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/blocks_align2.m b/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/blocks_align2.m new file mode 100644 index 00000000..f4e875c9 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/blocks_align2.m @@ -0,0 +1,89 @@ +#import <Foundation/Foundation.h> + +@interface TestClass : NSObject +@end + +@implementation TestClass + +- (void) method1 { + [session mergeCommonMovieItems:^(NSURL *exportURL, NSError *exportError) { + NSDictionary *settings = [self getSettings]; + + [session postSessionWithCallback:^(NSError *error, id d) { + if (error == nil) { + [session uploadSessionWithCallback:^(NSError *error, id d) { + NSLog(@"OK"); + }]; + } else { + NSLog(@"Something went wrong: %@", error); + return; + } + }]; + }]; +} + +- (void)postSelection:(NSString *)testName + selection:(NSString *)selection { + dispatch_async(dispatch_get_main_queue(), ^{ + [self warmup:^{ + [self setReady]; + }]; + }); + + dispatch_after(retryTime, dispatch_get_main_queue(), ^(void) { + [self postSelection:testName selection:selection]; + }); + + [TestClassRequest performMethod:TestClassRequestMethodPOST + responseHandler:^(NSURLResponse *response) { + dispatch_after(retryTime, dispatch_get_main_queue(), ^(void) { + [self postSelection:testName selection:selection]; + }); + }]; + + [UIView transitionWithView:self.view.window duration:0.75 options:UIViewAnimationOptionTransitionFlipFromRight animations:^{ + [self presentViewController:viewController animated:NO completion:nil]; + } complete:^{}]; +} + +- (void)closeEditor { + dispatch_async(dispatch_get_main_queue(), ^{ + if ([[TestClass sharedInstance] TestClassController] != nil && [[[TestClass sharedInstance] TestClassController] isKindOfClass:[TestClassSocialViewController class]]) { + [[TestClass sharedInstance].TestClassTransitionController transitionToViewController:[[TestClass sharedInstance] TestClassController] withCompletitionHandler:^{ + [[TestClass sharedInstance] setTestClassVideoPlayerViewController:nil]; + }]; + } else if ([[TestClass sharedInstance] TestClassController] != nil && [[[TestClass sharedInstance] TestClassController] isKindOfClass:[TestClassModalViewController class]]) { + [[TestClass sharedInstance].TestClassTransitionController transitionToViewController:nil withCompletitionHandler:^{ + [[TestClass sharedInstance] setTestClassVideoPlayerViewController:nil]; + }]; + } else { + [[TestClass sharedInstance] hideTestClass]; + } + }); +} + +- (void)testMethodWrapper { + SEL testMethodForSelectorSel = @selector(testMethod:); + __block void *testMethodForSelectorBlock = TestFunction(encoderTest, testMethodForSelectorSel, ^id (__typeof (encoderTest) self, SEL aSelector) { + NSLog(@"OK"); + }); +} + +- (void) method2 { + [TestClassRequest performMethod:TestClassRequestMethodPOST + responseHandler:^(NSURLResponse *response, NSData *responseData, NSError *error) { + [self checkPermissions:connection withCallback:^(NSError *error, id data) { + [self bar]; + }]; + }]; +} + +- (void) method3 { + [TestClassRequest performMethod:TestClassRequestMethodPOST responseHandler:^(NSURLResponse *response, NSData *responseData, NSError *error) { + [self checkPermissions:connection withCallback:^(NSError *error, id data) { + [self bar]; + }]; + }]; +} + +@end diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/box.m b/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/box.m new file mode 100644 index 00000000..98a3516a --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/box.m @@ -0,0 +1,12 @@ +NSArray *test = @[]; +NSNumber *test = @ (42 * 2); +NSNumber *test = @4.0; +NSDictionary *test = @{@"foo":@"bar"}; + +@implementation UrlTemplateTest +- (void)test { + NSString *test = @""; + NSString *string = [[NSMutableString alloc] initWithString:@""]; + STAssertEqualObjects(string, @"", nil); +} +@end diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/boxed_receiver.m b/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/boxed_receiver.m new file mode 100644 index 00000000..3460b920 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/boxed_receiver.m @@ -0,0 +1,37 @@ +#import <Foundation/Foundation.h> + +@implementation TestClass + +- (NSDictionary *)constructUploadHeaders { + NSDictionary *headers; + + headers = @{ + @"Content-Length":[@(contentLength)stringValue], + @"Content-Length2": [contentLength stringValue], + @"Content-Disposition": [NSString stringWithFormat:@"name=\"%@\"; filename=\"%@\"", @"asset_data", identifier], + @"Content-Type": @"application/octet-stream", + @"ETag": uploadEtag + }; + + return headers; +} + +- (BOOL)isStrimmed { + if ([(TestClassVideoEditorView *) (self.parentComponentsView.superview)isTrimmed]) { + return YES; + } + if ([((TestClassVideoEditorView *) self.parentComponentsView.superview)isTrimmed]) { + return YES; + } + return NO; +} + +- (void)session { + TestCaseSessionInstance *session = ((TestClassVideoEditorView *) self.parentComponentsView.superview).session; + + [(TestClassVideoEditorView *) ( self.parentComponentsView.superview) closeEditor]; + + [menubutton.badge setBadgeText:[@(count + 1) stringValue]]; +} + +@end diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/bug_1366.m b/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/bug_1366.m new file mode 100644 index 00000000..5e81ed4a --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/bug_1366.m @@ -0,0 +1,14 @@ +@implementation UCTestClass + +- (void) test{ + + switch (test) { + case "longlonglonglong":{ + i = 1; + } + break; + } +} + +@end + diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/bug_167.m b/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/bug_167.m new file mode 100644 index 00000000..e404e2aa --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/bug_167.m @@ -0,0 +1,7 @@ +- (void)dealloc { + [self closeFile]; + + [self setData:nil]; + + [super dealloc]; +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/bug_1674.m b/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/bug_1674.m new file mode 100644 index 00000000..82c20161 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/bug_1674.m @@ -0,0 +1,4 @@ +- (void) test{ +[test handleOpenURL:url + sourceApplication:sourceApplication] +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/bug_1683.m b/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/bug_1683.m new file mode 100644 index 00000000..3ee562c0 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/bug_1683.m @@ -0,0 +1 @@ +[mutString addAttributes:@{ NSParagraphStyleAttributeName : style } range:range]; diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/bug_340.m b/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/bug_340.m new file mode 100644 index 00000000..ea9f8201 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/bug_340.m @@ -0,0 +1,13 @@ +#import <Cocoa/Cocoa.h> + +@implementation MyDocument +- (void) locationManager: (CLLocationManager*) manager didFailWithError:(NSError *)error { + + [UIAlertView showError: error + withTitle: NSLocalizedString(@"Your location cannot be determined", + @"The location of the user cannot be guessed") + message: NSLocalizedString(@"You can try again by pressing the refresh button", + @"Recovery suggestion when the location cannot be found")]; +} + +@end diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/bug_404.m b/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/bug_404.m new file mode 100644 index 00000000..3ecb87f0 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/bug_404.m @@ -0,0 +1,6 @@ +@interface Test1 : Test2 +@end + + +@interface Test<T1: id<T3>> : Test2<P1> +@end diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/bug_497.m b/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/bug_497.m new file mode 100644 index 00000000..a976d43d --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/bug_497.m @@ -0,0 +1,13 @@ +NSArray *array = @[@1, + @2, + @3, + @4]; + +NSArray *array = @{ @1: @1, + @2: @2, + @3: @3, + @4: @4 }; + +int i = 1 ++ 1 ++ 2; diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/bug_841.m b/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/bug_841.m new file mode 100644 index 00000000..dea826d2 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/bug_841.m @@ -0,0 +1,4 @@ +- (void)myMethod { + NSInteger rowCount = [sectionProvider collectionView:self.collectionView + numberOfRowsInSection:section]; +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/bug_i_125-412.m b/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/bug_i_125-412.m new file mode 100644 index 00000000..c92d2e66 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/bug_i_125-412.m @@ -0,0 +1,7 @@ +[[NSFileManager defaultManager] createFileAtPath:path contents:data attributes:nil] + +[self.myProperty setObject:obj forKey:key]; + +NSString *newValue = [@"my string" stringByTrimmingCharactersInSet:NSCharacterSet.whitespaceCharacterSet]; + +NSString *newValue = [myStrings[0] stringByTrimmingCharactersInSet:NSCharacterSet.whitespaceCharacterSet]; diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/bug_i_408.m b/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/bug_i_408.m new file mode 100644 index 00000000..c8a3a450 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/bug_i_408.m @@ -0,0 +1 @@ + CGFloat fontSize = floorf([font pointSize] * [self tileContentScale] + 0.5); diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/bug_i_477.m b/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/bug_i_477.m new file mode 100644 index 00000000..a1a81749 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/bug_i_477.m @@ -0,0 +1,3 @@ + [dataArray enumerateObjectsUsingBlock:^(dataType *data, NSUInteger idx, BOOL *stop) { + // Do stuff! + }]; diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/c-cpp-oc-wrapper.c b/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/c-cpp-oc-wrapper.c new file mode 100644 index 00000000..663a4cc8 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/c-cpp-oc-wrapper.c @@ -0,0 +1,300 @@ +// C/C++/Obj-C/Obj-C++ wrapper that exports C functions +// +// As an example, distributed with .c suffix, +// but depending on extension needs, can be +// compiled as C, C++, Obj-C or Obj-C++ + +#include <stdio.h> +#include <unistd.h> +#include "TestClassNativeHelper.h" + +#undef NDEBUG + +#if defined(__ANDROID__) + +#define TCH_LOGI(...) __android_log_print(ANDROID_LOG_INFO, "TestClassNativeHelper", __VA_ARGS__) +#define TCH_LOGE(...) __android_log_print(ANDROID_LOG_ERROR, "TestClassNativeHelper", __VA_ARGS__) + +#ifndef NDEBUG +#define TCH_LOGV(...) __android_log_print(ANDROID_LOG_VERBOSE, "TestClassNativeHelper", __VA_ARGS__) +#else +#define TCH_LOGV(...) +#endif + +#define TCH_ELOG TCH_LOGV("%s", __FUNCTION__) + +void TCH_onTestClassUploadDidProgress(C_JNIEnv *env, jobject thiz, jint videoId, jdouble progress) { + TCH_ELOG; +} + +#ifndef TCH_NELEM +#define TCH_NELEM(x) ((int)(sizeof(x) / sizeof((x)[0]))) +#endif + +static const char *kTCHTestClassClass = "com/testclass/TestClass/TestClass"; +static const char *kTCHTestClassLoader = "com.testclass.TestClass.TestClass"; + +static const char *kTCHTestClassNativeListenerClass = "com/testclass/TestClass/communication/TestClassNativeListener"; +static const char *kTCHTestClassNativeListenerLoader = "com.testclass.TestClass.communication.TestClassNativeListener"; + +static JavaVM *TCH_vm = NULL; + +static JNINativeMethod TCH_listenerMethods[] = { + { "onTestClassUploadDidProgress", "(ID)V", (void *)TCH_onTestClassUploadDidProgress }, +}; + +static C_JNIEnv *TCH_getEnv() { + C_JNIEnv *ret = NULL; + + if (TCH_vm == NULL) { + TCH_LOGE("TCH_getEnv failed, no JVM"); + return NULL; + } + +#if defined(__cplusplus) + JNIEnv *env = NULL; + + if (TCH_vm->GetEnv((void **)&env, JNI_VERSION_1_6) != JNI_OK) { + JavaVMAttachArgs args; + args.version = JNI_VERSION_1_6; + args.name = NULL; + args.group = NULL; + + int attachStatus; + if ((attachStatus = TCH_vm->AttachCurrentThread(&env, &args)) < 0) { + TCH_LOGE("TCH_getEnv failed"); + } + } + ret = (C_JNIEnv *)env; +#else + JNIEnv *env = NULL; + + if ((*TCH_vm)->GetEnv(TCH_vm, (void **)&env, JNI_VERSION_1_6) != JNI_OK) { + JavaVMAttachArgs args; + args.version = JNI_VERSION_1_6; + args.name = NULL; + args.group = NULL; + + int attachStatus; + if ((attachStatus = (*TCH_vm)->AttachCurrentThread(TCH_vm, &env, &args)) < 0) { + TCH_LOGE("TCH_getEnv failed"); + } + } + ret = env; +#endif /* if defined(__cplusplus) */ + return ret; +} + +static jclass TCH_loadClass(C_JNIEnv *env, jobject activity, const char *className) { + jclass cls_Activity = (*env)->GetObjectClass((JNIEnv *)env, activity); + jmethodID mid_getClassLoader = (*env)->GetMethodID((JNIEnv *)env, cls_Activity, "getClassLoader", "()Ljava/lang/ClassLoader;"); + jobject obj_classLoader = (*env)->CallObjectMethod((JNIEnv *)env, activity, mid_getClassLoader); + + jclass cls_classLoader = (*env)->GetObjectClass((JNIEnv *)env, obj_classLoader); + jmethodID mid_loadClass = (*env)->GetMethodID((JNIEnv *)env, cls_classLoader, "loadClass", "(Ljava/lang/String;)Ljava/lang/Class;"); + + jstring _className = (*env)->NewStringUTF((JNIEnv *)env, className); + jclass cls = (jclass)(*env)->CallObjectMethod((JNIEnv *)env, obj_classLoader, mid_loadClass, _className); + + (*env)->DeleteLocalRef((JNIEnv *)env, _className); + + if (!cls) { + TCH_LOGE("Couldn't find class %s", className); + } + + return cls; +} + +#define TCH_str2(x) # x +#define TCH_str(x) TCH_str2(x) + +#define TCH_CLASS(_class) tchClass_ ## _class + +#define TCH_LOCAL_CLASS(_class) local_tchClass_ ## _class + +#define TCH_REGISTER_CLASS(_class) \ + jclass TCH_CLASS(_class) = NULL; + +#define TCH_EXTERN_CLASS(_class) \ + jclass TCH_CLASS(_class); + +#define TCH_METHOD(_method) tchMethod_ ## _method + +#define TCH_REGISTER_METHOD(_method) \ + jmethodID TCH_METHOD(_method) = NULL; + +#define TCH_EXTERN_METHOD(_method) \ + jmethodID TCH_METHOD(_method); + +#define TCH_REGISTER_NATIVES(_env, _class, methods) \ + if ((*_env)->RegisterNatives((JNIEnv *)_env, TCH_CLASS(_class), methods, TCH_NELEM(methods)) < 0) { \ + TCH_LOGE("RegisterNatives failed for %s\n", TCH_str(_class)); \ + } + +#define TCH_FIND_CLASS(_env, _class, _className) \ + jclass TCH_LOCAL_CLASS(_class) = (*_env)->FindClass((JNIEnv *)_env, _className); \ + if (TCH_LOCAL_CLASS(_class) == NULL) { \ + TCH_LOGE("Unable to find class %s\n", _className); \ + } else { \ + TCH_CLASS(_class) = (jclass)(*_env)->NewGlobalRef((JNIEnv *)_env, TCH_LOCAL_CLASS(_class)); \ + } + +#define TCH_FIND_STATIC_METHOD(_env, _class, _method, _prototype) \ + TCH_METHOD(_method) = (*_env)->GetStaticMethodID((JNIEnv *)_env, TCH_CLASS(_class), TCH_str(_method), _prototype); \ + if (TCH_METHOD(_method) == NULL) { \ + TCH_LOGE("Unable to find method %s", TCH_str(_method)); \ + } + +#define TCH_FIND_STATIC_METHOD2(_env, _class, _method, _symbol, _prototype) \ + TCH_METHOD(_method) = (*_env)->GetStaticMethodID((JNIEnv *)_env, TCH_CLASS(_class), TCH_str(_symbol), _prototype); \ + if (TCH_METHOD(_method) == NULL) { \ + TCH_LOGE("Unable to find method %s", TCH_str(_method)); \ + } + +#define TCH_CALL_STATIC_METHOD_ARGS(_env, _class, _method, ...) \ + (*_env)->CallStaticVoidMethod((JNIEnv *)_env, TCH_CLASS(_class), TCH_METHOD(_method), __VA_ARGS__); + +#define TCH_CALL_STATIC_METHOD_BOOL(_env, _class, _method) \ + (*_env)->CallStaticBooleanMethod((JNIEnv *)_env, TCH_CLASS(_class), TCH_METHOD(_method)); + +TCH_REGISTER_CLASS(testclassClass); +TCH_REGISTER_METHOD(testclassConstructor); +static jobject TCH_testclassInstance = NULL; + +TCH_REGISTER_CLASS(testclassNativeListenerClass); +TCH_REGISTER_METHOD(testclassNativeListenerConstructor); +static jobject TCH_testclassNativeListenerInstance = NULL; + +TCH_REGISTER_METHOD(isSupported); +TCH_REGISTER_METHOD(initTestClass); + +static void TCH_preload(C_JNIEnv *env) { + TCH_ELOG; + + if (TCH_CLASS(testclassClass) == NULL) { + TCH_FIND_CLASS(env, testclassClass, kTCHTestClassClass); + } + + // Class really not found or not loaded, bail + if (TCH_CLASS(testclassClass) == NULL) { + return; + } + + if (TCH_CLASS(testclassClass) != NULL && TCH_METHOD(isSupported) == NULL) { + TCH_FIND_STATIC_METHOD(env, testclassClass, isSupported, "()Z"); + TCH_FIND_STATIC_METHOD(env, testclassClass, initTestClass, "(Lcom/testclass/TestClass/ITestClassListener;Landroid/app/Activity;)Z"); + + if (TCH_CLASS(testclassClass) != NULL) { + TCH_METHOD(testclassConstructor) = (*env)->GetMethodID((JNIEnv *)env, TCH_CLASS(testclassClass), "<init>", "()V"); + jobject constructor = (*env)->NewObject((JNIEnv *)env, TCH_CLASS(testclassClass), TCH_METHOD(testclassConstructor)); + TCH_testclassInstance = (*env)->NewGlobalRef((JNIEnv *)env, constructor); + } + + if (TCH_CLASS(testclassNativeListenerClass) == NULL) { + TCH_FIND_CLASS(env, testclassNativeListenerClass, kTCHTestClassNativeListenerClass); + } + + if (TCH_CLASS(testclassNativeListenerClass) != NULL) { + TCH_METHOD(testclassNativeListenerConstructor) = (*env)->GetMethodID((JNIEnv *)env, TCH_CLASS(testclassNativeListenerClass), "<init>", "()V"); + jobject listener = (*env)->NewObject((JNIEnv *)env, TCH_CLASS(testclassNativeListenerClass), TCH_METHOD(testclassNativeListenerConstructor)); + TCH_testclassNativeListenerInstance = (*env)->NewGlobalRef((JNIEnv *)env, listener); + TCH_REGISTER_NATIVES(env, testclassNativeListenerClass, TCH_listenerMethods); + TCH_LOGV("Initializing built-in listener"); + } + } +} + +#elif defined(__APPLE__) + +#ifndef NDEBUG +#define TCH_LOGV(...) NSLog(__VA_ARGS__) +#else +#define TCH_LOGV(...) +#endif + +#define TCH_ELOG TCH_LOGV(@"%s", __FUNCTION__) + +#if defined(__cplusplus) +#define TCH_NS(_class) ::_class +#else +#define TCH_NS(_class) _class +#endif + +@interface TCH_delegateHandler : NSObject <TestClassDelegate> +@end + +@implementation TCH_delegateHandler +- (void)testclassUploadDidProgress:(NSNumber *)videoId progress:(NSNumber *)progress { + TCH_ELOG; +} + +@end + +static TCH_delegateHandler *TCH_builtInHandler = nil; + +#endif /* if defined(__ANDROID__) */ + +#if defined(__ANDROID__) + +void TCH_initTestClass(JNIEnv *env, jobject activity, jobject listener) { + TCH_ELOG; + + C_JNIEnv *cenv = NULL; +#if defined(__cplusplus) + cenv = (C_JNIEnv *)env; +#else + cenv = env; +#endif + + if (TCH_vm == NULL) { + int status = (*cenv)->GetJavaVM((JNIEnv *)cenv, &TCH_vm); + if (status != 0) { + TCH_LOGE("GetJavaVM failed"); + return; + } + } + + TCH_CLASS(testclassClass) = TCH_loadClass(cenv, activity, kTCHTestClassLoader); + TCH_CLASS(testclassNativeListenerClass) = TCH_loadClass(cenv, activity, kTCHTestClassNativeListenerLoader); + TCH_preload(cenv); + + jobject listenerRef = listener; + if (listenerRef == NULL) { + TCH_LOGV("Using built-in listener"); + listenerRef = TCH_testclassNativeListenerInstance; + } + + TCH_CALL_STATIC_METHOD_ARGS(cenv, testclassClass, initTestClass, listenerRef, activity); +} + +#elif defined(__APPLE__) + +void TCH_initTestClass(UIViewController *viewController, id <TestClassDelegate>testclassDelegate) { + TCH_ELOG; + + id <TestClassDelegate>testclassDelegateRef = testclassDelegate; + if (testclassDelegateRef == nil) { + TCH_builtInHandler = [[TCH_delegateHandler alloc] init]; + testclassDelegateRef = TCH_builtInHandler; + } + + [TCH_NS(TestClass) initWithDelegate : testclassDelegateRef andParentViewController : viewController]; +} + +#endif /* if defined(__ANDROID__) */ + +bool TCH_isSupported(void) { + TCH_ELOG; + bool ret = false; + +#if defined(__ANDROID__) + C_JNIEnv *env = TCH_getEnv(); + if (env && TCH_CLASS(testclassClass)) { + ret = (bool)TCH_CALL_STATIC_METHOD_BOOL(env, testclassClass, isSupported); + } +#elif defined(__APPLE__) + ret = (bool) [TCH_NS(TestClass) isSupported]; +#endif + + return ret; +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/cast.m b/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/cast.m new file mode 100644 index 00000000..daa9cb6d --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/cast.m @@ -0,0 +1,13 @@ +#import <Foundation/Foundation.h> + +@interface TestClass : NSObject +@end + +@implementation TestClass + +- (void) foo +{ + previewViewController.previewControllerDelegate = (id<TestClassDelegate>)[TestClass sharedInstance]; +} + +@end diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/chunk_ends_type1.m b/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/chunk_ends_type1.m new file mode 100644 index 00000000..fb9bb4e1 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/chunk_ends_type1.m @@ -0,0 +1,23 @@ +#import <Foundation/Foundation.h> + +@interface TestClass : NSObject +@end + +@implementation TestClass + +- (void)uploadWithClientData:(NSMutableDictionary *)data withCallback:(TestClassCallback)callback { + TestClassSessionInstance *session = [[TestClassSession sharedInstance] currentOrLastSession]; + + if (session == nil || data == nil) { + if (callback != nil) + return callback(nil, nil); + return; + } + [session mergeCommonMovieItems:^(NSURL *exportURL, NSError *exportError) { + if (exportError != nil) + return callback(exportError, nil); + NSDictionary *settings = [self getSettings]; + }]; +} + +@end diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/chunk_ends_type2.m b/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/chunk_ends_type2.m new file mode 100644 index 00000000..27e31cdc --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/chunk_ends_type2.m @@ -0,0 +1,32 @@ +#import <Foundation/Foundation.h> + +#define TESTCLASS_SINGLETON_FOR_CLASS(classname, accessorname) \ + static classname *shared##classname = nil; + +#define PUSH_CONTEXT(contextArg) \ + EAGLContext *oldContext = [EAGLContext currentContext]; \ + if (oldContext != contextArg) { \ + [EAGLContext setCurrentContext:contextArg]; \ + } + +#define POP_CONTEXT(contextArg) \ + if (oldContext != contextArg) { \ + [EAGLContext setCurrentContext:oldContext]; \ + } + +#define CURRENT_CONTEXT \ + NSOpenGLContext *currentContext = [NSOpenGLContext currentContext]; + +@interface TestClass : NSObject +@end + +@implementation TestClass + +TESTCLASS_SINGLETON_FOR_CLASS(TestClass, sharedInstance); + +- (void) drawSomething { + PUSH_CONTEXT(_context); + POP_CONTEXT(_context); +} + +@end diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/chunk_ends_type3.m b/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/chunk_ends_type3.m new file mode 100644 index 00000000..8d8676c8 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/chunk_ends_type3.m @@ -0,0 +1,11 @@ +#import <Foundation/Foundation.h> + +#define MACRO(foo) \ + if (_##foo == NULL) { \ + Log("do %s", str(foo)); \ + _##foo = (foo##_t *)process(PR_FLAG, str(foo)); \ + } + +#define OVERLOAD(base, foo) \ + foo##_override_t * foo##_bar = (foo##_override_t *)process(base##_bar, str(foo)); \ + _##foo##_override = (foo##_override_t *)process(base##_cache, str(foo)); diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/chunk_ends_type4.m b/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/chunk_ends_type4.m new file mode 100644 index 00000000..dd4d55fe --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/chunk_ends_type4.m @@ -0,0 +1,48 @@ +#import <Foundation/Foundation.h> + +@interface TestClass : NSObject +@end + +@implementation TestClass + +- (void)session_thumbnail_url:(NSDictionary *)data { + [session mergeCommonMovieItems:^(NSURL *exportURL, NSError *error) { +#if 0 + [response setValue:[thumbnailUrl absoluteString] forKey:@"thumbnail_url"]; +#else + NSString *extension = [thumbnailUrl pathExtension]; + NSData *imageData = [NSData dataWithContentsOfURL:thumbnailUrl]; + NSString *base64EncodedImage = [TestClassCommon Base64Encode:imageData]; + + NSString *base64Image = nil; + if ([extension isEqualToString:@"jpg"] == YES) { + base64Image = [NSString stringWithFormat:@"data:image/jpg;base64, %@", base64EncodedImage]; + } else { + base64Image = [NSString stringWithFormat:@"data:image/png;base64, %@", base64EncodedImage]; + } + [response setValue:base64Image forKey:@"thumbnail_url"]; +#endif + + [TestClassWebViewController sendEvent:[NSString stringWithFormat:@"session_thumbnail:%@", sessionId] withArgs:response]; + }]; +} + +- (void)addFoo:(NSDictionary *)postData { + [TestClassRequest performMethod:TestClassRequestMethodPOST + onResource:resource + usingParameters:postData + withAccount:[TestClass account] + sendingProgressHandler:nil + responseHandler:^(NSURLResponse *response, NSData *responseData, NSError *error) { + NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response; + if ([httpResponse statusCode] == 200) { +#if DEBUG + NSString *rsp = [[NSString alloc] initWithData:responseData encoding:NSUTF8StringEncoding]; + TestClassLog(@"TOGGLE CONNECTION ADDED response:%li responseData:%@ error:%@", (long) [((NSHTTPURLResponse *) response) statusCode], rsp, [error localizedDescription]); +#endif + NSJSONSerialization *jsonConnection = [responseData TestClassJSONObject]; + } + }]; +} + +@end diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/cmt_insert.m b/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/cmt_insert.m new file mode 100644 index 00000000..58a4c894 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/cmt_insert.m @@ -0,0 +1,53 @@ +@protocol spacingProtocol + +@property NSInteger spacing; + +@end + +@interface cmt_insert + ++ (cmt_insert*) shareInstance; + +@property (readonly) BOOL isAvailable; + +@property (copy) NSArray<NSString*>* contents; + +- (void) updateContents:(NSArray<NSString*>*) inContents andRefresh:(BOOL) inRefresh; + +@end + +@implementation cmt_insert + ++ (cmt_insert*) sharedInstance { +return nil; +} + +- (BOOL) isAvailable { +return YES; +} + +- (NSArray<NSString*>*) contents { +return @[]; +} + +- (void) setContents:(NSArray<NSString*>*) inContents { +} + +- (void) updateContents:(NSArray<NSString*>*) inContents andRefresh:(BOOL) inRefresh { +} + +@end + +@interface cmt_insert_with_protocol (spacingProtocol) +@end + +@implementation cmt_insert_with_protocol (spacingProtocol) + +- (NSInteger) spacing { +return 0; +} + +- (void) setSpacing:(NSInteger) inSpacing { +} + +@end diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/cmt_insert2.m b/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/cmt_insert2.m new file mode 100644 index 00000000..4a31e975 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/cmt_insert2.m @@ -0,0 +1,24 @@ + +NSURLResourceKey const NSURLCanonicalPathKey API_AVAILABLE(macosx(10.12), ios(10.0), watchos(3.0), tvos(10.0)); + +@interface foo () + +@property BOOL usesStrongWriteBarrier API_DEPRECATED("Garbage collection no longer supported", macosx(10.5, 10.12), ios(2.0, 10.0), watchos(2.0, 3.0), tvos(9.0, 10.0)); + +static const NSWindowStyleMask NSResizableWindowMask API_DEPRECATED_WITH_REPLACEMENT("NSWindowStyleMaskResizable", macosx(10.0, 10.12)) = NSWindowStyleMaskResizable; + +- (NSString*) extensionForType:(NSString*) inFileType API_AVAILABLE(macosx(10.12), ios(10.0), watchos(3.0), tvos(10.0)); + +@end + +@implementation foo + +- (NSString*) filePromiseProvider:(NSFilePromiseProvider*) inFilePromiseProvider fileNameForType:(NSString*) inFileType API_AVAILABLE(macos(10.12)) { +} +- (NSString*) filePromiseProvider:(NSFilePromiseProvider*) inFilePromiseProvider fileNameForType:(NSString*) inFileType API_DEPRECATED_WITH_REPLACEMENT(macos(10.12)) +{ +} +- (NSString*) filePromiseProvider:(NSFilePromiseProvider*) inFilePromiseProvider fileNameForType:(NSString*) inFileType API_UNAVAILABLE(macos(10.12)) { +} + +@end diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/code_placeholder.m b/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/code_placeholder.m new file mode 100644 index 00000000..6245bfa4 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/code_placeholder.m @@ -0,0 +1,5 @@ +double delayInSeconds = 2.0; +dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, (int64_t)(delayInSeconds * NSEC_PER_SEC)); +dispatch_after(popTime, dispatch_get_main_queue(), ^(void){ + <#code to be executed on the main queue after delay#> +}); diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/complex_method.m b/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/complex_method.m new file mode 100644 index 00000000..b22c34b6 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/complex_method.m @@ -0,0 +1,30 @@ +// Turn the document contents into a single savable lump of data +- (NSData *)dataOfType:(NSString *)typeName error:(NSError **)outError { +#pragma unused(typeName) + + // Produce the data lump: + NSData * retval = [NSKeyedArchiver archivedDataWithRootObject:model]; + + // If the lump is nil something went wrong + // fill out the error object to explain what wrent wrong + if ( outError != NULL ) { + // The sender wanted an error reported. If there + // was a problem, fill in an NSError object + if (retval == nil) { + // The error object should include an (unhelpful) + // explanation of what happened + NSDictionary * userInfoDict = [NSDictionary dictionaryWithObjectsAndKeys: + @"Internal error formatting data", NSLocalizedDescriptionKey, + @"Archiving of data failed. Probably a bug.", NSLocalizedFailureReasonErrorKey, + @"There's nothing you can do.", NSLocalizedRecoverySuggestionErrorKey, nil]; + + *outError = [NSError errorWithDomain:LinearInternalErrorDomain + code:linErrCantFormatDocumentData + userInfo:userInfoDict]; + } else { + // No problem. Don't supply an error object. + *outError = nil; + } + } + return retval; +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/delete-space-oc.mm b/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/delete-space-oc.mm new file mode 100644 index 00000000..66e24dc8 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/delete-space-oc.mm @@ -0,0 +1,69 @@ +/* EditorApplication */
+
+#include <string>
+
+#ifdef __OBJC__
+#import <Cocoa/Cocoa.h>
+
+class HierarchyState;
+@interface EditorApplication : NSObject
+{
+ IBOutlet id m_MainWindow;
+ IBOutlet id m_PaneController;
+ id m_RenderTimer;
+
+ IBOutlet id m_CutItem;
+ IBOutlet id m_CopyItem;
+ IBOutlet id m_PasteItem;
+
+ IBOutlet id m_DuplicateItem;
+ IBOutlet id m_DeleteItem;
+
+ IBOutlet id m_FrameSelectedItem;
+ IBOutlet id m_FindItem;
+ IBOutlet id m_SelectAllItem;
+}
+
+- (IBAction)SaveAssets:(id)sender;
+- (IBAction)CloseScene:(id)sender;
+- (IBAction)NewProject:(id)sender;
+- (IBAction)OpenProject:(id)sender;
+
+- (IBAction)SaveAsSceneToDisk:(id)sender;
+
+- (IBAction)EnterSerialNumber:(id)sender;
+- (IBAction)ReturnLicense:(id)sender;
+- (IBAction)CompileScene:(id)sender;
+- (IBAction)CompileSceneAutomatic:(id)sender;
+
+- (IBAction)saveDocument:(id)sender;
+
+- (IBAction)LoadSceneFromDisk:(id)sender;
+
+- (void)RemoveDisplayTimer;
+- (void)RegisterUpdateTimer:(int)frequency;
+
+- (void)refreshModifiedFile:(NSAppleEventDescriptor*)event withReplyEvent:(NSAppleEventDescriptor*)replyEvent;
+- (void)closeFile:(NSAppleEventDescriptor*)event withReplyEvent:(NSAppleEventDescriptor*)replyEvent;
+
+- (IBAction)ShowAboutDialog:(id)sender;
+- (IBAction)ShowPreferences:(id)sender;
+- (IBAction)ShowPackageManager:(id)sender;
+
+- (IBAction) delete:(id)sender;
+- (IBAction) copy:(id)action;
+- (IBAction)paste:(id)action;
+- (IBAction)duplicate:(id)action;
+- (IBAction)cut:(id)action;
+- (IBAction)selectAll:(id)action;
+- (IBAction)find:(id)action;
+- (IBAction)frameSelected:(id)action;
+- (IBAction)frameSelectedWithLock:(id)action;
+
+// Assetstore protocol handler and registration
+- (void)registerAssetStoreURLProtocol;
+- (void)getUrl:(NSAppleEventDescriptor*)event withReplyEvent:(NSAppleEventDescriptor*)replyEvent;
+
+@end
+
+#endif
diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/double-indent-objc-dict.m b/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/double-indent-objc-dict.m new file mode 100644 index 00000000..f94e5105 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/double-indent-objc-dict.m @@ -0,0 +1,17 @@ +id a = @{ + @"a": @1, + @"b": @2, +}; + +struct foo_t b = { + 1, + 2, +}; + +SomeObject *build() +{ + return @{ + @"a": @1, + @"b": @2, + }; +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/double_angle_space.m b/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/double_angle_space.m new file mode 100644 index 00000000..f7164498 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/double_angle_space.m @@ -0,0 +1,25 @@ +static const NSArray< id< NSObject> > **controllers = nil; + +NSArray< id< BlockController> > *someMethod(); + +@interface Fraction : NSObject +void Compute( + Image< E::Matrix<SType, Dim,1> > const& src, + Image<E::Matrix<TType,Dim,1> >& dst); +@end +@implementation SomeClass +- (void)initializeControllers:( NSArray< id< BlockController> > *)hybridContollers { + if (index < children.count) { + const unsigned int wl = w>>lvl; + + assert(x<0 && y>=3); +assert(y <0&&z> 2); +assert(a>>1); +assert(b >>1); + + return static_cast< id <CKMountable>>(children[index]); + } + +NSArray<id< BlockController> > *controllers = hybridContollers; +} +@end diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/exceptions.m b/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/exceptions.m new file mode 100644 index 00000000..c8d6f6f2 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/exceptions.m @@ -0,0 +1,23 @@ + +int main( int argc, const char *argv[] ) { + @try { + [NSException raise:NSInternalInconsistency + format:@"An internal inconsistency was raised"]; + } + @catch (NSException *e) { + NSLog(@"Catch"); + } + @finally { + NSLog(@"Finally"); + } + + @throw [NSException exceptionWithName:@"foo" reason:@"bar" userInfo:nil]; + +NSException *exception = [NSException exceptionWithName: @"HotTeaException" + reason: @"The tea is too hot" + userInfo: nil]; + +@throw exception; + + return 0; +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/extern-c-attribute.m b/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/extern-c-attribute.m new file mode 100644 index 00000000..fb84ce73 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/extern-c-attribute.m @@ -0,0 +1,16 @@ +struct +{ + int foo; +} bar; + +extern "C" int* i; +extern "C" { int* i; } +int *i; +extern "C" NSString* i; +extern "C" { NSString* i; } +NSString* i; + +__attribute__((visibility("default"))) int* i; +__attribute__((visibility("default"))) NSString* i; + +#define DEFINE_NOTIFICATION(name) extern "C" __attribute__((visibility ("default"))) NSString* const name = @#name; diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/for.m b/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/for.m new file mode 100644 index 00000000..fc159fc6 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/for.m @@ -0,0 +1,12 @@ +[[HRNewsService sharedInstance] fetchBreakingNewsItemWithId:self.breakingNewsId success:^(id responseObject) { + NSDictionary * thing; + for (NSArray * dictionary in photos) { + } +} failure:^(NSError *error) { + // Failure? +}]; + +// We also need to consider cases where a non-pointer type (or, a pointer without the star) is declared in ObjC. +for (id obj in someDictionary) { + NSLog(@"This could be anything! Objective-C really needs parametrized collections."); +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/for2.m b/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/for2.m new file mode 100644 index 00000000..535bc50b --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/for2.m @@ -0,0 +1,2 @@ +for (UIWindow *testWindow in [[UIApplication sharedApplication] windows]) { +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/func-param-wrap-oc.mm b/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/func-param-wrap-oc.mm new file mode 100644 index 00000000..16f98ce9 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/func-param-wrap-oc.mm @@ -0,0 +1,5 @@ + if(progress <= 0)
+ {
+ [[NSBezierPath bezierPathWithOvalInRect:NSMakeRect(NSMinX(pieRect)+stroke,NSMinY(pieRect)+stroke,
+ NSWidth(pieRect)-2*stroke,NSHeight(pieRect)-2*stroke)] fill];
+ }
diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/func_def.mm b/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/func_def.mm new file mode 100644 index 00000000..b3655728 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/func_def.mm @@ -0,0 +1,13 @@ +#import <Foundation/Foundation.h> + +extern "C" void function1(void *self, uint32_t *arg2, uint32_t * arg3); + +MACRO1(void, function2, type1 arg1, type2 arg2, const type1 * arg3); + +MACRO2(status_t, function3, + void *arg1, + const sp<IFoo>&arg2) { +} + +MACRO2(type4, function4, const void **arg1, type1 arg2, const type3 * arg3, type4 arg4, type4 arg5, bool arg6) { +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/gh137.m b/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/gh137.m new file mode 100644 index 00000000..779e0f2f --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/gh137.m @@ -0,0 +1,18 @@ +[UIView animateWithDuration:0.2f delay:0.f options:UIViewAnimationCurveEaseInOut animations: ^{ + self.transform = CGAffineTransformMakeScale(1.05f, 1.05f); +} completion: ^(BOOL finished) { + [UIView animateWithDuration:0.08f delay:0.f options:UIViewAnimationOptionCurveEaseInOut animations: ^{ + self.transform = CGAffineTransformIdentity; + [UIView animateWithDuration:1 delay:0 options:0 animations:^ { + // blah + } completion:nil]; + }]; +}]; + +dispatch_async(foo, ^{ + dispatch_async(bar, ^{ + dispatch_async(qux, ^{ + quz(); + }); + }); +}) diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/gh293.m b/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/gh293.m new file mode 100644 index 00000000..bb4cb52c --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/gh293.m @@ -0,0 +1,15 @@ +self.someErrorView = ({ + UIView *view = [[UIView alloc] init]; + view.backgroundColor = [UIColor redColor]; + [view addSubview:({ + self.someErrorLabel = ({ + UILabel *label = [[UILabel alloc] init]; + label.textAlignment = NSTextAlignmentCenter; + label.backgroundColor = [UIColor clearColor]; + label; + }); + })]; + view; +}); +[self.view addSubview:self.someErrorView]; + diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/gh511.m b/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/gh511.m new file mode 100644 index 00000000..cee32794 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/gh511.m @@ -0,0 +1,3 @@ +BOOL valid = YES; +NSDictionary *p = valid ? @{@"Test": @"Example"} : nil; + diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/i1213.m b/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/i1213.m new file mode 100644 index 00000000..f47e5964 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/i1213.m @@ -0,0 +1,9 @@ +int main (int argc, const char * argv[]) +{ + switch (argc) + { + case 0 ... 1: + return 1; + } + return 0; +}
\ No newline at end of file diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/indent-inside-ternary-operator.m b/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/indent-inside-ternary-operator.m new file mode 100644 index 00000000..ff979acf --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/indent-inside-ternary-operator.m @@ -0,0 +1,102 @@ +flag + ? [Cmpnt Cmpnt:(isChildActionSheet ? TypeBack : TypeCancel)] + : nil; + + +[[BottomSheetItem alloc] + iconName:selected + ? g.re + .at + : g + .re + .at + builder:nil + handler:^{ + } +] + + +[[BottomSheetItem alloc] + iconName:selected + ? iconName : g + .re + .at + builder:nil + handler:^{ + } +] + +(event + ? [FSBottomSheetActionCellItemVariant + action:AKAction<> :: actionFromSenderlessBlock(^{ + auto const strongSelf = weakSelf; +})] + : nil); + + +[[ViewController alloc] strategy: (strategy + ? [QuestionMarkStmt new] + : [ColonStmt new]) +toolbox: _one]; + +[[ViewController alloc] strategy: (strategy + ?: [SourceStrategy new]) +toolbox: _two]; + + + +flag1 +? ( flag2 + ? ( flag3 + ? [ViewController selector1:^{ + NSLog(@"selector1"); +}] + : [ViewController selector2:^(){ + NSLog(@"selector2"); +}] ) + : ( result3 ) + ) + : ( flag5 + ? ( flag + ? result4 + : [ViewController preSelector:flag selector3:{ + .x = 10, + }]) + : ( flag6 + ? [ViewController preSelector:flag selector3:^{ + NSLog(@"selector3"); + }] + : ( result7 ) + ) + ); + + +flag1 +? result1 + : ( + flag5 + ); + + + +showButton ? Action<>::actionFromBlock(^(Component *component) { + return nil; + }) : nil; + +showButton +? Action<>::actionFromBlock(^(Component *component) { + return nil; + }) + : nil; + + showButton +? Action<>::actionFromBlock(^(Component *component) { + return nil; + }) : nil; + + +showButton + ? Action<>::actionFromBlock([](Component *component) { + return nil; + }) + : nil; diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/indent-objc-block.m b/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/indent-objc-block.m new file mode 100644 index 00000000..b882abf5 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/indent-objc-block.m @@ -0,0 +1,149 @@ +const auto c = + [FDSTapTargetComponent + accessibilityContext:{ + .accessibilityLabel = ^{ + return [AccessibilityLabelBuilder build]; + } + }]; + +methodCall1(^{ + send(component1); +}, + x); + +methodCall2( ^ { + send(component2); + }); + +[array block:^ (id obj, NSUInteger idx, BOOL *stop) { + NSLog(@"Object at index %lu is %@", idx, obj); + }]; + + + [UIView animateWithDuration:3.0f animation:^{ + LOG(@"animate"); + } + completion:^(BOOL finished){ + LOG(@"finished"); + }]; + +[UIView + animationBlock: ^ { + [[Log alloc] callback:^NSString *(NSString *result){ + return @"log"; + }]; + } + completion:^(BOOL finished){ + LOG(@"finished"); + }]; + + +methodCall3(x, ^KSC::ActionCell::Item (Item item) { + variant.action.send(component); + }); + +methodCall4( x, ^ id (Component *c) { + NSLog(@"methodCall4"); + }); + +methodCall5( ^ id (Component *c) { + NSLog(@"methodCall5"); + }); + +methodCall6( ^(NSString *)(Component *c) { + return @"methodCall6"; + }); + +methodCall7(^ (Component *c) { + NSLog(@"methodCall7"); + }, y); + + methodCall8(x, ^(Component *c) { + NSLog(@"methodCall8"); + }, y); + + + [Object callMethod:xArg + block:^id (Component *c) { + NSLog(@"methodCall4"); + }]; + +[Object callMethod:xArg + block:^id (Component *c) { + NSLog(@"methodCall5"); + }]; + +[Object callMethod:xArg block:^(NSString *)(Component *c) { + return @"methodCall6"; + }]; + + +[Object callMethod:xArg + block:^ (Component *c) { + NSLog(@"methodCall7"); + } + yMethod:yArg]; + + [Object callMethod:xArg + block:^(Component *c) { + NSLog(@"methodCall8"); + } + yMethod:yArg]; + +[Object callMethod:xArg +block:^(NSString *)(Component *c1) { + [Object callMethod:xArg block:^(Component *c) { + NSLog(@"methodCal9"); + } + yMethod:yArg]; + } + anotherBlock:^(NSString *)(Component *c2) { + return @"methodCall10"; + } + yetAnotherBlock:^(NSString *)(Component *c3) { + return @"methodCall11"; + }]; + +[dialog + dismissWithCompletion:^{ + _deleteConversation( + strongSelf->_session, + ^{ + if (auto const innerStrongSelf = weakSelf) { + [NavigationCoordinator(innerStrongSelf) + dismissViewController:innerStrongSelf + completion:nil]; + } + }); + }]; + + + [FlexboxComponent +newWithView:{ + { + .accessibilityLabel = ^{ + return + [[[[AccessibilityLabelBuilder builder] + appendPhrase:title] + appendPhrase:body] + getResult]; + }, + } + }]; + + +MainComponent( + .builder = ^{ + return + value; +}, +param1, +param2, + ); + +KSC::map( + _items, + ^ ActionCell::Item (Item item) { + return x; + } +); diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/indent_boxed.m b/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/indent_boxed.m new file mode 100644 index 00000000..c7df968f --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/indent_boxed.m @@ -0,0 +1,74 @@ + +- (IBAction) copy:(nullable id) inSender { +NSPasteboard* const pasteboard = NSPasteboard.generalPasteboard; +[pasteboard clearContents]; +[pasteboard writeObjects:@[ +[NSPasteboardItem pasteboardItemWithProvider:self forTypes:@[ NSPasteboardTypePDF ] +andData:@[ kNSUTIExportedAgaroseGel, +[NSKeyedArchiver archivedDataWithRootObject:self.selectedIndexes.count != 0 ? [self.gels objectsAtIndexes:self.selectedIndexes] : self.gels] +]] +]]; +} + +- (IBAction) copy:(nullable id) inSender { +NSPasteboard* const pasteboard = NSPasteboard.generalPasteboard; +[pasteboard clearContents]; +[pasteboard writeObjects:@[[NSPasteboardItem pasteboardItemWithProvider:self forTypes:@[ NSPasteboardTypePDF ] andData:@[ +kNSUTIExportedAgaroseGel, [NSKeyedArchiver archivedDataWithRootObject:self.selectedIndexes.count != 0 ? [self.gels objectsAtIndexes:self.selectedIndexes] : self.gels] +]] ]]; + +NSArray* a = @[]; +NSArray* b = @[@1,@2,@3]; +NSArray* c = @[ +@1, @2, @3 +]; +NSArray* d = @[@[@1], @[@2], @[@3]]; +NSArray* e = @[ +@[@1], @[@2], @[@3] +]; +NSMutableArray* f = [NSMutableArray arrayWithArray:@[@[@1], @[@2], @[@3]]]; +NSMutableArray* g = [NSMutableArray arrayWithArray:@[ +@[@1], @[@2], @[@3] +]]; +NSMutableDictionary* d1 = [NSMutableDictionary dictionaryWithDictionary:@{ +@"Keys":@[ +@{@"A": @1}, +@{@"B": @2}. +@{@"C": @3} +] +}]; +} + +inline static void installGelMarkers(void) { +[NSOperationQueue.mainQueue addOperationWithBlock:^{ +[accessoryView.textStorage setAttributedString:[[NSAttributedString alloc] initWithString:error.localizedDescription attributes:@{ NSFontAttributeName: [NSFont systemFontOfSize:NSFont.systemFontSize] }]]; +NSAlert *alert = [[NSAlert alloc] init]; +}]; +} + +[[NSAttributedString alloc] initWithString:inJunction.reverseName attributes:@{ +NSFontAttributeName: font, +NSForegroundColorAttributeName: inJunction.reverseColor +}]; +@{ +NSFontAttributeName: self.font, +NSForegroundColorAttributeName: inJunction.forwardColor +} +[[NSAttributedString alloc] initWithString:inJunction.reverseName attributes:@{ NSFontAttributeName: font, NSForegroundColorAttributeName: inJunction.reverseColor }]; +[[NSAttributedString alloc] initWithString:inJunction.reverseName +attributes:@{ NSFontAttributeName: font, NSForegroundColorAttributeName: inJunction.reverseColor }]; +- (void) drawReversePrimerForJunction:(GibsonJunction*) inJunction bounds:(NSRect) inBounds { +NSString* const string1 = nil, +string2 = nil, +string3 = nil; +//does not compile but does test shift operator formatting +std::ostringstream ostream; +ostream << "hello" +<< ' ' +<< "world"; +NSString* const string = inJunction.reversePrimer; +[attributedString appendAttributedString:[[NSAttributedString alloc] initWithString:[string substringToIndex:range.location] attributes:@{ +NSFontAttributeName: self.font, +NSForegroundColorAttributeName: inJunction.forwardColor +}]]; +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/indent_oc_inside_msg_sel.m b/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/indent_oc_inside_msg_sel.m new file mode 100644 index 00000000..f20cd048 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/indent_oc_inside_msg_sel.m @@ -0,0 +1,71 @@ +[NSPasteboardItem pasteboardItemWithProvider:self + forTypes:@[ NSPasteboardTypePDF ] + andData:@[ + kNSUTIExportedAgaroseGel, + [NSKeyedArchiver archivedDataWithRootObject:self.selectedIndexes.count != 0 ?[self.gels objectsAtIndexes:self.selectedIndexes] : self.gels] + ]]; + +[ViewController simple_First:firstArg +simple_Two:secondArg +simple_3:thirdArg]; + + +[ViewController preFirst:( + pre_1_arg + )]; + +[ViewController firstSelectorOne:arg1 preFirst:( + pre_1_arg + )]; + +[ViewController preFirst:^{ + return arg4; + } + firstSelectorOne:arg1]; + +[ViewController firstSelectorOne:arg1 preFirst:^{ + return arg4; +}]; + +[ViewController firstSelectorOne:(flag + ? arg5_1 + : arg5_2 + ) toolbox:_toolbox]; + +[ViewController preFirst:( + pre_1_arg + ) + firstSelectorOne: + arg1 + selector_two:( + arg2 + ) + Selector_3:{ + .arg3 = 1 + } + fourth_Selector:^{ + return arg4; + } + selector_number_5:(flag + ? arg5_1 + : arg5_2 + ) + selector_number_5:(flag + ? arg5_1 + : arg5_2 + ) + sixSel:(flag + ?: arg6_1) + seventh_selector:( + arg7 + ) + toolboxSel:toolboxArg]; + +[[ViewController alloc] strategy:(strategy + ? [QuestionMarkStmt new] + : [ColonStmt new]) + toolbox:_one]; + +[[ViewController alloc] strategy:(strategy + ?: [SourceStrategy new]) + toolbox:_two]; diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/indent_single_newline.m b/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/indent_single_newline.m new file mode 100644 index 00000000..27e79e8a --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/indent_single_newline.m @@ -0,0 +1,15 @@ + +- (BOOL)isSomethingTrue:(BOOL) something{ + + if (something){ + //Yes it's true + + return YES; + } + else { + //No it's false + + return NO; + } + +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/issue_2629.m b/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/issue_2629.m new file mode 100644 index 00000000..e690ea58 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/issue_2629.m @@ -0,0 +1,20 @@ +@implementation SomeClass +- (void)someMethod +{ + enumerateItems ( + ^( NSInteger section) { + } ); +} + +- (void)someOtherMethod +{ + items.enumerateItems ( + ^(NSInteger section, NSInteger index, id<NSObject> object, BOOL *stop) { + enumerator(index, object, TypeInsert); + }, + nil, + some_param + ); +} +@end + diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/issue_2631.m b/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/issue_2631.m new file mode 100644 index 00000000..7989b020 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/issue_2631.m @@ -0,0 +1,17 @@ +@protocol SomeProtocol +Props Method(const Contents &options = {}); +@end + +@interface SomeClass +Props Method1(const Contents &options = {}); +@end + + +@implementation SomeClass +Props Method1(const Contents options = {}); +@end + +void Method2(const Contents options = {}) { +} + +void Method3(const Contents &options = { .text = 10 }); diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/issue_2675.m b/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/issue_2675.m new file mode 100644 index 00000000..1d4cafe2 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/issue_2675.m @@ -0,0 +1,66 @@ +@interface Example1 : NSObject + typedef ObjectType0 X; +typedef ObjectType1 _Nullable (^Handler1)(id<Fragment> fragment); +typedef ObjectType2 _Nullable (^Handler2)(id<Fragment> fragment); +@end + +@interface Example2 : NSObject + typedef ObjectType1 _Nullable (^Handler1)(id<Fragment> fragment); +typedef ObjectType2 _Nullable (^Handler2)(id<Fragment> fragment); +@end + +@interface AnotherExample1 : NSObject + SOME_MACRO_OPEN +- (instancetype)init; + +SOME_MACRO_CLOSE +@end + +SOME_MACRO_OPEN +@interface AnotherExample2 : NSObject +SOME_MACRO_CLOSE +- (instancetype)init; + +@end + +@interface SomeInterface : NSObject + + // Some comment goes here +@end + +@interface YetAnotherExample : NSObject + + // What about this comment + // here +- (instancetype)init; +@end + +@interface YetOneAnotherExample : NSObject + +/// What about this comment +/// here +- (instancetype)init; +@end + +@interface YetOneOtherExample : NSObject + + /// What about this comment + /// here +- (instancetype)init; +@end + + +@interface YetOneMoreExample : NSObject + + /* Different comment pattern */ +- (instancetype)init; +@end + + +@interface YetOneMoreOtherExample : NSObject + + /* Multiline + Comments + */ +- (instancetype)init; +@end diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/issue_2722.m b/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/issue_2722.m new file mode 100644 index 00000000..65dcb131 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/issue_2722.m @@ -0,0 +1,4 @@ +// Pointer inside OC message +[*messageClass.rlock () paramName : argValue]; +[*messageClass1 paramName1 : argValue1]; +[*someClass->var sendMessage:@"message"]; diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/issue_2724.m b/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/issue_2724.m new file mode 100644 index 00000000..51c90671 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/issue_2724.m @@ -0,0 +1,19 @@ +// OC mesg inside array/dictionary +_sections1 = @[ +[ SectionModel resultsWithContacts:contacts] +]; + +_sections2 = @[ +[[SectionModel mesg] resultsWithContacts1: contacts1], +[[SectionModel mesg] resultsWithContacts2: contacts2] +]; + +_sections3 = @[[SectionModel resultsWithContacts:contacts]]; + +@[ + something + ]; + +@[ + [something mesg] + ]; diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/issue_2727.m b/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/issue_2727.m new file mode 100644 index 00000000..f15542f1 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/issue_2727.m @@ -0,0 +1,2 @@ +typedef NSArray<NSString *> * (^ Finder )(NSArray *); +typedef NSArray< NSString * > * (^ Handler )( NSDictionary< NSString * , NSArray * > *); diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/issue_3031.mm b/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/issue_3031.mm new file mode 100644 index 00000000..028d55d9 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/issue_3031.mm @@ -0,0 +1,4 @@ + if (flag) { + [video fcls:filter.class strength : fv]; +} +[values forKey:(filterID)]; diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/kw.m b/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/kw.m new file mode 100644 index 00000000..a4d25624 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/kw.m @@ -0,0 +1,31 @@ +#include <stdio.h> +#include <objc/Object.h> + +@protocol Job +- do; +@end + +@interface MyJob: Object<Job> +- do; +@end +@implementation MyJob +- do +{ + printf("Doing Job\n"); + return self; +} +@end + +@interface JobExecutor: Object +- doWith: (id<Job>) job for: (int) count; +@end + +@implementation JobExecutor +- doWith: (id<Job>) job for: (int) count +{ + for (int i = 0; i < count; ++i) { + [job do]; + } + return self; +} +@end diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/literals.mm b/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/literals.mm new file mode 100644 index 00000000..98522f3d --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/literals.mm @@ -0,0 +1,44 @@ + +NSDictionary *dictionary = @{@0: @"red", @1: @"green", @2: @"blue"}; + +NSArray *array = @[@0, @1, @2, @YES, @'Z', @42U]; + +NSArray *multilineArray = @[ +@0, @1, @2, @YES, +@'Z', @42U +]; + +void main(int argc, const char *argv[]) { + // character literals. + NSNumber *theLetterZ = @'Z'; // equivalent to [NSNumber numberWithChar:'Z'] + + // integral literals. + NSNumber *fortyTwo = @42; // equivalent to [NSNumber numberWithInt:42] + NSNumber *fortyTwoUnsigned = @42U; // equivalent to [NSNumber numberWithUnsignedInt:42U] + NSNumber *fortyTwoLong = @42L; // equivalent to [NSNumber numberWithLong:42L] + NSNumber *fortyTwoLongLong = @42LL; // equivalent to [NSNumber numberWithLongLong:42LL] + + // floating point literals. + NSNumber *piFloat = @3.141592654F; // equivalent to [NSNumber numberWithFloat:3.141592654F] + NSNumber *piDouble = @3.1415926535; // equivalent to [NSNumber numberWithDouble:3.1415926535] + + // BOOL literals. + NSNumber *yesNumber = @YES; // equivalent to [NSNumber numberWithBool:YES] + NSNumber *noNumber = @NO; // equivalent to [NSNumber numberWithBool:NO] + + // Raw string literals + NSString *rawString = [NSString stringWithFormat:@R"(embedded " quotes " )"]; + NSString *delimiterRawString = [NSString stringWithFormat:@R"<<<(embedded "quotes ')<<<"]; + NSString *groupIDString = [NSString stringWithFormat:@R"({"group_id " : " % @",})", groupID]; + NSString *config = @R"({"config_v1" : [ + {"op1" : {"type":{"unsupported1":{}}},"markers":[123]}, + {"op2" : {"type":{"jobs":{"suspend":true,"resume":false}}},"markers":[1]}, + {"op3" : {"type":{"Good Format":{}}},"markers":[123]} + ]})"; + + +#ifdef __cplusplus + NSNumber *trueNumber = @true; // equivalent to [NSNumber numberWithBool:(BOOL)true] + NSNumber *falseNumber = @false; // equivalent to [NSNumber numberWithBool:(BOOL)false] +#endif +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/macro-close-brace.m b/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/macro-close-brace.m new file mode 100644 index 00000000..0eb3fa81 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/macro-close-brace.m @@ -0,0 +1,18 @@ +#import <Foundation/Foundation.h> + +#if TARGET_RT_BIG_ENDIAN +#define FourCC2Str(fourcc) (const char[]) { *((char *) &fourcc), *(((char *) &fourcc) + 1), *(((char *) &fourcc) + 2), *(((char *) &fourcc) + 3), 0} +#else +#define FourCC2Str(fourcc) (const char[]) { *(((char *) &fourcc) + 3), *(((char *) &fourcc) + 2), *(((char *) &fourcc) + 1), *(((char *) &fourcc) + 0), 0} +#endif + +#if 1 +#define SYNCHRONIZED_BEGIN(x) @synchronized(x) { +#define SYNCHRONIZED_END } +#else +#define SYNCHRONIZED_BEGIN(x) +#define SYNCHRONIZED_END +#endif + +#define AUTORELEASEPOOL_BEGIN @autoreleasepool { +#define AUTORELEASEPOOL_END } diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/main.m b/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/main.m new file mode 100644 index 00000000..f2fdf16a --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/main.m @@ -0,0 +1,21 @@ +#import <stdio.h> +#import "Fraction.h" + +int main( int argc, const char *argv[] ) { + // create a new instance + Fraction *frac = [[Fraction alloc] init]; + + // set the values + [frac setNumerator: 1]; + [frac setDenominator: 3]; + + // print it + printf( "The fraction is: " ); + [frac print]; + printf( "\n" ); + + // free memory + [frac release]; + + return 0; +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/method_ends_semicolon.m b/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/method_ends_semicolon.m new file mode 100644 index 00000000..e3c5637e --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/method_ends_semicolon.m @@ -0,0 +1,18 @@ +#import <Foundation/Foundation.h> + +@interface TestClass + ++ (void)cancelRequest:(id)request; + +@end + +@implementation TestClass + +// Occasionally there will be user errors where someone will +// copy the interface method declaration to implementation +// and leaves the semicolon ++ (void)cancelRequest:(id)request; +{ +} + +@end diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/misc.m b/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/misc.m new file mode 100644 index 00000000..5038a14c --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/misc.m @@ -0,0 +1,27 @@ +- (id)init +{ +GLfloat wc[3][3] = {{ 0.6, 0.6, 0.0 }, { 1.0, 0.7, 0.1 }, { 0.5, 0.7, 0.2 +},}; +GLfloat cc[3][3] = {{ 0.0, 0.0, 0.6 }, { 0.3, 0.1, 0.5 }, { 0.0, 0.0, 0.5 +},}; +GLfloat sc[3] = {0.75, 0.75, 0.75}; + +return [self initWithWarmColors:(float *)&wc coolColors:(float *)&cc +surfaceColor:sc enableTexturing:NO enableSpecular:YES +enableQuakeDisruptor:NO]; + + [NSException raise:NSInternalInconsistency + format:@"An internal inconsistency was raised"]; + +for (i = 0; i <[a count]; i++) { +[thePerson setAmount:(1.5 * 17)forKey:@"overtime"]; +[screen showtext : x : y : @"Message"]; + } +} + +*outError = [NSError errorWithDomain:NSCocoaErrorDomain +code:0 +userInfo:[NSDictionary +dictionaryWithObject:@"Some Description" +forKey:NSLocalizedDescriptionKey]]; + diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/more_blocks.m b/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/more_blocks.m new file mode 100644 index 00000000..eab01db0 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/more_blocks.m @@ -0,0 +1,53 @@ +int (^myBlock)(int) = ^(int num) { return num * multiplier; }; +// for comparison +int (*fcnptr)(int); + +int d = i % 10; +repeat(10, ^{ putc('0'+d); }); + + +void (^block)(void); +typedef void (^vstr_t)(char *); +typedef void (^workBlk_t)(void); + +void AllLinesInFile(char *f, vstr_t block) { + FILE *fp = fopen(f, "r"); + if (!fp) return; + char line[1024]; + while (fgets(line, 1024, fp)) + block(line); + fclose(fp); +} + + +@implementation NSArray (WWDC) +- (NSArray *)map:(id (^)(id))xform { + id result = [NSMutableArray array]; + for (id elem in self) + [result addObject:xform(elem)]; + return result; +} + +- (NSArray *)collect:(BOOL ( ^ )(id))predicate { + id result = [NSMutableArray array]; + for (id elem in self) + if (predicate(elem)) + [result addObject:elem]; + return result; +} + +// corner case: block literal in use with return type +id longLines = [allLines collect: ^ BOOL (id item) { + return [item length] > 20; +}]; + +// corner case: block literal in use with return type +id longLines = [allLines collect: ^ BOOL* (id item) { + return [item length] > 20; +}]; + +@end + +// 1. block literal: ^{ ... }; +// 2. block declaration: return_t (^name) (int arg1, int arg2, ...) NB: return_t is optional and name is also optional +// 3. block inline call ^ return_t (int arg) { ... }; NB: return_t is optional diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/more_blocks_2.m b/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/more_blocks_2.m new file mode 100644 index 00000000..55636ae5 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/more_blocks_2.m @@ -0,0 +1,18 @@ +// Test a case where blocks wrapped by parentheses were causing the parser to crash +int (^myBlock)(int) = ( ^(int num) { + return num * multiplier; +}); + +dispatch_async(thread, (^{ + dispatch_async(thread, ^{ + dispatch_async(thread, ^{ + NSLog(@"Hooray for dispatch_async!"); + }); + }); +})); + +// Example of a unit test using Kiwi +beforeAll(^{ + NSString *serviceURL = [NSURL URLWithString:@"http://TEST_URL"]; + NSLog(serviceURL); +}); diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/msg.m b/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/msg.m new file mode 100644 index 00000000..cca460f9 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/msg.m @@ -0,0 +1,3 @@ +[obj doSomething:0 withArgs:@""]; +[@"" doSomething:0 withArgs:@""]; +NSString *result = (id)[obj arg:param value:3]; diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/msg_align.m b/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/msg_align.m new file mode 100644 index 00000000..3b61a051 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/msg_align.m @@ -0,0 +1,56 @@ + +BOOL immediatlyReady = [self ensureResource:mutableResources[0] + existsInDirectoryAtPath:mutablePaths[0] + queueMode:mode + completionHandler:completionHandler + errorHandler:errorHandler]; + +[myObject doFooWith1:arg1 name1:arg2 // some lines with >1 arg + error1:arg3]; + +[myObject doFooWith2:arg4 + name2:arg5 error2:arg6]; + +[myObject doFooWith3:arg7 + name3:arg8 // aligning keywords instead of colons + error3:arg9]; + +[myObject doithereguysA:argA + reallylongargname:argB another:argC]; + + int foo() +{ +[UIView transitionWithView:self.window + duration:0.3 + options:UIViewAnimationOptionTransitionCrossDissolve + animations:^{ + BOOL oldState = [UIView areAnimationsEnabled]; + [UIView setAnimationsEnabled:NO]; + self.window.rootViewController = self.viewController; + [UIView setAnimationsEnabled:oldState]; + } + completion:^(BOOL finished) { + +BOOL foo; + }]; +} + + int foo2() +{ +[UIView transitionWithView:self.window duration:0.3 options:UIViewAnimationOptionTransitionCrossDissolve animations:^{ + BOOL oldState = [UIView areAnimationsEnabled]; + [UIView setAnimationsEnabled:NO]; + self.window.rootViewController = self.viewController; + [UIView setAnimationsEnabled:oldState]; + } + completion:^(BOOL finished) { + +BOOL foo; + }]; + + [[HRNewsService sharedInstance] registerPushToken:deviceToken success:^{ + DLog(@"Finished Registering Push Token!"); + self.notificationsEnabled = YES; + } fail:nil]; + +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/negative_value.m b/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/negative_value.m new file mode 100644 index 00000000..9aa4dc80 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/negative_value.m @@ -0,0 +1,12 @@ +#import <Foundation/Foundation.h> + +int main(void) { + int i = -1; + NSNumber *foo1 = @-1; + NSNumber *foo2 = @(-1); + NSNumber *foo3 = @1; + NSNumber *foo4 = @(1); + NSNumber *foo5 = @(i); + + return 0; +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/nelem.m b/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/nelem.m new file mode 100644 index 00000000..d42ce3b6 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/nelem.m @@ -0,0 +1,10 @@ +#import <Foundation/Foundation.h> + +/* get #of elements in a static array */ +#ifndef NELEM +#define NELEM(x) ((int) (sizeof(x) / sizeof((x)[0]))) +#endif + +int main(void) { + return 0; +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/nl_func_call_args_multi_line_ignore_closures.m b/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/nl_func_call_args_multi_line_ignore_closures.m new file mode 100644 index 00000000..ea132bab --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/nl_func_call_args_multi_line_ignore_closures.m @@ -0,0 +1,85 @@ +mapToPtr(^(const LeftAddOn::Props &addOnProps) { + FSTheme *const theme = AK::getTheme(); +}); + +mapToPtr( x, ^ (const Props &addOnProps) { + FSTheme *const theme = AK::getTheme(); +}); + +mapToPtr( ^ (const Props &addOnProps) { + FSTheme *const theme = AK::getTheme(); +}); + +mapToPtr( arg1, ^ ( NSString * ) (const Props &addOnProps) { + FSTheme *const theme = AK::getTheme(); +}, arg2); + +mapToPtr(arg1, ^ ( NSString *) (const Props &addOnProps) { + FSTheme *const theme = AK::getTheme(); +}); + +mapToPtr( ^() (const Props &addOnProps) { + FSTheme *const theme = AK::getTheme(); +}, arg2); + + + +methodCall(^{ + variant.action.send(Cmpnt); + }); + + methodCall( + ^{ + variant.action.send(Cmpnt); + }, x); + + +methodCall( x, ^id (Cmpnt *c) { + NSLog(@"Something"); + }); + +methodCall( ^id (Cmpnt *c) { + NSLog(@"Something"); + }); + +methodCall( ^(Cmpnt *c) { + NSLog(@"Something"); + }); + +methodCall( + ^ (Cmpnt *c) { + NSLog(@"Something"); + }, y); + + methodCall(x, ^(Cmpnt *c) { + NSLog(@"Something"); + }, y); + + +methodCall(arg1, +arg2, arg3); + +methodCall(arg1, arg2, arg3); + +methodCall(arg1, arg2, { + .x = 10, +}); + +methodCall(arg1, { + .x = 10, +}, arg2); + +methodCall({ + .x = 10, +}, arg2); + + +outerMethodCall(methodCall(^{ + // action +}, + x)); + +outerMethodCall(methodCall(^{ + variant.action.send(Cmpnt); +}, + x)); diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/ns_enum.m b/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/ns_enum.m new file mode 100644 index 00000000..cdd729d8 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/ns_enum.m @@ -0,0 +1,27 @@ +// The semicolons at the end of these declarations are not superfluous. +typedef NS_ENUM (NSUInteger, MyEnum) {MyValue1, MyValue2, MyValue3}; +typedef NS_OPTIONS (NSUInteger, MyBitmask) {MyBit1, MyBit2, MyBit3}; + +// NS_ENUM specifies the type and name of the enum. +typedef enum { +MyValue1, +MyValue2, +MyValue3 +} MyEnum; +typedef NS_ENUM (NSUInteger, MyEnum) { +MyValue1, +MyValue2, +MyValue3 +}; + +// NS_OPTIONS is equivalent to NS_ENUM, but semantically used for bitmask enums. +typedef enum { +MyBit1 = (1u << 0), +MyBit2Longer = (1u << 1), +MyBit3ThatIsConsiderablyMoreVerbose = (1u << 2) +} MyBitmask; +typedef NS_OPTIONS (NSUInteger, MyBitmask) { +MyBit1 = (1u << 0), +MyBit2Longer = (1u << 1), +MyBit3ThatIsConsiderablyMoreVerbose = (1u << 2) +}; diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/oc-split.m b/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/oc-split.m new file mode 100644 index 00000000..3b656bfc --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/oc-split.m @@ -0,0 +1,10 @@ +[self findstart:&startBarcode end:&endBarcode forLine:greenScalePixels derivative:greenDerivative centerAt:xAxisCenterPoint min:&minValue max:&maxValue]; + +[self findstart:&startBarcode + end:&endBarcode + forLine:greenScalePixels + derivative:greenDerivative + centerAt:xAxisCenterPoint + min:&minValue + max:&maxValue]; + diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/oc_cond_colon.m b/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/oc_cond_colon.m new file mode 100644 index 00000000..50cf56b5 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/oc_cond_colon.m @@ -0,0 +1,9 @@ +[self.vendorID_TextField setStringValue:string ? string : @""]; + +x = [NSString str:path]; +x = [NSString strFormat:@"Data/%s", path]; +x = path[0] == '/' ? path : "abc"; +x = path[0] == '/' ? [NSString str:path] : [NSString strFormat:@"Data/%s", path]; + +id<MTLBuffer> buf = data ? [metal::g_Device newBufferWithBytes:data length:len options:MTLResourceOptionCPUCacheModeDefault] + : [metal::g_Device newBufferWithLength:len options:MTLResourceOptionCPUCacheModeDefault]; diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/oc_msg_in_pp.m b/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/oc_msg_in_pp.m new file mode 100644 index 00000000..8496973b --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/oc_msg_in_pp.m @@ -0,0 +1,18 @@ +#import <Foundation/Foundation.h> + +#define UIColorFromRGB(rgbValue) [UIColor colorWithRed:((float) ((rgbValue & 0xFF0000) >> 16)) / 255.0 green:((float) ((rgbValue & 0xFF00) >> 8)) / 255.0 blue:((float) (rgbValue & 0xFF)) / 255.0 alpha:1.0] + +#if TARGET_OS_IPHONE +#define GL_CONTEXT_ALLOC(parentContext) [[EAGLContext alloc] initWithAPI:GL_CONTEXT_VERSION(parentContext) sharegroup:[parentContext sharegroup]] +#else +#define GL_CONTEXT_ALLOC(parentContext) [[NSOpenGLContext alloc] initWithFormat:[[NSOpenGLPixelFormat alloc] initWithCGLPixelFormatObj:CGLGetPixelFormat([parentContext CGLContextObj])] shareContext:parentContext] +#endif + +#define NSLocalizedString(key, comment) \ + [TestClassBundle localizedStringForKey:(key) value:@"" table:nil] + +@interface TestClass : NSObject +@end + +@implementation TestClass +@end diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/pp_bool.m b/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/pp_bool.m new file mode 100644 index 00000000..b1bf896c --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/pp_bool.m @@ -0,0 +1,5 @@ +#import <Foundation/Foundation.h> + +#if TARGET_OS_MAC && !TARGET_OS_IPHONE +#import <AppKit/AppKit.h> +#endif diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/properties.m b/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/properties.m new file mode 100644 index 00000000..4de60057 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/properties.m @@ -0,0 +1,12 @@ +#define nonnull_strong nonnull, strong +#define myatomic nonatomic +@interface UCTestClass () + +@property (nonatomic, strong, null_unspecified, readonly) NSString* test1; +@property (strong, readonly, nonatomic, nullable) NSString* test2; +@property (strong, readonly, getter=test2Getter, nonatomic, nonnull) NSString* test3; +@property (strong, readonly, getter=test2Getter, nonatomic, setter=test2Setter:, null_resettable) NSString* test4; +@property (class, readonly, getter=test5Getter, nonatomic, nonnull, assign) NSString* test5; +@property (class, assign, getter=test5Getter, myatomic, nonnull_strong) NSString* test6; + +@end diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/protocol.m b/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/protocol.m new file mode 100644 index 00000000..31a8b86f --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/protocol.m @@ -0,0 +1,30 @@ + +NSAssert( [self.delegate conformsToProtocol: @protocol( UISearchBarDelegate )], @"Some Error." ); + +Protocol *counter = @protocol(ReferenceCounting); + +@protocol ReferenceCounting + +- setRefCount:(int)count; + +- (int)refCount; + +- incrementCount; + +- decrementCount; + +@end + +@interface Formatter : NSObject < Formatting, Prettifying > + +@end + +if ( [receiver conformsTo:@protocol(ReferenceCounting)] ) + [receiver incrementCount]; + +@protocol B; + +@protocol A +- Foo:(id <B>)anObject; +@end + diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/react_native.m b/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/react_native.m new file mode 100644 index 00000000..eadf314f --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/react_native.m @@ -0,0 +1,42 @@ +#import "FOOAddressBookManager.h" +#import <React/RCTBridge.h> +#import <React/RCTEventDispatcher.h> + +/* + * #define RCT_EXPORT_METHOD(method) \ + * - (void)__rct_export__##method { \ + * __attribute__((used, section("__DATA,RCTExport"))) \ + * static const char *__rct_export_entry__[] = { __func__, #method }; \ + * } \ + * - (void)method \ + */ + +@interface FOOAddressBook:NSObject +@end + +@implementation FOOAddressBookManager + +RCT_EXPORT_MODULE(FOOAddressBook) + +RCT_EXPORT_METHOD(getAddresses: (NSDictionary*) data callback:(RCTResponseSenderBlock) callback) +{ + NSMutableArray* addresses = [[FOOAddressBook sharedInstance] getAddresses:data]; + if (addresses != nil) + callback(@[[NSNull null], addresses]); + else + callback(@[@"getAddresses returned nil."]); +} + +RCT_EXPORT_METHOD(getStatus : (RCTResponseSenderBlock) callback) +{ + callback(@[[NSNull null], [[FOOAddressBook sharedInstance] getStatus]]); +} + +RCT_EXPORT_METHOD(requestAccess : (RCTResponseSenderBlock) callback) +{ + [[FOOAddressBook sharedInstance] requestAccess:^(NSString* status) { + callback(@[[NSNull null], status]); + }]; +} + +@end diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/real_world_file.m b/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/real_world_file.m new file mode 100644 index 00000000..26ec3cb2 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/real_world_file.m @@ -0,0 +1,225 @@ +/* + File: ATColorTableController.m + Abstract: A controller used by the ATImageTextCell to edit the color property. It is implemented in an abstract enough way to be used by a class other than the cell. + + Version: 1.0 + + Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple + Inc. ("Apple") in consideration of your agreement to the following + terms, and your use, installation, modification or redistribution of + this Apple software constitutes acceptance of these terms. If you do + not agree with these terms, please do not use, install, modify or + redistribute this Apple software. + + In consideration of your agreement to abide by the following terms, and + subject to these terms, Apple grants you a personal, non-exclusive + license, under Apple's copyrights in this original Apple software (the + "Apple Software"), to use, reproduce, modify and redistribute the Apple + Software, with or without modifications, in source and/or binary forms; + provided that if you redistribute the Apple Software in its entirety and + without modifications, you must retain this notice and the following + text and disclaimers in all such redistributions of the Apple Software. + Neither the name, trademarks, service marks or logos of Apple Inc. may + be used to endorse or promote products derived from the Apple Software + without specific prior written permission from Apple. Except as + expressly stated in this notice, no other rights or licenses, express or + implied, are granted by Apple herein, including but not limited to any + patent rights that may be infringed by your derivative works or by other + works in which the Apple Software may be incorporated. + + The Apple Software is provided by Apple on an "AS IS" basis. APPLE + MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION + THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS + FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND + OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS. + + IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL + OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, + MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED + AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE), + STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + + Copyright (C) 2009 Apple Inc. All Rights Reserved. + + */ + +#import "ATColorTableController.h" +#import "ATPopupWindow.h" + +@implementation ATColorTableController + ++ (ATColorTableController *)sharedColorTableController { + static ATColorTableController *gSharedColorTableController = nil; + if (gSharedColorTableController == nil) { + gSharedColorTableController = [[[self class] alloc] initWithNibName:@"ColorTable" bundle:[NSBundle bundleForClass:[self class]]]; + } + return gSharedColorTableController; +} + +@synthesize delegate = _delegate; +@dynamic selectedColor, selectedColorName; + +- (void)dealloc { + [_colorList release]; + [_colorNames release]; + [_window release]; + [super dealloc]; +} + +- (void)loadView { + [super loadView]; + _colorList = [[NSColorList colorListNamed:@"Crayons"] retain]; + _colorNames = [[_colorList allKeys] retain]; + [_tableColorList setIntercellSpacing:NSMakeSize(3, 3)]; + [_tableColorList setTarget:self]; + [_tableColorList setAction:@selector(_tableViewAction:)]; +} + +- (NSColor *)selectedColor { + NSString *name = [self selectedColorName]; + if (name != nil) { + return [_colorList colorWithKey:name]; + } else { + return nil; + } +} + +- (NSString *)selectedColorName { + if ([_tableColorList selectedRow] != -1) { + return [_colorNames objectAtIndex:[_tableColorList selectedRow]]; + } else { + return nil; + } +} + +- (void)_selectColor:(NSColor *)color { + // Search for that color in our list + NSInteger row = 0; + for (NSString *name in _colorNames) { + NSColor *colorInList = [_colorList colorWithKey:name]; + if ([color isEqual:colorInList]) { + break; + } + row++; + } + _updatingSelection = YES; + if (row != -1) { + [_tableColorList scrollRowToVisible:row]; + [_tableColorList selectRowIndexes:[NSIndexSet indexSetWithIndex:row] byExtendingSelection:NO]; + } else { + [_tableColorList scrollRowToVisible:0]; + [_tableColorList selectRowIndexes:[NSIndexSet indexSet] byExtendingSelection:NO]; + } + _updatingSelection = NO; +} + +- (void)_createWindowIfNeeded { + if (_window == nil) { + NSRect viewFrame = self.view.frame; + // Create and setup our window + _window = [[ATPopupWindow alloc] initWithContentRect:viewFrame styleMask:NSBorderlessWindowMask backing:NSBackingStoreBuffered defer:NO]; + [_window setReleasedWhenClosed:NO]; + [_window setLevel:NSPopUpMenuWindowLevel]; + [_window setHasShadow:YES]; + [[_window contentView] addSubview:self.view]; + [_window makeFirstResponder:_tableColorList]; + + // Make the window have a clear color and be non-opaque for our pop-up animation + [_window setBackgroundColor:[NSColor clearColor]]; + [_window setOpaque:NO]; + } +} + +- (void)_windowClosed:(NSNotification *)note { + if (_eventMonitor) { + [NSEvent removeMonitor:_eventMonitor]; + _eventMonitor = nil; + } + [[NSNotificationCenter defaultCenter] removeObserver:self name:NSWindowWillCloseNotification object:_window]; + [[NSNotificationCenter defaultCenter] removeObserver:self name:NSApplicationDidResignActiveNotification object:nil]; +} + +- (void)_closeAndSendAction:(BOOL)sendAction { + [_window close]; + if (sendAction) { + if ([self.delegate respondsToSelector:@selector(colorTableController:didChooseColor:named:)]) { + [self.delegate colorTableController:self didChooseColor:self.selectedColor named:self.selectedColorName]; + } + } else { + if ([self.delegate respondsToSelector:@selector(didCancelColorTableController:)]) { + [self.delegate didCancelColorTableController:self]; + } + } +} + +- (void)_windowShouldClose:(NSNotification *)note { + [self _closeAndSendAction:NO]; +} + +- (void)editColor:(NSColor *)color locatedAtScreenRect:(NSRect)rect { + [self _createWindowIfNeeded]; + [self _selectColor:color]; + NSPoint origin = rect.origin; + NSRect windowFrame = [_window frame]; + // The origin is the lower left; subtract the window's height + origin.y -= NSHeight(windowFrame); + // Center the popup window under the rect + origin.y += floor(NSHeight(rect) / 3.0); + origin.x -= floor(NSWidth(windowFrame) / 2.0); + origin.x += floor(NSWidth(rect) / 2.0); + + [_window setFrameOrigin:origin]; + [_window popup]; + + // Add some watches on the window and application + [[NSNotificationCenter defaultCenter] addObserver:self + selector:@selector(_windowClosed:) + name:NSWindowWillCloseNotification + object:_window]; + + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_windowShouldClose:) name:NSApplicationDidResignActiveNotification object:nil]; + + // Start watching events to figure out when to close the window + NSAssert(_eventMonitor == nil, @"_eventMonitor should not be created yet"); + _eventMonitor = [NSEvent addLocalMonitorForEventsMatchingMask:NSLeftMouseDownMask | NSRightMouseDownMask | NSOtherMouseDownMask | NSKeyDownMask handler: ^(NSEvent *incomingEvent) { + NSEvent *result = incomingEvent; + NSWindow *targetWindowForEvent = [incomingEvent window]; + if (targetWindowForEvent != _window) { + [self _closeAndSendAction:NO]; + } else if ([incomingEvent type] == NSKeyDown) { + if ([incomingEvent keyCode] == 53) { + // Escape + [self _closeAndSendAction:NO]; + result = nil; // Don't process the event + } else if ([incomingEvent keyCode] == 36) { + // Enter + [self _closeAndSendAction:YES]; + result = nil; + } + } + return result; + }]; +} + +- (NSInteger)numberOfRowsInTableView:(NSTableView *)tableView { + return _colorNames.count; +} + +- (id)tableView:(NSTableView *)tableView objectValueForTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)row { + return [_colorNames objectAtIndex:row]; +} + +- (void)tableView:(NSTableView *)tableView willDisplayCell:(id)cell forTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)row { + NSColor *color = [_colorList colorWithKey:[_colorNames objectAtIndex:row]]; + [cell setColor:color]; +} + +- (void)_tableViewAction:(id)sender { + [self _closeAndSendAction:YES]; +} + +@end + diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/receiver.m b/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/receiver.m new file mode 100644 index 00000000..274d4130 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/receiver.m @@ -0,0 +1,10 @@ +#import <Cocoa/Cocoa.h> + +@implementation MyDocument + +- (NSString*) appPath { + [ AClass AFunc ]; + return [NSSearchPathForDirectoriesInDomains ( NSDocumentDirectory, NSUserDomainMask, YES ) lastObject]; +} + +@end diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/return_type.m b/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/return_type.m new file mode 100644 index 00000000..62a5c246 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/return_type.m @@ -0,0 +1,36 @@ +#import <Foundation/NSObject.h> +#import <stdio.h> + +@interface Fraction : NSObject { + int numerator; + int denominator; +} +-(void) print; +-(void)setNumerator:(int)d; +-(void)setDenominator:(int)d; +-(int) numerator; +-(int)denominator; +-(void) setNumDen:(int)n:(int)d; +@end + +@implementation Fraction +-(void)print { + printf("%i/%i", numerator, denominator); +} + +-(void) setNumerator:(int)n { + numerator = n; +} + +-(void) setDenominator:(int)d { + denominator = d; +} + +-(int) denominator { + return(denominator); +} + +-(int) numerator { + return(numerator); +} +@end diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/selector.m b/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/selector.m new file mode 100644 index 00000000..a5a89475 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/selector.m @@ -0,0 +1,7 @@ +@selector(methodNameWithArg:); +@selector (methodNameNoArg); +@selector (methodNameArg1:arg2: ); + +NSArray *sortedTZs = [ [ NSTimeZone knownTimeZoneNames ] +sortedArrayUsingSelector : @selector ( compare: ) ]; + diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/sort_import.m b/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/sort_import.m new file mode 100644 index 00000000..1a227b7e --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/sort_import.m @@ -0,0 +1,32 @@ +// should be ddd, eee, fff +#import "ddd" +#import "fff" +#import "eee" + +#import "ccc" +#import "aaa" +// should be just bbb +#import "bbb" + +#import "sort_import.h" +#import "sort_import+internal.h" +#import "sort_import+public.h" + +#import "Action+Internal.h" +#import "Action+Public.h" +#import <UIKit/UIKit.h> +#import "Action.h" + +#include "Test+Internal.h" +#include "Test.h" + +#import "Something_Internal.h" +#import "Something_Public.h" +#import "Something.h" + +#import "AAA" +#import "BBB.h" +#include "DDD" +#import "EEE.h" +#import <KKK> +#include "CCC.h" diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/sort_import_group.m b/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/sort_import_group.m new file mode 100644 index 00000000..9e14f0fc --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/sort_import_group.m @@ -0,0 +1,48 @@ +#import "ddd" +#import "fff" +#import "eee" + +#import "ccc" +#import "aaa" +#import "bbb" + +#import "Action+Public.h" + + + +#import "sort_import.h" +#import "sort_import+internal.h" + +#import "sort_import+public.h" +#import <Foundation/Foundation.h> + +#import "Action+Internal.h" +#import "Action+Internal.hpp" +#import "Action+Public.h" +#import <UIKit/UIKit.h> +#import "Action.h" + +#include "Test+Internal.h" +#include "Test.h" + +#import "DDD.h" +#import "BBB.h" + +#import "Something_Internal.h" +#import "Something_Public.h" +#import "Something.h" + +#import "AAA" +#import "BBB.h" +#import <SSS> +#import "AAABBB" +#import "AAA" +#include "DDD" + +#import "EEE.h" +#import <KKK> +#import <KKK> // Duplicate with comment +#import <SSS> +#include "CCC.h" + +#include "Test.h" diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/sp_after_angle.m b/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/sp_after_angle.m new file mode 100644 index 00000000..259d2011 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/sp_after_angle.m @@ -0,0 +1,21 @@ +#import <Foundation/Foundation.h> + +@interface TestClass2 : TestClassNavigationViewController{ + BOOL foo; +} + +@implementation TestClass2 + +@end + +@interface TestClass : TestClassNavigationViewController<UIWebViewDelegate, UIActionSheetDelegate>{ + NSURL *webpageUrl; + UIWebView *webView; + BOOL toolbarVisible; + BOOL loading; + NSString *endPrefix; +} + +@implementation TestClass + +@end diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/sp_after_oc_msg_receiver.m b/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/sp_after_oc_msg_receiver.m new file mode 100644 index 00000000..aad36be5 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/sp_after_oc_msg_receiver.m @@ -0,0 +1,11 @@ +#import <Foundation/Foundation.h> + +@implementation TestClass + +- (void)testMethod { + NSData *jsonData = [self dataUsingEncoding:NSUTF8StringEncoding]; + id jsonParsedObj = [jsonSerializationClass JSONObjectWithData:jsonData options:0 error:&jsonError]; + NSString *ret = [[TestClass sharedInstance] testString]; +} + +@end diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/sp_before_oc_proto_list.m b/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/sp_before_oc_proto_list.m new file mode 100644 index 00000000..c0d96bdb --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/sp_before_oc_proto_list.m @@ -0,0 +1,25 @@ +@protocol ControllerDelegate<NSObject, Controller> +@end + +@protocol Controller <NSObject> +@end + +@interface CollectionViewController () <DataSource> { +} +@end + +@interface CollectionViewController (Flow)<FlowDelegate> : NSObject +{ + NSDictionary <NSString *, NSString *> dict; +} +@end + +@interface MyClass : NSObject <Protocol_A, Protocol_B> + +@end + +@implementation ViewController +- (void)someMethod { + auto const *dict = [NSMutableDictionary < NSString *, NSString * > new]; +} +@end diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/sp_inside_braces_oc_dict.m b/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/sp_inside_braces_oc_dict.m new file mode 100644 index 00000000..272a2f28 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/sp_inside_braces_oc_dict.m @@ -0,0 +1,7 @@ +#import <Foundation/Foundation> + +int main(void) { + NSDictionary *productParameters = @{ @"id": appStoreID }; + NSDictionary *options = @{ AVURLAssetPreferPreciseDurationAndTimingKey: @YES }; + NSDictionary *baz = @{foo : bar}; +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/sp_oc_boxed.m b/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/sp_oc_boxed.m new file mode 100644 index 00000000..0c6948c0 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/sp_oc_boxed.m @@ -0,0 +1,9 @@ + +- (void) foo { + NSArray* a = @[]; + NSDictionary* b = @{}; + NSArray<NSString*>* array = @[@"hello", @"world"]; + NSDictionary<NSString*, NSString*>* dictionary = @{@"foo":@"bar", @"foo2":@"bar2"}; + + NSString* const type = [pasteboard availableTypeFromArray:@[NSPasteboardTypeString]]; +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/sp_oc_catch.m b/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/sp_oc_catch.m new file mode 100644 index 00000000..a5354dfe --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/sp_oc_catch.m @@ -0,0 +1,18 @@ + +- (void) foo:(NSString*) inString +{ + @try { + }@catch(NSException* const inException) + { + } +} + +- (void) bar:(NSString*) inString +{ + @try { + } + @catch (NSException* const inException){ + } + @finally { + } +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/sp_oc_classname_paren-r.m b/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/sp_oc_classname_paren-r.m new file mode 100644 index 00000000..1076bbb3 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/sp_oc_classname_paren-r.m @@ -0,0 +1,2 @@ +@interface TestObject(categoryName) <ProtocolName> : BaseClass +@end diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/sp_oc_synchronized.m b/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/sp_oc_synchronized.m new file mode 100644 index 00000000..e4de748b --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/sp_oc_synchronized.m @@ -0,0 +1,11 @@ +- (void) unobserveAllKeyPaths { +@synchronized(self){ +} +} +#if 1 +#define SYNCHRONIZED_BEGIN(x) @synchronized(x) { +#define SYNCHRONIZED_END } +#else +#define SYNCHRONIZED_BEGIN(x) +#define SYNCHRONIZED_END +#endif diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/string.m b/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/string.m new file mode 100644 index 00000000..f3fca80f --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/string.m @@ -0,0 +1,11 @@ + +- (void)moreScannedData:(Image*)img from:(int)start to:(int)stop; +-(void)moreScannedData : (Image*)img from : (int)start to : (int)stop; + +public bool Enabled +{ + NSString* whatever = @"some lovely text, the fox and co"; + + a = (enderedImage->h - toplines - bottomlines); +} + diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/ternary.m b/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/ternary.m new file mode 100644 index 00000000..3fdddd93 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/ternary.m @@ -0,0 +1,5 @@ +NSString *str = (otherString ?: @"this is the placeholder"); +NSString *str2 = (str ? otherString : @"this is the other placeholder"); +NSString *str3 = str ? [[NSString alloc] initWithString:str] : @"this is the third placeholder"; +id str4 = str ? [self methodWithParameter1:@{@"bla": ({[self anotherMethod:@{@"id": @1}];})} + andParameter2:@{@"dict_key": @{@"nested_dict_key_1": @(1), @"nested_dict_key_2": @"colon:in:string"}}] : [self anotherMethod:str? @1 : @2];
\ No newline at end of file diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/typeof.m b/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/typeof.m new file mode 100644 index 00000000..d5183a1d --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/oc/typeof.m @@ -0,0 +1,12 @@ +#import <Foundation/Foundation.m> + +@implementation MyViewController + +- (void)method1 { + __weak __typeof(self)weakSelf1 = self; + __weak typeof(self)weakSelf2 = self; + __weak MyViewController *weakSelf3 = self; + NSString* srcStr = [[NSString alloc] initWithBytes: kShaderSource length: sizeof(kShaderSource) encoding: NSASCIIStringEncoding]; +} + +@end |