Skip to content

Commit 0a3dc50

Browse files
committed
chore: Run clang-format on everything
1 parent bd2c08d commit 0a3dc50

File tree

19 files changed

+1095
-910
lines changed

19 files changed

+1095
-910
lines changed

example/App.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ export default class App extends Component<Props, State> {
5454
this.setState({restarting: true}, () => this.setState({restarting: false}));
5555
};
5656

57-
_changeTest = testName => {
57+
_changeTest = (testName) => {
5858
this.setState({currentTest: TESTS[testName]});
5959
};
6060

example/ios/AsyncStorageExample/AsyncStorageDevSupport.m

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
return [bridge moduleForClass:[RNCAsyncStorage class]];
1212
}
1313

14-
@interface AsyncStorageTestSupport : NSObject<RCTBridgeModule>
14+
@interface AsyncStorageTestSupport : NSObject <RCTBridgeModule>
1515
@end
1616

1717
@implementation AsyncStorageDevSupport {
@@ -139,14 +139,14 @@ @implementation AsyncStorageTestSupport
139139

140140
RCT_EXPORT_MODULE()
141141

142-
RCT_EXPORT_METHOD(test_setDelegate:(RCTResponseSenderBlock)callback)
142+
RCT_EXPORT_METHOD(test_setDelegate : (RCTResponseSenderBlock)callback)
143143
{
144144
RNCAsyncStorage *asyncStorage = RNCAsyncStorageGetInstance(_bridge);
145145
asyncStorage.delegate = _sharedInstance;
146146
callback(@[]);
147147
}
148148

149-
RCT_EXPORT_METHOD(test_unsetDelegate:(RCTResponseSenderBlock)callback)
149+
RCT_EXPORT_METHOD(test_unsetDelegate : (RCTResponseSenderBlock)callback)
150150
{
151151
RNCAsyncStorage *asyncStorage = RNCAsyncStorageGetInstance(_bridge);
152152
asyncStorage.delegate = nil;

example/macos/AsyncStorageExample-macOSUITests/AsyncStorageExample_macOSUITests.m

Lines changed: 125 additions & 115 deletions
Original file line numberDiff line numberDiff line change
@@ -5,155 +5,165 @@
55
* LICENSE file in the root directory of this source tree.
66
*/
77

8-
#import <XCTest/XCTest.h>
98
#import <RNCAsyncStorage/RNCAsyncStorage.h>
9+
#import <XCTest/XCTest.h>
1010

1111
@interface AsyncStorageExample_macOSUITests : XCTestCase
1212

1313
@end
1414

15-
@implementation AsyncStorageExample_macOSUITests
16-
{
17-
XCUIApplication *_app;
18-
XCUIElement *_window;
19-
XCUIElement *_restartButton;
20-
XCUIElement *_getSetClearButton;
21-
XCUIElement *_mergeItemButton;
15+
@implementation AsyncStorageExample_macOSUITests {
16+
XCUIApplication *_app;
17+
XCUIElement *_window;
18+
XCUIElement *_restartButton;
19+
XCUIElement *_getSetClearButton;
20+
XCUIElement *_mergeItemButton;
2221
}
2322

24-
- (void)setUp {
25-
// In UI tests it is usually best to stop immediately when a failure occurs.
26-
self.continueAfterFailure = NO;
23+
- (void)setUp
24+
{
25+
// In UI tests it is usually best to stop immediately when a failure occurs.
26+
self.continueAfterFailure = NO;
2727

28-
_app = [[XCUIApplication alloc] init];
29-
[_app launch];
30-
31-
_window = _app.windows[@"RNCAsyncStorageExample macOS"];
32-
XCTAssert(_window.exists);
28+
_app = [[XCUIApplication alloc] init];
29+
[_app launch];
3330

34-
_restartButton = _window.otherElements[@"restart_button"].staticTexts.firstMatch;
35-
XCTAssert(_restartButton.exists);
31+
_window = _app.windows[@"RNCAsyncStorageExample macOS"];
32+
XCTAssert(_window.exists);
3633

37-
_getSetClearButton = _window.buttons[@"testType_getSetClear"].staticTexts.firstMatch;
38-
XCTAssert(_getSetClearButton.exists);
34+
_restartButton = _window.otherElements[@"restart_button"].staticTexts.firstMatch;
35+
XCTAssert(_restartButton.exists);
3936

40-
_mergeItemButton = _window.buttons[@"testType_mergeItem"].staticTexts.firstMatch;
41-
XCTAssert(_mergeItemButton.exists);
42-
43-
[self sendTestAppCommand:@"rnc-asyncstorage://clear-all-storage"];
37+
_getSetClearButton = _window.buttons[@"testType_getSetClear"].staticTexts.firstMatch;
38+
XCTAssert(_getSetClearButton.exists);
39+
40+
_mergeItemButton = _window.buttons[@"testType_mergeItem"].staticTexts.firstMatch;
41+
XCTAssert(_mergeItemButton.exists);
42+
43+
[self sendTestAppCommand:@"rnc-asyncstorage://clear-all-storage"];
4444
}
4545

46-
- (void)testShouldStoreValueInAsyncStorage {
47-
[self sendTestAppCommand:@"rnc-asyncstorage://unset-delegate"];
46+
- (void)testShouldStoreValueInAsyncStorage
47+
{
48+
[self sendTestAppCommand:@"rnc-asyncstorage://unset-delegate"];
49+
50+
[_getSetClearButton click];
4851

49-
[_getSetClearButton click];
52+
XCUIElement *storedNumber = _window.staticTexts[@"storedNumber_text"];
5053

51-
XCUIElement *storedNumber = _window.staticTexts[@"storedNumber_text"];
54+
XCTAssertEqualObjects(storedNumber.label, @"");
5255

53-
XCTAssertEqualObjects(storedNumber.label, @"");
56+
XCUIElement *increaseBy10Button =
57+
_window.buttons[@"increaseByTen_button"].staticTexts.firstMatch;
5458

55-
XCUIElement *increaseBy10Button = _window.buttons[@"increaseByTen_button"].staticTexts.firstMatch;
59+
int tapTimes = arc4random_uniform(10) + 1;
5660

57-
int tapTimes = arc4random_uniform(10) + 1;
58-
59-
for (int i = 0; i < tapTimes; i++) {
60-
[increaseBy10Button click];
61-
}
61+
for (int i = 0; i < tapTimes; i++) {
62+
[increaseBy10Button click];
63+
}
6264

63-
NSString *expectedText = [NSString stringWithFormat:@"%d", tapTimes * 10];
64-
65-
XCTAssertEqualObjects(storedNumber.label, expectedText);
65+
NSString *expectedText = [NSString stringWithFormat:@"%d", tapTimes * 10];
66+
67+
XCTAssertEqualObjects(storedNumber.label, expectedText);
6668
}
6769

68-
- (void)testShouldClearItem {
69-
[self sendTestAppCommand:@"rnc-asyncstorage://unset-delegate"];
70+
- (void)testShouldClearItem
71+
{
72+
[self sendTestAppCommand:@"rnc-asyncstorage://unset-delegate"];
7073

71-
[_getSetClearButton click];
74+
[_getSetClearButton click];
7275

73-
XCUIElement *increaseBy10Button = _window.buttons[@"increaseByTen_button"].staticTexts.firstMatch;
74-
[increaseBy10Button click];
76+
XCUIElement *increaseBy10Button =
77+
_window.buttons[@"increaseByTen_button"].staticTexts.firstMatch;
78+
[increaseBy10Button click];
7579

76-
XCUIElement *clearButton = _window.buttons[@"clear_button"].staticTexts.firstMatch;
77-
[clearButton click];
78-
[_restartButton click];
80+
XCUIElement *clearButton = _window.buttons[@"clear_button"].staticTexts.firstMatch;
81+
[clearButton click];
82+
[_restartButton click];
7983

80-
XCUIElement *storedNumber = _window.staticTexts[@"storedNumber_text"];
81-
XCTAssertEqualObjects(storedNumber.label, @"");
84+
XCUIElement *storedNumber = _window.staticTexts[@"storedNumber_text"];
85+
XCTAssertEqualObjects(storedNumber.label, @"");
8286
}
8387

84-
- (NSString *)performInputWithFormat:format {
85-
NSString *name = arc4random_uniform(2) == 0 ? @"Jerry" : @"Sarah";
86-
NSString *age = arc4random_uniform(2) == 0 ? @"21" : @"23";
87-
NSString *eyeColor = arc4random_uniform(2) == 0 ? @"blue" : @"green";
88-
NSString *shoeSize = arc4random_uniform(2) == 0 ? @"9" : @"10";
89-
90-
XCUIElement *nameInput = _window.textFields[@"testInput-name"];
91-
[nameInput click];
92-
[nameInput typeText:name];
93-
94-
XCUIElement *ageInput = _window.textFields[@"testInput-age"];
95-
[ageInput click];
96-
[ageInput typeText:age];
97-
98-
XCUIElement *eyesInput = _window.textFields[@"testInput-eyes"];
99-
[eyesInput click];
100-
[eyesInput typeText:eyeColor];
101-
102-
XCUIElement *showInput = _window.textFields[@"testInput-shoe"];
103-
[showInput click];
104-
[showInput typeText:shoeSize];
105-
106-
return [NSString stringWithFormat:format, name, age, eyeColor, shoeSize];
88+
- (NSString *)performInputWithFormat:format
89+
{
90+
NSString *name = arc4random_uniform(2) == 0 ? @"Jerry" : @"Sarah";
91+
NSString *age = arc4random_uniform(2) == 0 ? @"21" : @"23";
92+
NSString *eyeColor = arc4random_uniform(2) == 0 ? @"blue" : @"green";
93+
NSString *shoeSize = arc4random_uniform(2) == 0 ? @"9" : @"10";
94+
95+
XCUIElement *nameInput = _window.textFields[@"testInput-name"];
96+
[nameInput click];
97+
[nameInput typeText:name];
98+
99+
XCUIElement *ageInput = _window.textFields[@"testInput-age"];
100+
[ageInput click];
101+
[ageInput typeText:age];
102+
103+
XCUIElement *eyesInput = _window.textFields[@"testInput-eyes"];
104+
[eyesInput click];
105+
[eyesInput typeText:eyeColor];
106+
107+
XCUIElement *showInput = _window.textFields[@"testInput-shoe"];
108+
[showInput click];
109+
[showInput typeText:shoeSize];
110+
111+
return [NSString stringWithFormat:format, name, age, eyeColor, shoeSize];
107112
}
108113

109-
- (void)testShouldMergeItemsInAsyncStorage {
110-
[self sendTestAppCommand:@"rnc-asyncstorage://unset-delegate"];
111-
112-
[_mergeItemButton click];
113-
114-
XCUIElement *saveItemButton = _window.buttons[@"saveItem_button"].staticTexts.firstMatch;
115-
XCUIElement *restoreItemButton = _window.buttons[@"restoreItem_button"].staticTexts.firstMatch;
116-
XCUIElement *mergeItemButton = _window.buttons[@"mergeItem_button"].staticTexts.firstMatch;
117-
XCUIElement *storyText = _window.staticTexts[@"storyTextView"];
118-
119-
NSString *messageFormat = @"%@ is %@, has %@ eyes and shoe size of %@.";
120-
121-
NSString *story = [self performInputWithFormat:messageFormat];
122-
[saveItemButton click];
123-
[_restartButton click];
124-
[restoreItemButton click];
125-
XCTAssertEqualObjects(storyText.label, story);
126-
[_restartButton click];
127-
128-
// merging here
129-
130-
NSString *newStory = [self performInputWithFormat:messageFormat];
131-
[mergeItemButton click];
132-
[_restartButton click];
133-
[restoreItemButton click];
134-
XCTAssertEqualObjects(storyText.label, newStory);
114+
- (void)testShouldMergeItemsInAsyncStorage
115+
{
116+
[self sendTestAppCommand:@"rnc-asyncstorage://unset-delegate"];
117+
118+
[_mergeItemButton click];
119+
120+
XCUIElement *saveItemButton = _window.buttons[@"saveItem_button"].staticTexts.firstMatch;
121+
XCUIElement *restoreItemButton = _window.buttons[@"restoreItem_button"].staticTexts.firstMatch;
122+
XCUIElement *mergeItemButton = _window.buttons[@"mergeItem_button"].staticTexts.firstMatch;
123+
XCUIElement *storyText = _window.staticTexts[@"storyTextView"];
124+
125+
NSString *messageFormat = @"%@ is %@, has %@ eyes and shoe size of %@.";
126+
127+
NSString *story = [self performInputWithFormat:messageFormat];
128+
[saveItemButton click];
129+
[_restartButton click];
130+
[restoreItemButton click];
131+
XCTAssertEqualObjects(storyText.label, story);
132+
[_restartButton click];
133+
134+
// merging here
135+
136+
NSString *newStory = [self performInputWithFormat:messageFormat];
137+
[mergeItemButton click];
138+
[_restartButton click];
139+
[restoreItemButton click];
140+
XCTAssertEqualObjects(storyText.label, newStory);
135141
}
136142

137-
- (void)testMergeItemDelegate {
138-
[self sendTestAppCommand:@"rnc-asyncstorage://set-delegate"];
139-
140-
[_mergeItemButton click];
141-
142-
XCUIElement *saveItemButton = _window.buttons[@"saveItem_button"].staticTexts.firstMatch;
143-
XCUIElement *restoreItemButton = _window.buttons[@"restoreItem_button"].staticTexts.firstMatch;
144-
XCUIElement *mergeItemButton = _window.buttons[@"mergeItem_button"].staticTexts.firstMatch;
145-
XCUIElement *storyText = _window.staticTexts[@"storyTextView"];
146-
147-
NSString *story = [self performInputWithFormat:@"%@ from delegate is %@ from delegate, has %@ eyes and shoe size of %@."];
148-
[mergeItemButton click];
149-
[_restartButton click];
150-
[restoreItemButton click];
151-
XCTAssertEqualObjects(storyText.label, story);
143+
- (void)testMergeItemDelegate
144+
{
145+
[self sendTestAppCommand:@"rnc-asyncstorage://set-delegate"];
146+
147+
[_mergeItemButton click];
148+
149+
XCUIElement *saveItemButton = _window.buttons[@"saveItem_button"].staticTexts.firstMatch;
150+
XCUIElement *restoreItemButton = _window.buttons[@"restoreItem_button"].staticTexts.firstMatch;
151+
XCUIElement *mergeItemButton = _window.buttons[@"mergeItem_button"].staticTexts.firstMatch;
152+
XCUIElement *storyText = _window.staticTexts[@"storyTextView"];
153+
154+
NSString *story =
155+
[self performInputWithFormat:
156+
@"%@ from delegate is %@ from delegate, has %@ eyes and shoe size of %@."];
157+
[mergeItemButton click];
158+
[_restartButton click];
159+
[restoreItemButton click];
160+
XCTAssertEqualObjects(storyText.label, story);
152161
}
153162

154-
- (void)sendTestAppCommand:(NSString *)URLString {
155-
[[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:URLString]];
156-
sleep(.25);
163+
- (void)sendTestAppCommand:(NSString *)URLString
164+
{
165+
[[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:URLString]];
166+
sleep(.25);
157167
}
158168

159169
@end

example/windows/AsyncStorageExample/App.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
#include "pch.h"
2+
23
#include "App.h"
4+
35
#include "ReactPackageProvider.h"
46

57
using namespace winrt::AsyncStorageExample;
@@ -30,10 +32,11 @@ App::App() noexcept
3032
InstanceSettings().EnableDeveloperMenu(false);
3133
#endif
3234

33-
PackageProviders().Append(make<ReactPackageProvider>()); // Includes all modules in this project
35+
// Includes all modules in this project
36+
PackageProviders().Append(make<ReactPackageProvider>());
3437
PackageProviders().Append(winrt::ReactNativeAsyncStorage::ReactPackageProvider());
3538

36-
REACT_REGISTER_NATIVE_MODULE_PACKAGES(); //code-gen macro from autolink
39+
REACT_REGISTER_NATIVE_MODULE_PACKAGES(); // code-gen macro from autolink
3740

3841
InitializeComponent();
3942
}

example/windows/AsyncStorageExample/App.h

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,7 @@
44

55
namespace winrt::AsyncStorageExample::implementation
66
{
7-
struct App : AppT<App>
8-
{
7+
struct App : AppT<App> {
98
App() noexcept;
109
};
11-
} // namespace winrt::AsyncStorageExample::implementation
12-
13-
10+
} // namespace winrt::AsyncStorageExample::implementation
Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,17 @@
11
#include "pch.h"
2+
23
#include "ReactPackageProvider.h"
4+
35
#include "NativeModules.h"
46

57
using namespace winrt::Microsoft::ReactNative;
68

79
namespace winrt::AsyncStorageExample::implementation
810
{
911

10-
void ReactPackageProvider::CreatePackage(IReactPackageBuilder const &packageBuilder) noexcept
11-
{
12-
AddAttributedModules(packageBuilder);
13-
}
12+
void ReactPackageProvider::CreatePackage(IReactPackageBuilder const &packageBuilder) noexcept
13+
{
14+
AddAttributedModules(packageBuilder);
15+
}
1416

15-
} // namespace winrt::AsyncStorageExample::implementation
17+
} // namespace winrt::AsyncStorageExample::implementation

example/windows/AsyncStorageExample/ReactPackageProvider.h

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,9 @@ using namespace winrt::Microsoft::ReactNative;
77
namespace winrt::AsyncStorageExample::implementation
88
{
99

10-
struct ReactPackageProvider : winrt::implements<ReactPackageProvider, IReactPackageProvider>
11-
{
12-
public: // IReactPackageProvider
10+
struct ReactPackageProvider : winrt::implements<ReactPackageProvider, IReactPackageProvider> {
11+
public: // IReactPackageProvider
1312
void CreatePackage(IReactPackageBuilder const &packageBuilder) noexcept;
1413
};
1514

16-
} // namespace winrt::AsyncStorageExample::implementation
17-
18-
15+
} // namespace winrt::AsyncStorageExample::implementation

0 commit comments

Comments
 (0)