iut 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (73) hide show
  1. data/.gitignore +9 -0
  2. data/Gemfile +4 -0
  3. data/Rakefile +1 -0
  4. data/bin/iut +2 -0
  5. data/iut.gemspec +24 -0
  6. data/lib/iut.rb +17 -0
  7. data/lib/iut/generator.rb +28 -0
  8. data/lib/iut/version.rb +4 -0
  9. data/template/project/iUnitTest/iUnitTest.xcodeproj/project.pbxproj +480 -0
  10. data/template/project/iUnitTest/iUnitTest/Classes/.do_not_remove_this_directory +0 -0
  11. data/template/project/iUnitTest/iUnitTest/Tests/.do_not_remove_this_directory +0 -0
  12. data/template/project/iUnitTest/iUnitTest/en.lproj/InfoPlist.strings +2 -0
  13. data/template/project/iUnitTest/iUnitTest/iUnitTest-Info.plist +44 -0
  14. data/template/project/iUnitTest/iUnitTest/iUnitTest-Prefix.pch +14 -0
  15. data/template/project/iUnitTest/iUnitTest/iunittest/Default.png +0 -0
  16. data/template/project/iUnitTest/iUnitTest/iunittest/IUTAppDelegate.h +20 -0
  17. data/template/project/iUnitTest/iUnitTest/iunittest/IUTAppDelegate.m +38 -0
  18. data/template/project/iUnitTest/iUnitTest/iunittest/IUTDetailView.xib +184 -0
  19. data/template/project/iUnitTest/iUnitTest/iunittest/IUTMainWindow.xib +732 -0
  20. data/template/project/iUnitTest/iUnitTest/iunittest/IUTTestView.xib +432 -0
  21. data/template/project/iUnitTest/iUnitTest/iunittest/Settings.bundle/Japanese.lproj/Root.strings +0 -0
  22. data/template/project/iUnitTest/iUnitTest/iunittest/Settings.bundle/Root.plist +39 -0
  23. data/template/project/iUnitTest/iUnitTest/iunittest/Settings.bundle/en.lproj/Root.strings +0 -0
  24. data/template/project/iUnitTest/iUnitTest/iunittest/UnitTest/AppAgent.h +33 -0
  25. data/template/project/iUnitTest/iUnitTest/iunittest/UnitTest/AppAgent.m +135 -0
  26. data/template/project/iUnitTest/iUnitTest/iunittest/UnitTest/AppAgentHelper.h +63 -0
  27. data/template/project/iUnitTest/iUnitTest/iunittest/UnitTest/ControllerTest/UINavigationBarBasedTest.h +25 -0
  28. data/template/project/iUnitTest/iUnitTest/iunittest/UnitTest/ControllerTest/UINavigationBarBasedTest.m +49 -0
  29. data/template/project/iUnitTest/iUnitTest/iunittest/UnitTest/ControllerTest/UITabBarAndNavigationBarBasedTest.h +23 -0
  30. data/template/project/iUnitTest/iUnitTest/iunittest/UnitTest/ControllerTest/UITabBarAndNavigationBarBasedTest.m +42 -0
  31. data/template/project/iUnitTest/iUnitTest/iunittest/UnitTest/ControllerTest/UITabBarBasedTest.h +25 -0
  32. data/template/project/iUnitTest/iUnitTest/iunittest/UnitTest/ControllerTest/UITabBarBasedTest.m +50 -0
  33. data/template/project/iUnitTest/iUnitTest/iunittest/UnitTest/ControllerTest/UITableViewBasedTest.h +23 -0
  34. data/template/project/iUnitTest/iUnitTest/iunittest/UnitTest/ControllerTest/UITableViewBasedTest.m +57 -0
  35. data/template/project/iUnitTest/iUnitTest/iunittest/UnitTest/ControllerTest/UITableViewControllerTest.h +22 -0
  36. data/template/project/iUnitTest/iUnitTest/iunittest/UnitTest/ControllerTest/UITableViewControllerTest.m +44 -0
  37. data/template/project/iUnitTest/iUnitTest/iunittest/UnitTest/ControllerTest/UIViewBasedTest.h +21 -0
  38. data/template/project/iUnitTest/iUnitTest/iunittest/UnitTest/ControllerTest/UIViewBasedTest.m +52 -0
  39. data/template/project/iUnitTest/iUnitTest/iunittest/UnitTest/ControllerTest/UIViewControllerTest.h +63 -0
  40. data/template/project/iUnitTest/iUnitTest/iunittest/UnitTest/ControllerTest/UIViewControllerTest.m +162 -0
  41. data/template/project/iUnitTest/iUnitTest/iunittest/UnitTest/GTMSenTestCase.h +17 -0
  42. data/template/project/iUnitTest/iUnitTest/iunittest/UnitTest/GTMSenTestCase.m +15 -0
  43. data/template/project/iUnitTest/iUnitTest/iunittest/UnitTest/IUTAssertion.h +135 -0
  44. data/template/project/iUnitTest/iUnitTest/iunittest/UnitTest/IUTAssertion.m +216 -0
  45. data/template/project/iUnitTest/iUnitTest/iunittest/UnitTest/IUTAssertionInfo.h +60 -0
  46. data/template/project/iUnitTest/iUnitTest/iunittest/UnitTest/IUTAssertionInfo.m +104 -0
  47. data/template/project/iUnitTest/iUnitTest/iunittest/UnitTest/IUTDetailViewController.h +24 -0
  48. data/template/project/iUnitTest/iUnitTest/iunittest/UnitTest/IUTDetailViewController.m +81 -0
  49. data/template/project/iUnitTest/iUnitTest/iunittest/UnitTest/IUTLog.h +14 -0
  50. data/template/project/iUnitTest/iUnitTest/iunittest/UnitTest/IUTPreference.h +34 -0
  51. data/template/project/iUnitTest/iUnitTest/iunittest/UnitTest/IUTPreference.m +125 -0
  52. data/template/project/iUnitTest/iUnitTest/iunittest/UnitTest/IUTResultTableViewCell.h +27 -0
  53. data/template/project/iUnitTest/iUnitTest/iunittest/UnitTest/IUTResultTableViewCell.m +83 -0
  54. data/template/project/iUnitTest/iUnitTest/iunittest/UnitTest/IUTResultTableViewController.h +26 -0
  55. data/template/project/iUnitTest/iUnitTest/iunittest/UnitTest/IUTResultTableViewController.m +193 -0
  56. data/template/project/iUnitTest/iUnitTest/iunittest/UnitTest/IUTTest.h +74 -0
  57. data/template/project/iUnitTest/iUnitTest/iunittest/UnitTest/IUTTest.m +127 -0
  58. data/template/project/iUnitTest/iUnitTest/iunittest/UnitTest/IUTTestRunner.h +66 -0
  59. data/template/project/iUnitTest/iUnitTest/iunittest/UnitTest/IUTTestRunner.m +449 -0
  60. data/template/project/iUnitTest/iUnitTest/iunittest/UnitTest/IUTTestRunnerViewController.h +59 -0
  61. data/template/project/iUnitTest/iUnitTest/iunittest/UnitTest/IUTTestRunnerViewController.m +163 -0
  62. data/template/project/iUnitTest/iUnitTest/iunittest/UnitTest/NSExceptionExtension.h +21 -0
  63. data/template/project/iUnitTest/iUnitTest/iunittest/UnitTest/NSExceptionExtension.m +52 -0
  64. data/template/project/iUnitTest/iUnitTest/iunittest/UnitTest/SenTestAssertion.h +82 -0
  65. data/template/project/iUnitTest/iUnitTest/iunittest/UnitTest/SourceCodeOpener.h +65 -0
  66. data/template/project/iUnitTest/iUnitTest/iunittest/UnitTest/SourceCodeOpener.m +176 -0
  67. data/template/project/iUnitTest/iUnitTest/iunittest/UnitTest/UITableViewControllerTestHelper.h +35 -0
  68. data/template/project/iUnitTest/iUnitTest/iunittest/isd_logo_60x40.png +0 -0
  69. data/template/project/iUnitTest/iUnitTest/iunittest/isd_logo_60x40_w.png +0 -0
  70. data/template/project/iUnitTest/iUnitTest/iunittest/iunittest_icon.png +0 -0
  71. data/template/project/iUnitTest/iUnitTest/main.m +18 -0
  72. data/template/project/iUnitTest/script/sync_source.rb +27 -0
  73. metadata +119 -0
