objc 0.0.2 → 0.0.3
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.
- checksums.yaml +4 -4
- data/README.md +87 -42
- data/lib/objc/version.rb +1 -1
- data/lib/objc/xcode_project.rb +6 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 89dc80ed78bea1f21e8d7b978ad9a3b96311d68f
|
4
|
+
data.tar.gz: dea221d86ebab2bfadf7732f28f6ec4c437bc275
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6c44a61d7023c0fa11d14ce6e018adf6723f382cca9701b2aba7e016eaf5aeb9abe0a3feca874c5459f5f0bf73213b75dbe6a15d82b3488be9b32cf1b6c9eb9a
|
7
|
+
data.tar.gz: bc131a25b2a54b7cc4de01c4497d4de0bf10f4f29c6ebf01b2477dc48147a9381d83df5201aade4981ec97c6ee4d6b2cd2ead93d334ee1c0c74a3a76e9935168
|
data/README.md
CHANGED
@@ -15,63 +15,55 @@ Install [xctool](https://github.com/facebook/xctool)
|
|
15
15
|
|
16
16
|
## Usage
|
17
17
|
|
18
|
-
$ objc
|
18
|
+
$ objc Bob
|
19
19
|
|
20
|
-
The `objc` binary will find and run the tests for the following files: `
|
21
|
-
`
|
22
|
-
|
23
|
-
More specifically the following occurs:
|
24
|
-
|
25
|
-
* Finds the files matching the specified prefix (e.g. `Anagram.h`,
|
26
|
-
`Anagram.m` and `AnagramTest.m`)
|
27
|
-
* An Xcode Project, managed by the gem, is copied to to a tmp location on the
|
28
|
-
system.
|
29
|
-
* Using the [xcoder](https://github.com/rayh/xcoder) the project file is
|
30
|
-
manipulated and the found files are added.
|
31
|
-
* Using [xctool](https://github.com/facebook/xctool) the tests from the
|
32
|
-
project file are executed.
|
33
|
-
|
34
|
-
## XCTest
|
20
|
+
The `objc` binary will find and run the tests for the following files: `Bob.h`,
|
21
|
+
`Bob.m` and `BobTest.m`.
|
35
22
|
|
36
23
|
The test suite used is **XCTest**. This is an example of the header, source
|
37
24
|
and test file.
|
38
25
|
|
39
|
-
###
|
26
|
+
### Bob.h
|
40
27
|
|
41
28
|
```
|
42
29
|
#import <Foundation/Foundation.h>
|
43
30
|
|
44
|
-
@interface
|
31
|
+
@interface Bob : NSObject
|
45
32
|
|
46
|
-
- (
|
47
|
-
- (NSArray *)match:(NSArray *)possibleMatches;
|
33
|
+
- (NSString *)hey:(NSString *)statement;
|
48
34
|
|
49
35
|
@end
|
50
36
|
```
|
51
37
|
|
52
|
-
###
|
38
|
+
### Bob.m
|
53
39
|
|
54
40
|
```
|
55
|
-
#import "
|
41
|
+
#import "Bob.h"
|
56
42
|
|
57
|
-
@implementation
|
43
|
+
@implementation Bob
|
58
44
|
|
59
|
-
-
|
60
|
-
|
61
|
-
|
45
|
+
-(NSString *)hey:(NSString *)statement {
|
46
|
+
|
47
|
+
if ([statement isEqualToString:@""]) {
|
48
|
+
return @"Fine, be that way.";
|
49
|
+
} else if ([statement hasSuffix:@"?"]) {
|
50
|
+
return @"Sure.";
|
51
|
+
} else if ([statement isEqualToString:[statement uppercaseString]]) {
|
52
|
+
return @"Woah, chill out!";
|
53
|
+
} else {
|
54
|
+
return @"Whatever.";
|
55
|
+
}
|
62
56
|
|
63
|
-
- (NSArray *)match:(NSArray *)possibleMatches {
|
64
|
-
return @[];
|
65
57
|
}
|
66
58
|
|
67
59
|
@end
|
68
60
|
```
|
69
61
|
|
70
|
-
###
|
62
|
+
### BobTest.m
|
71
63
|
|
72
64
|
```
|
73
65
|
#import <XCTest/XCTest.h>
|
74
|
-
#import "
|
66
|
+
#import "Bob.h"
|
75
67
|
|
76
68
|
@interface test_suite : XCTestCase
|
77
69
|
|
@@ -79,28 +71,81 @@ and test file.
|
|
79
71
|
|
80
72
|
@implementation test_suite
|
81
73
|
|
82
|
-
- (
|
83
|
-
|
84
|
-
|
85
|
-
|
74
|
+
- (Bob *)bob {
|
75
|
+
return [[Bob alloc] init];
|
76
|
+
}
|
77
|
+
|
78
|
+
- (void)testStatingSomething {
|
79
|
+
NSString *input = @"Tom-ay-to, tom-aaaah-to.";
|
80
|
+
NSString *expected = @"Whatever.";
|
81
|
+
NSString *result = [[self bob] hey:input];
|
82
|
+
XCTAssertEqual(expected,result);
|
83
|
+
}
|
84
|
+
|
85
|
+
- (void)testShouting {
|
86
|
+
NSString *input = @"WATCH OUT!";
|
87
|
+
NSString *expected = @"Woah, chill out!";
|
88
|
+
NSString *result = [[self bob] hey:input];
|
89
|
+
XCTAssertEqual(expected,result);
|
86
90
|
}
|
87
91
|
|
88
|
-
- (void)
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
+
- (void)testAskingAQuestion {
|
93
|
+
NSString *input = @"Does this cryogenic chamber make me look fat?";
|
94
|
+
NSString *expected = @"Sure.";
|
95
|
+
NSString *result = [[self bob] hey:input];
|
96
|
+
XCTAssertEqual(expected,result);
|
92
97
|
}
|
93
98
|
|
94
|
-
- (void)
|
95
|
-
|
96
|
-
|
99
|
+
- (void)testTalkingForcefully {
|
100
|
+
NSString *input = @"Let's go make out behind the gym!";
|
101
|
+
NSString *expected = @"Whatever.";
|
102
|
+
NSString *result = [[self bob] hey:input];
|
103
|
+
XCTAssertEqual(expected,result);
|
104
|
+
}
|
97
105
|
|
98
|
-
|
106
|
+
- (void)testShoutingNumbers {
|
107
|
+
NSString *input = @"1, 2, 3 GO!";
|
108
|
+
NSString *expected = @"Woah, chill out!";
|
109
|
+
NSString *result = [[self bob] hey:input];
|
110
|
+
XCTAssertEqual(expected,result);
|
111
|
+
}
|
112
|
+
|
113
|
+
- (void)testShoutingWithSpecialCharacters {
|
114
|
+
NSString *input = @"ZOMG THE %^*@#$(*^ ZOMBIES ARE COMING!!11!!1!";
|
115
|
+
NSString *expected = @"Woah, chill out!";
|
116
|
+
NSString *result = [[self bob] hey:input];
|
117
|
+
XCTAssertEqual(expected,result);
|
118
|
+
}
|
119
|
+
|
120
|
+
- (void)testSilence {
|
121
|
+
NSString *input = @"";
|
122
|
+
NSString *expected = @"Fine, be that way.";
|
123
|
+
NSString *result = [[self bob] hey:input];
|
124
|
+
XCTAssertEqual(expected,result);
|
99
125
|
}
|
100
126
|
|
101
127
|
@end
|
102
128
|
```
|
103
129
|
|
130
|
+
## Details
|
131
|
+
|
132
|
+
When you run `objc Bob`, more specifically the following occurs:
|
133
|
+
|
134
|
+
* Finds the files matching the specified prefix (e.g. `Bob.h`,
|
135
|
+
`Bob.m` and `BobTest.m`)
|
136
|
+
* An Xcode Project, managed by the gem, is copied to to a tmp location on the
|
137
|
+
system.
|
138
|
+
* Using the [xcoder](https://github.com/rayh/xcoder) the project file is
|
139
|
+
manipulated and the found files are added.
|
140
|
+
* Using [xctool](https://github.com/facebook/xctool) the tests from the
|
141
|
+
project file are executed.
|
142
|
+
|
143
|
+
## Limitations
|
144
|
+
|
145
|
+
* Currently the template project is a Cocoa App that will launch a window for
|
146
|
+
a brief moment during the tets. I couldn't get a project with just tests to
|
147
|
+
run with **xctool** or **xcodebuild**.
|
148
|
+
|
104
149
|
## Contributing
|
105
150
|
|
106
151
|
1. Fork it
|
data/lib/objc/version.rb
CHANGED
data/lib/objc/xcode_project.rb
CHANGED
@@ -35,7 +35,8 @@ module Objc
|
|
35
35
|
|
36
36
|
|
37
37
|
def execute!
|
38
|
-
|
38
|
+
pid = spawn xctool_command
|
39
|
+
Process.wait
|
39
40
|
end
|
40
41
|
|
41
42
|
|
@@ -72,6 +73,10 @@ module Objc
|
|
72
73
|
def group_name
|
73
74
|
'test-suite'
|
74
75
|
end
|
76
|
+
|
77
|
+
def xctool_command
|
78
|
+
"xctool -project #{project_path} -scheme IgnoreThisTarget test"
|
79
|
+
end
|
75
80
|
end
|
76
81
|
end
|
77
82
|
end
|