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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e01dc6f2e7bc0c06dec36fb911a35ca32e4a1a8a
4
- data.tar.gz: 253d324bd0a3f9465f2983d0bbba801fa18cfe6a
3
+ metadata.gz: 89dc80ed78bea1f21e8d7b978ad9a3b96311d68f
4
+ data.tar.gz: dea221d86ebab2bfadf7732f28f6ec4c437bc275
5
5
  SHA512:
6
- metadata.gz: 8d8b9a53605438efe926900bc5e8dcc37afe12a2d5cec4bff41e4ec2b35815ed86b13bdd00178fc38a8db91d153313ae2ddd4bf4b3bf48f032281c5776a1ff8b
7
- data.tar.gz: 0341a771a5074b5178c2a9a95d21b182b8733d9a64319ff50c2fc1d382939551438ccaf97c33ca8b53880d56ecd5c574fc039a7b0a3d9956a2968d5fc2fa8d65
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 Anagram
18
+ $ objc Bob
19
19
 
20
- The `objc` binary will find and run the tests for the following files: `Anagram.h`,
21
- `Anagram.m` and `AnagramTest.m`.
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
- ### Anagram.h
26
+ ### Bob.h
40
27
 
41
28
  ```
42
29
  #import <Foundation/Foundation.h>
43
30
 
44
- @interface Anagram : NSObject
31
+ @interface Bob : NSObject
45
32
 
46
- - (id)initWithString:(NSString *)string;
47
- - (NSArray *)match:(NSArray *)possibleMatches;
33
+ - (NSString *)hey:(NSString *)statement;
48
34
 
49
35
  @end
50
36
  ```
51
37
 
52
- ### Anagram.m
38
+ ### Bob.m
53
39
 
54
40
  ```
55
- #import "Anagram.h"
41
+ #import "Bob.h"
56
42
 
57
- @implementation Anagram
43
+ @implementation Bob
58
44
 
59
- - (id)initWithString:(NSString *)string {
60
- return [super init];
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
- ### AnagramTest.m
62
+ ### BobTest.m
71
63
 
72
64
  ```
73
65
  #import <XCTest/XCTest.h>
74
- #import "Anagram.h"
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
- - (void)setUp
83
- {
84
- [super setUp];
85
- // Put setup code here. This method is called before the invocation of each test method in the class.
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)tearDown
89
- {
90
- // Put teardown code here. This method is called after the invocation of each test method in the class.
91
- [super tearDown];
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)testNoMatches {
95
- Anagram *detector = [[Anagram alloc] initWithString:@"diaper"];
96
- NSArray *matches = [detector match:@[@"hello",@"world",@"zombies",@"patns"]];
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
- XCTAssertEqual(@[], matches, @"Format");
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
@@ -1,3 +1,3 @@
1
1
  module Objc
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
@@ -35,7 +35,8 @@ module Objc
35
35
 
36
36
 
37
37
  def execute!
38
- puts `xctool -project #{project_path} -scheme IgnoreThisTarget test`
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: objc
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Franklin Webber