@@ -0,0 +1,23 @@
1
+ //
2
+ // UITableViewBasedTest.h
3
+ // iUnitTestTest
4
+ //
5
+ // Created by Katsuyoshi Ito on 09/06/19.
6
+ // Copyright 2009 ITO SOFT DESIGN Inc. All rights reserved.
7
+ //
8
+
9
+ #import <Foundation/Foundation.h>
10
+ #import "IUTTest.h"
11
+
12
+
13
+ @interface UITableViewBasedTest : IUTTest {
14
+ UIWindow *window;
15
+ UITableViewController *tableViewController;
16
+ }
17
+
18
+ @property (retain, readonly) UIWindow *window;
19
+ @property (retain, readonly) UITableViewController *tableViewController;
20
+
21
+ @property (assign, readonly) UITableView *tableView;
22
+
23
+ @end
@@ -0,0 +1,57 @@
1
+ //
2
+ // UITableViewBasedTest.m
3
+ // iUnitTestTest
4
+ //
5
+ // Created by Katsuyoshi Ito on 09/06/19.
6
+ // Copyright 2009 ITO SOFT DESIGN Inc. All rights reserved.
7
+ //
8
+
9
+ #import "UITableViewBasedTest.h"
10
+
11
+
12
+
13
+ @implementation UITableViewBasedTest
14
+
15
+ @synthesize window, tableViewController;
16
+
17
+ - (void)setUp
18
+ {
19
+ [super setUp];
20
+
21
+ window = [[UIApplication sharedApplication].keyWindow retain];
22
+ tableViewController = [[self tableViewController] retain];
23
+ [window addSubview:tableViewController.view];
24
+ [window bringSubviewToFront:tableViewController.view];
25
+ }
26
+
27
+ - (void)tearDown
28
+ {
29
+ [tableViewController.view removeFromSuperview];
30
+ [tableViewController release];
31
+ tableViewController = nil;
32
+ [window release];
33
+ window = nil;
34
+ [super tearDown];
35
+ }
36
+
37
+ // Override to return a view controller that is tested.
38
+ - (UITableViewController *)tableViewController
39
+ {
40
+ return [[[UITableViewController alloc] initWithStyle:UITableViewStylePlain] autorelease];
41
+ }
42
+
43
+ - (UITableView *)tableView
44
+ {
45
+ return tableViewController.tableView;
46
+ }
47
+
48
+ - (void)dealloc
49
+ {
50
+ [tableViewController.view removeFromSuperview];
51
+ [tableViewController release];
52
+ [window release];
53
+ [super dealloc];
54
+ }
55
+
56
+
57
+ @end
@@ -0,0 +1,22 @@
1
+ //
2
+ // UITableViewControllerTest.h
3
+ // iUnitTestTest
4
+ //
5
+ // Created by Katsuyoshi Ito on 09/09/04.
6
+ // Copyright 2009 ITO SOFT DESIGN Inc. All rights reserved.
7
+ //
8
+
9
+ #import <Foundation/Foundation.h>
10
+ #import "UIViewControllerTest.h"
11
+
12
+
13
+ @interface UITableViewControllerTest : UIViewControllerTest {
14
+
15
+ }
16
+
17
+ - (UITableViewStyle)tableViewStyle;
18
+
19
+ @property (assign, readonly) UITableViewController *tableViewController;
20
+ @property (assign, readonly) UITableView *tableView;
21
+
22
+ @end
@@ -0,0 +1,44 @@
1
+ //
2
+ // UITableViewControllerTest.m
3
+ // iUnitTestTest
4
+ //
5
+ // Created by Katsuyoshi Ito on 09/09/04.
6
+ // Copyright 2009 ITO SOFT DESIGN Inc. All rights reserved.
7
+ //
8
+
9
+ #import "UITableViewControllerTest.h"
10
+
11
+
12
+
13
+ @implementation UITableViewControllerTest
14
+
15
+ - (UIViewController *)createViewController
16
+ {
17
+ NSString *nibName = [self viewControllerNibName];
18
+ if (nibName == nil) {
19
+
20
+ Class class = NSClassFromString([self viewControllerName]);
21
+ return [[[class alloc] initWithStyle:[self tableViewStyle]] autorelease];
22
+
23
+ } else {
24
+ return [super createViewController];
25
+ }
26
+ }
27
+
28
+ - (UITableViewStyle)tableViewStyle
29
+ {
30
+ return UITableViewStylePlain;
31
+ }
32
+
33
+ - (UITableViewController *)tableViewController
34
+ {
35
+ return (UITableViewController *)self.viewController;
36
+ }
37
+
38
+ - (UITableView *)tableView
39
+ {
40
+ return self.tableViewController.tableView;
41
+ }
42
+
43
+
44
+ @end
@@ -0,0 +1,21 @@
1
+ //
2
+ // UIViewBasedTest.h
3
+ // iUnitTest
4
+ //
5
+ // Created by Katsuyoshi Ito on 09/06/19.
6
+ // Copyright 2009 ITO SOFT DESIGN Inc. All rights reserved.
7
+ //
8
+
9
+ #import <Foundation/Foundation.h>
10
+ #import "IUTTest.h"
11
+
12
+
13
+ @interface UIViewBasedTest : IUTTest {
14
+ UIWindow *window;
15
+ UIViewController *viewController;
16
+ }
17
+
18
+ @property (retain, readonly) UIWindow *window;
19
+ @property (retain, readonly) UIViewController *viewController;
20
+
21
+ @end
@@ -0,0 +1,52 @@
1
+ //
2
+ // UIViewBasedTest.m
3
+ // iUnitTest
4
+ //
5
+ // Created by Katsuyoshi Ito on 09/06/19.
6
+ // Copyright 2009 ITO SOFT DESIGN Inc. All rights reserved.
7
+ //
8
+
9
+ #import "UIViewBasedTest.h"
10
+
11
+
12
+
13
+ @implementation UIViewBasedTest
14
+
15
+ @synthesize window, viewController;
16
+
17
+ - (void)setUp
18
+ {
19
+ [super setUp];
20
+
21
+ window = [[UIApplication sharedApplication].keyWindow retain];
22
+ viewController = [[self viewController] retain];
23
+ [window addSubview:viewController.view];
24
+ [window bringSubviewToFront:viewController.view];
25
+ }
26
+
27
+ - (void)tearDown
28
+ {
29
+ [viewController.view removeFromSuperview];
30
+ [viewController release];
31
+ viewController = nil;
32
+ [window release];
33
+ window = nil;
34
+ [super tearDown];
35
+ }
36
+
37
+ // Override to return a view controller that is tested.
38
+ - (UIViewController *)viewController
39
+ {
40
+ return [[UIViewController new] autorelease];
41
+ }
42
+
43
+ - (void)dealloc
44
+ {
45
+ [viewController.view removeFromSuperview];
46
+ [viewController release];
47
+ [window release];
48
+ [super dealloc];
49
+ }
50
+
51
+
52
+ @end
@@ -0,0 +1,63 @@
1
+ //
2
+ // UIViewControllerTest.h
3
+ // iUnitTest
4
+ //
5
+ // Created by Katsuyoshi Ito on 09/09/04.
6
+ // Copyright 2009 ITO SOFT DESIGN Inc. All rights reserved.
7
+ //
8
+
9
+ #import <Foundation/Foundation.h>
10
+ #import "IUTTest.h"
11
+ #import "AppAgentHelper.h"
12
+
13
+
14
+ @interface UIViewControllerTest : IUTTest {
15
+
16
+ UIViewController *_baseViwController;
17
+
18
+ UITabBarController *_tabBarController;
19
+ UINavigationController *_navigationController;
20
+ UIViewController *_viewController;
21
+
22
+ }
23
+
24
+ @property (retain, readonly) UIViewController *viewController;
25
+
26
+
27
+ /* Create a view controller which is tested. */
28
+ - (UIViewController *)createViewController;
29
+
30
+
31
+ /**
32
+ * Return a nib file's name for your view controller.
33
+ * You don't need a nib file, return nil.
34
+ */
35
+ - (NSString *)viewControllerNibName;
36
+
37
+ /**
38
+ * Return your view controller's class name.
39
+ * If nil, use -viewControllerNibName.
40
+ */
41
+ - (NSString *)viewControllerName;
42
+
43
+ /**
44
+ * Return YES if needs navication controller.
45
+ * Default is NO.
46
+ */
47
+ - (BOOL)hasNavigationController;
48
+
49
+ /**
50
+ * Return YES if needs tab bar controller.
51
+ * Default is NO.
52
+ */
53
+ - (BOOL)hasTabBarController;
54
+
55
+
56
+ /** Perform left bar button item action of top(visible) view controller. */
57
+ - (void)touchLeftBarButtonItem;
58
+
59
+ /** Perform right bar button item action of top(visible) view controller. */
60
+ - (void)touchRightBarButtonItem;
61
+
62
+
63
+ @end
@@ -0,0 +1,162 @@
1
+ //
2
+ // UIViewControllerTest.m
3
+ // iUnitTest
4
+ //
5
+ // Created by Katsuyoshi Ito on 09/09/04.
6
+ // Copyright 2009 ITO SOFT DESIGN Inc. All rights reserved.
7
+ //
8
+
9
+ #import "UIViewControllerTest.h"
10
+
11
+
12
+ @implementation UIViewControllerTest
13
+
14
+ @synthesize viewController = _viewController;
15
+
16
+ #pragma mark -
17
+ #pragma mark Helpers
18
+
19
+ - (UIViewController *)createViewController
20
+ {
21
+ NSString *nibName = [self viewControllerNibName];
22
+ NSString *className = [self viewControllerName];
23
+ if (nibName && className == nil) {
24
+ className = nibName;
25
+ }
26
+
27
+ Class class = NSClassFromString(className);
28
+ if (nibName) {
29
+ return [[[class alloc] initWithNibName:nibName bundle:nil] autorelease];
30
+ } else {
31
+ return [[class new] autorelease];
32
+ }
33
+ }
34
+
35
+ - (void)buildViewController
36
+ {
37
+ _viewController = [[self createViewController] retain];
38
+ _baseViwController = _viewController;
39
+
40
+ if ([self hasNavigationController]) {
41
+ _navigationController = [[UINavigationController alloc] initWithRootViewController:_viewController];
42
+ _baseViwController = _navigationController;
43
+ }
44
+
45
+ if ([self hasTabBarController]) {
46
+ _tabBarController = [UITabBarController new];
47
+ _tabBarController.viewControllers = [NSArray arrayWithObject:_baseViwController];
48
+ _baseViwController = _tabBarController;
49
+ }
50
+
51
+ [_baseViwController retain];
52
+
53
+ UIWindow *window = [UIApplication sharedApplication].keyWindow;
54
+ [window addSubview:_baseViwController.view];
55
+ [window bringSubviewToFront:_baseViwController.view];
56
+ }
57
+
58
+ #pragma mark -
59
+ #pragma mark setUp/tearDown
60
+
61
+
62
+ - (void)setUp
63
+ {
64
+ [super setUp];
65
+ [self buildViewController];
66
+ }
67
+
68
+ - (NSNumber *)willTearDown
69
+ {
70
+ if (_viewController.editing) {
71
+ _viewController.editing = NO;
72
+ }
73
+ BOOL hasAlertView = CLOSE_ALL_ALERTVIEWS();
74
+ if (hasAlertView) {
75
+ return [NSNumber numberWithDouble:1.0];
76
+ } else {
77
+ return [super willTearDown];
78
+ }
79
+ }
80
+
81
+ - (void)tearDown
82
+ {
83
+ // close modal views
84
+ NSMutableArray *modalViewControllers = [NSMutableArray array];
85
+ UIViewController *modalViewController = [_baseViwController modalViewController];
86
+ while (modalViewController) {
87
+ [modalViewControllers addObject:modalViewController];
88
+ modalViewController = [modalViewController modalViewController];
89
+ }
90
+ NSEnumerator *controllerEnumerator = [modalViewControllers reverseObjectEnumerator];
91
+ UIViewController *controller = nil;
92
+ while (controller = [controllerEnumerator nextObject]) {
93
+ [controller dismissModalViewControllerAnimated:NO];
94
+ }
95
+
96
+ [_baseViwController.view removeFromSuperview];
97
+
98
+ [_baseViwController release];
99
+ _baseViwController = nil;
100
+ [_tabBarController release];
101
+ _tabBarController = nil;
102
+ [_navigationController release];
103
+ _navigationController = nil;
104
+ [_viewController release];
105
+ _viewController = nil;
106
+
107
+ [super tearDown];
108
+ }
109
+
110
+ #pragma mark -
111
+
112
+ - (NSString *)viewControllerNibName
113
+ {
114
+ return nil;
115
+ }
116
+
117
+ - (NSString *)viewControllerName
118
+ {
119
+ return nil;
120
+ }
121
+
122
+ - (BOOL)hasNavigationController
123
+ {
124
+ return NO;
125
+ }
126
+
127
+ - (BOOL)hasTabBarController
128
+ {
129
+ return NO;
130
+ }
131
+
132
+
133
+ #pragma mark -
134
+ #pragma mark touches
135
+
136
+ - (void)touchLeftBarButtonItem
137
+ {
138
+ UINavigationItem *navigationItem = self.viewController.navigationController.visibleViewController.navigationItem;
139
+ if (navigationItem) {
140
+ id target = navigationItem.leftBarButtonItem.target;
141
+ if (target) {
142
+ [target performSelector:navigationItem.leftBarButtonItem.action];
143
+ } else {
144
+ [self.viewController.navigationController popViewControllerAnimated:YES];
145
+ }
146
+ }
147
+ }
148
+
149
+ - (void)touchRightBarButtonItem
150
+ {
151
+ UINavigationItem *navigationItem = self.viewController.navigationController.visibleViewController.navigationItem;
152
+ if (navigationItem) {
153
+ id target = navigationItem.leftBarButtonItem.target;
154
+ if (target) {
155
+ [target performSelector:navigationItem.rightBarButtonItem.action];
156
+ } else {
157
+ // CHECKME:
158
+ }
159
+ }
160
+ }
161
+
162
+ @end