xcfit 2.0.4 → 2.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +7 -9
- data/Docs/InitialVersion.md +340 -0
- data/Package.swift +5 -0
- data/README.md +348 -145
- data/XCFit.gemspec +1 -1
- data/XCFit.podspec +17 -9
- data/XCFit/Classes/Cucumberish/Core/CCIBlockDefinitions.h +400 -0
- data/XCFit/Classes/Cucumberish/Core/Managers/CCIFeaturesManager.h +72 -0
- data/XCFit/Classes/Cucumberish/Core/Managers/CCIFeaturesManager.m +141 -0
- data/XCFit/Classes/Cucumberish/Core/Managers/CCIStepsManager.h +51 -0
- data/XCFit/Classes/Cucumberish/Core/Managers/CCIStepsManager.m +245 -0
- data/XCFit/Classes/Cucumberish/Core/Models/CCIArgument.h +62 -0
- data/XCFit/Classes/Cucumberish/Core/Models/CCIArgument.m +117 -0
- data/XCFit/Classes/Cucumberish/Core/Models/CCIAroundHock.h +37 -0
- data/XCFit/Classes/Cucumberish/Core/Models/CCIAroundHock.m +37 -0
- data/XCFit/Classes/Cucumberish/Core/Models/CCIBackground.h +46 -0
- data/XCFit/Classes/Cucumberish/Core/Models/CCIBackground.m +117 -0
- data/XCFit/Classes/Cucumberish/Core/Models/CCIExample.h +89 -0
- data/XCFit/Classes/Cucumberish/Core/Models/CCIExample.m +128 -0
- data/XCFit/Classes/Cucumberish/Core/Models/CCIFeature.h +49 -0
- data/XCFit/Classes/Cucumberish/Core/Models/CCIFeature.m +174 -0
- data/XCFit/Classes/Cucumberish/Core/Models/CCIHock.h +36 -0
- data/XCFit/Classes/Cucumberish/Core/Models/CCIHock.m +34 -0
- data/XCFit/Classes/Cucumberish/Core/Models/CCILocation.h +61 -0
- data/XCFit/Classes/Cucumberish/Core/Models/CCILocation.m +91 -0
- data/XCFit/Classes/Cucumberish/Core/Models/CCIScenarioDefinition.h +97 -0
- data/XCFit/Classes/Cucumberish/Core/Models/CCIScenarioDefinition.m +224 -0
- data/XCFit/Classes/Cucumberish/Core/Models/CCIStep.h +85 -0
- data/XCFit/Classes/Cucumberish/Core/Models/CCIStep.m +98 -0
- data/XCFit/Classes/Cucumberish/Core/Models/CCIStepDefinition.h +43 -0
- data/XCFit/Classes/Cucumberish/Core/Models/CCIStepDefinition.m +65 -0
- data/XCFit/Classes/Cucumberish/Cucumberish.h +133 -0
- data/XCFit/Classes/Cucumberish/Cucumberish.m +604 -0
- data/XCFit/Classes/Cucumberish/Dependencies/Gherkin/GHAstBuilder.h +15 -0
- data/XCFit/Classes/Cucumberish/Dependencies/Gherkin/GHAstBuilder.m +312 -0
- data/XCFit/Classes/Cucumberish/Dependencies/Gherkin/GHAstNode.h +20 -0
- data/XCFit/Classes/Cucumberish/Dependencies/Gherkin/GHAstNode.m +79 -0
- data/XCFit/Classes/Cucumberish/Dependencies/Gherkin/GHBackground.h +12 -0
- data/XCFit/Classes/Cucumberish/Dependencies/Gherkin/GHBackground.m +18 -0
- data/XCFit/Classes/Cucumberish/Dependencies/Gherkin/GHComment.h +11 -0
- data/XCFit/Classes/Cucumberish/Dependencies/Gherkin/GHComment.m +27 -0
- data/XCFit/Classes/Cucumberish/Dependencies/Gherkin/GHDataTable.h +14 -0
- data/XCFit/Classes/Cucumberish/Dependencies/Gherkin/GHDataTable.m +30 -0
- data/XCFit/Classes/Cucumberish/Dependencies/Gherkin/GHDocString.h +14 -0
- data/XCFit/Classes/Cucumberish/Dependencies/Gherkin/GHDocString.m +29 -0
- data/XCFit/Classes/Cucumberish/Dependencies/Gherkin/GHExamples.h +24 -0
- data/XCFit/Classes/Cucumberish/Dependencies/Gherkin/GHExamples.m +49 -0
- data/XCFit/Classes/Cucumberish/Dependencies/Gherkin/GHFeature.h +24 -0
- data/XCFit/Classes/Cucumberish/Dependencies/Gherkin/GHFeature.m +50 -0
- data/XCFit/Classes/Cucumberish/Dependencies/Gherkin/GHGherkinDialect.h +25 -0
- data/XCFit/Classes/Cucumberish/Dependencies/Gherkin/GHGherkinDialect.m +64 -0
- data/XCFit/Classes/Cucumberish/Dependencies/Gherkin/GHGherkinDialectProvider.h +9 -0
- data/XCFit/Classes/Cucumberish/Dependencies/Gherkin/GHGherkinDialectProvider.m +124 -0
- data/XCFit/Classes/Cucumberish/Dependencies/Gherkin/GHGherkinDialectProviderProtocol.h +10 -0
- data/XCFit/Classes/Cucumberish/Dependencies/Gherkin/GHGherkinLanguageConstants.h +9 -0
- data/XCFit/Classes/Cucumberish/Dependencies/Gherkin/GHGherkinLanguageConstants.m +10 -0
- data/XCFit/Classes/Cucumberish/Dependencies/Gherkin/GHGherkinLanguageSetting.h +17 -0
- data/XCFit/Classes/Cucumberish/Dependencies/Gherkin/GHGherkinLanguageSetting.m +18 -0
- data/XCFit/Classes/Cucumberish/Dependencies/Gherkin/GHGherkinLine.h +12 -0
- data/XCFit/Classes/Cucumberish/Dependencies/Gherkin/GHGherkinLine.m +179 -0
- data/XCFit/Classes/Cucumberish/Dependencies/Gherkin/GHGherkinLineProtocol.h +64 -0
- data/XCFit/Classes/Cucumberish/Dependencies/Gherkin/GHGherkinLineSpan.h +9 -0
- data/XCFit/Classes/Cucumberish/Dependencies/Gherkin/GHGherkinLineSpan.m +26 -0
- data/XCFit/Classes/Cucumberish/Dependencies/Gherkin/GHHasDescriptionProtocol.h +8 -0
- data/XCFit/Classes/Cucumberish/Dependencies/Gherkin/GHHasLocationProtocol.h +8 -0
- data/XCFit/Classes/Cucumberish/Dependencies/Gherkin/GHHasRowsProtocol.h +8 -0
- data/XCFit/Classes/Cucumberish/Dependencies/Gherkin/GHHasStepsProtocol.h +8 -0
- data/XCFit/Classes/Cucumberish/Dependencies/Gherkin/GHHasTagsProtocol.h +8 -0
- data/XCFit/Classes/Cucumberish/Dependencies/Gherkin/GHLocation.h +12 -0
- data/XCFit/Classes/Cucumberish/Dependencies/Gherkin/GHLocation.m +41 -0
- data/XCFit/Classes/Cucumberish/Dependencies/Gherkin/GHNode.h +4 -0
- data/XCFit/Classes/Cucumberish/Dependencies/Gherkin/GHNode.m +5 -0
- data/XCFit/Classes/Cucumberish/Dependencies/Gherkin/GHParser+Extensions.h +10 -0
- data/XCFit/Classes/Cucumberish/Dependencies/Gherkin/GHParser+Extensions.m +18 -0
- data/XCFit/Classes/Cucumberish/Dependencies/Gherkin/GHParser.h +132 -0
- data/XCFit/Classes/Cucumberish/Dependencies/Gherkin/GHParser.m +2735 -0
- data/XCFit/Classes/Cucumberish/Dependencies/Gherkin/GHParserException.h +55 -0
- data/XCFit/Classes/Cucumberish/Dependencies/Gherkin/GHParserException.m +192 -0
- data/XCFit/Classes/Cucumberish/Dependencies/Gherkin/GHScenario.h +14 -0
- data/XCFit/Classes/Cucumberish/Dependencies/Gherkin/GHScenario.m +18 -0
- data/XCFit/Classes/Cucumberish/Dependencies/Gherkin/GHScenarioDefinition.h +23 -0
- data/XCFit/Classes/Cucumberish/Dependencies/Gherkin/GHScenarioDefinition.m +41 -0
- data/XCFit/Classes/Cucumberish/Dependencies/Gherkin/GHScenarioDefinition_Private.h +6 -0
- data/XCFit/Classes/Cucumberish/Dependencies/Gherkin/GHScenarioOutline.h +15 -0
- data/XCFit/Classes/Cucumberish/Dependencies/Gherkin/GHScenarioOutline.m +26 -0
- data/XCFit/Classes/Cucumberish/Dependencies/Gherkin/GHStep.h +16 -0
- data/XCFit/Classes/Cucumberish/Dependencies/Gherkin/GHStep.m +35 -0
- data/XCFit/Classes/Cucumberish/Dependencies/Gherkin/GHStepArgument.h +4 -0
- data/XCFit/Classes/Cucumberish/Dependencies/Gherkin/GHStepArgument.m +5 -0
- data/XCFit/Classes/Cucumberish/Dependencies/Gherkin/GHTableCell.h +13 -0
- data/XCFit/Classes/Cucumberish/Dependencies/Gherkin/GHTableCell.m +28 -0
- data/XCFit/Classes/Cucumberish/Dependencies/Gherkin/GHTableRow.h +13 -0
- data/XCFit/Classes/Cucumberish/Dependencies/Gherkin/GHTableRow.m +29 -0
- data/XCFit/Classes/Cucumberish/Dependencies/Gherkin/GHTag.h +13 -0
- data/XCFit/Classes/Cucumberish/Dependencies/Gherkin/GHTag.m +28 -0
- data/XCFit/Classes/Cucumberish/Dependencies/Gherkin/GHToken.h +26 -0
- data/XCFit/Classes/Cucumberish/Dependencies/Gherkin/GHToken.m +50 -0
- data/XCFit/Classes/Cucumberish/Dependencies/Gherkin/GHTokenMatcher.h +29 -0
- data/XCFit/Classes/Cucumberish/Dependencies/Gherkin/GHTokenMatcher.m +283 -0
- data/XCFit/Classes/Cucumberish/Dependencies/Gherkin/GHTokenScanner.h +12 -0
- data/XCFit/Classes/Cucumberish/Dependencies/Gherkin/GHTokenScanner.m +59 -0
- data/XCFit/Classes/Cucumberish/Dependencies/Gherkin/NSString+Trim.h +7 -0
- data/XCFit/Classes/Cucumberish/Dependencies/Gherkin/NSString+Trim.m +28 -0
- data/XCFit/Classes/Cucumberish/Dependencies/Gherkin/gherkin-languages.json +2969 -0
- data/XCFit/Classes/Cucumberish/Utils/NSArray+Hashes.h +24 -0
- data/XCFit/Classes/Cucumberish/Utils/NSArray+Hashes.m +44 -0
- data/XCFit/Classes/Cucumberish/Utils/NSObject+Dictionary.h +7 -0
- data/XCFit/Classes/Cucumberish/Utils/NSObject+Dictionary.m +83 -0
- data/XCFit/Classes/Cucumberish/Utils/NSString+Formatter.h +32 -0
- data/XCFit/Classes/Cucumberish/Utils/NSString+Formatter.m +70 -0
- data/Xcode7-Templates/XCFit/Cucumberish UI Test Bundle Base.xctemplate/TemplateInfo.plist +13 -0
- data/Xcode7-Templates/XCFit/iOS UI Cucumberish Testing Bundle.xctemplate/TemplateInfo.plist +11 -0
- data/lib/XCFit/version.rb +1 -1
- metadata +108 -38
- data/XCFit/Assets/.gitkeep +0 -0
- data/XCFit/Assets/Gherkin/Cucumber Feature.xctemplate/TemplateIcon.png +0 -0
- data/XCFit/Assets/Gherkin/Cucumber Feature.xctemplate/TemplateIcon@2x.png +0 -0
- data/XCFit/Assets/Gherkin/Cucumber Feature.xctemplate/TemplateInfo.plist +0 -22
- data/XCFit/Assets/Gherkin/Cucumber Feature.xctemplate/___FILEBASENAME___.feature +0 -20
- data/XCFit/Assets/XCFit/Base Acceptance Tests.xctemplate/AcceptanceTests-Bridging-Header.h +0 -1
- data/XCFit/Assets/XCFit/Base Acceptance Tests.xctemplate/FixtureExample.swift +0 -31
- data/XCFit/Assets/XCFit/Base Acceptance Tests.xctemplate/SlimTables.h +0 -28
- data/XCFit/Assets/XCFit/Base Acceptance Tests.xctemplate/TemplateIcon.png +0 -0
- data/XCFit/Assets/XCFit/Base Acceptance Tests.xctemplate/TemplateIcon@2x.png +0 -0
- data/XCFit/Assets/XCFit/Base Acceptance Tests.xctemplate/TemplateInfo.plist +0 -150
- data/XCFit/Assets/XCFit/Base Acceptance Tests.xctemplate/___PACKAGENAMEASIDENTIFIER___-Bridging-Header.h +0 -1
- data/XCFit/Assets/XCFit/Base Acceptance Tests.xctemplate/___PACKAGENAMEASIDENTIFIER___.m +0 -15
- data/XCFit/Assets/XCFit/Cucumberish API Test Bundle Base.xctemplate/TemplateIcon.png +0 -0
- data/XCFit/Assets/XCFit/Cucumberish API Test Bundle Base.xctemplate/TemplateIcon@2x.png +0 -0
- data/XCFit/Assets/XCFit/Cucumberish API Test Bundle Base.xctemplate/TemplateInfo.plist +0 -123
- data/XCFit/Assets/XCFit/Cucumberish API Test Bundle Base.xctemplate/___PACKAGENAMEASIDENTIFIER___-Bridging-Header.h +0 -7
- data/XCFit/Assets/XCFit/Cucumberish API Test Bundle Base.xctemplate/___PACKAGENAMEASIDENTIFIER___.feature +0 -11
- data/XCFit/Assets/XCFit/Cucumberish API Test Bundle Base.xctemplate/___PACKAGENAMEASIDENTIFIER___.h +0 -14
- data/XCFit/Assets/XCFit/Cucumberish API Test Bundle Base.xctemplate/___PACKAGENAMEASIDENTIFIER___.m +0 -17
- data/XCFit/Assets/XCFit/Cucumberish API Test Bundle Base.xctemplate/___PACKAGENAMEASIDENTIFIER___.swift +0 -23
- data/XCFit/Assets/XCFit/Cucumberish UI Test Bundle Base.xctemplate/TemplateIcon.png +0 -0
- data/XCFit/Assets/XCFit/Cucumberish UI Test Bundle Base.xctemplate/TemplateIcon@2x.png +0 -0
- data/XCFit/Assets/XCFit/Cucumberish UI Test Bundle Base.xctemplate/TemplateInfo.plist +0 -123
- data/XCFit/Assets/XCFit/Cucumberish UI Test Bundle Base.xctemplate/___PACKAGENAMEASIDENTIFIER___-Bridging-Header.h +0 -7
- data/XCFit/Assets/XCFit/Cucumberish UI Test Bundle Base.xctemplate/___PACKAGENAMEASIDENTIFIER___.feature +0 -11
- data/XCFit/Assets/XCFit/Cucumberish UI Test Bundle Base.xctemplate/___PACKAGENAMEASIDENTIFIER___.h +0 -14
- data/XCFit/Assets/XCFit/Cucumberish UI Test Bundle Base.xctemplate/___PACKAGENAMEASIDENTIFIER___.m +0 -17
- data/XCFit/Assets/XCFit/Cucumberish UI Test Bundle Base.xctemplate/___PACKAGENAMEASIDENTIFIER___.swift +0 -25
- data/XCFit/Assets/XCFit/Mac Acceptance Tests.xctemplate/Empty.xib +0 -12
- data/XCFit/Assets/XCFit/Mac Acceptance Tests.xctemplate/TemplateInfo.plist +0 -54
- data/XCFit/Assets/XCFit/MacOS API Cucumberish Testing Bundle.xctemplate/TemplateInfo.plist +0 -39
- data/XCFit/Assets/XCFit/MacOS UI Cucumberish Testing Bundle.xctemplate/TemplateInfo.plist +0 -39
- data/XCFit/Assets/XCFit/iOS API Cucumberish Testing Bundle.xctemplate/TemplateInfo.plist +0 -39
- data/XCFit/Assets/XCFit/iOS Acceptance Tests.xctemplate/TemplateInfo.plist +0 -52
- data/XCFit/Assets/XCFit/iOS UI Cucumberish Testing Bundle.xctemplate/TemplateInfo.plist +0 -39
@@ -0,0 +1,11 @@
|
|
1
|
+
#import <Foundation/Foundation.h>
|
2
|
+
#import "GHHasLocationProtocol.h"
|
3
|
+
|
4
|
+
@interface GHComment : NSObject <GHHasLocationProtocol>
|
5
|
+
|
6
|
+
@property (nonatomic, readonly) GHLocation * location;
|
7
|
+
@property (nonatomic, readonly) NSString * text;
|
8
|
+
|
9
|
+
- (id)initWithLocation:(GHLocation *)theLocation text:(NSString *)theText;
|
10
|
+
|
11
|
+
@end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
#import "GHComment.h"
|
2
|
+
|
3
|
+
@interface GHComment ()
|
4
|
+
|
5
|
+
@property (nonatomic, strong) GHLocation * location;
|
6
|
+
@property (nonatomic, strong) NSString * text;
|
7
|
+
|
8
|
+
@end
|
9
|
+
|
10
|
+
@implementation GHComment
|
11
|
+
|
12
|
+
@synthesize location;
|
13
|
+
@synthesize text;
|
14
|
+
|
15
|
+
- (id)initWithLocation:(GHLocation *)theLocation text:(NSString *)theText
|
16
|
+
{
|
17
|
+
if (self = [super init])
|
18
|
+
{
|
19
|
+
location = theLocation;
|
20
|
+
text = theText;
|
21
|
+
|
22
|
+
}
|
23
|
+
|
24
|
+
return self;
|
25
|
+
}
|
26
|
+
|
27
|
+
@end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
#import <Foundation/Foundation.h>
|
2
|
+
#import "GHStepArgument.h"
|
3
|
+
|
4
|
+
#import "GHHasRowsProtocol.h"
|
5
|
+
#import "GHHasLocationProtocol.h"
|
6
|
+
|
7
|
+
@interface GHDataTable : GHStepArgument <GHHasLocationProtocol, GHHasLocationProtocol>
|
8
|
+
|
9
|
+
@property (nonatomic, readonly) GHLocation * location;
|
10
|
+
@property (nonatomic, readonly) NSArray<GHTableRow *> * rows;
|
11
|
+
|
12
|
+
- (id)initWithTableRows:(NSArray<GHTableRow *> *)theRows;
|
13
|
+
|
14
|
+
@end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
#import "GHDataTable.h"
|
2
|
+
|
3
|
+
#import "GHTableRow.h"
|
4
|
+
|
5
|
+
@interface GHDataTable ()
|
6
|
+
|
7
|
+
@property (nonatomic, strong) GHLocation * location;
|
8
|
+
@property (nonatomic, strong) NSArray<GHTableRow *> * rows;
|
9
|
+
|
10
|
+
@end
|
11
|
+
|
12
|
+
@implementation GHDataTable
|
13
|
+
|
14
|
+
@synthesize location;
|
15
|
+
@synthesize rows;
|
16
|
+
|
17
|
+
- (id)initWithTableRows:(NSArray<GHTableRow *> *)theRows
|
18
|
+
{
|
19
|
+
NSAssert([theRows count], @"Rows argument cannot not be nil or empty");
|
20
|
+
|
21
|
+
if (self = [super init])
|
22
|
+
{
|
23
|
+
rows = theRows;
|
24
|
+
location = [[rows firstObject] location];
|
25
|
+
}
|
26
|
+
|
27
|
+
return self;
|
28
|
+
}
|
29
|
+
|
30
|
+
@end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
#import <Foundation/Foundation.h>
|
2
|
+
#import "GHStepArgument.h"
|
3
|
+
|
4
|
+
#import "GHHasLocationProtocol.h"
|
5
|
+
|
6
|
+
@interface GHDocString : GHStepArgument <GHHasLocationProtocol>
|
7
|
+
|
8
|
+
@property (nonatomic, readonly) GHLocation * location;
|
9
|
+
@property (nonatomic, readonly) NSString * contentType;
|
10
|
+
@property (nonatomic, readonly) NSString * content;
|
11
|
+
|
12
|
+
- (id)initWithLocation:(GHLocation *)theLocation contentType:(NSString *)theContentType content:(NSString *)theContent;
|
13
|
+
|
14
|
+
@end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
#import "GHDocString.h"
|
2
|
+
|
3
|
+
@interface GHDocString ()
|
4
|
+
|
5
|
+
@property (nonatomic, strong) GHLocation * location;
|
6
|
+
@property (nonatomic, strong) NSString * contentType;
|
7
|
+
@property (nonatomic, strong) NSString * content;
|
8
|
+
|
9
|
+
@end
|
10
|
+
|
11
|
+
@implementation GHDocString
|
12
|
+
|
13
|
+
@synthesize location;
|
14
|
+
@synthesize contentType;
|
15
|
+
@synthesize content;
|
16
|
+
|
17
|
+
- (id)initWithLocation:(GHLocation *)theLocation contentType:(NSString *)theContentType content:(NSString *)theContent
|
18
|
+
{
|
19
|
+
if (self = [super init])
|
20
|
+
{
|
21
|
+
location = theLocation;
|
22
|
+
contentType = theContentType;
|
23
|
+
content = theContent;
|
24
|
+
}
|
25
|
+
|
26
|
+
return self;
|
27
|
+
}
|
28
|
+
|
29
|
+
@end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
#import <Foundation/Foundation.h>
|
2
|
+
#import <Foundation/Foundation.h>
|
3
|
+
#import "GHHasLocationProtocol.h"
|
4
|
+
#import "GHHasDescriptionProtocol.h"
|
5
|
+
#import "GHHasRowsProtocol.h"
|
6
|
+
#import "GHHasTagsProtocol.h"
|
7
|
+
|
8
|
+
@class GHTag;
|
9
|
+
@class GHTableRow;
|
10
|
+
|
11
|
+
@interface GHExamples : NSObject <GHHasLocationProtocol, GHHasDescriptionProtocol, GHHasRowsProtocol, GHHasTagsProtocol>
|
12
|
+
|
13
|
+
@property (nonatomic, readonly) NSArray<GHTag *> * tags;
|
14
|
+
@property (nonatomic, readonly) GHLocation * location;
|
15
|
+
@property (nonatomic, readonly) NSString * keyword;
|
16
|
+
@property (nonatomic, readonly) NSString * name;
|
17
|
+
@property (nonatomic, readonly) NSString * desc;
|
18
|
+
@property (nonatomic, readonly) GHTableRow * tableHeader;
|
19
|
+
@property (nonatomic, readonly) NSArray<GHTableRow *> * tableBody;
|
20
|
+
|
21
|
+
- (id)initWithTags:(NSArray<GHTag *> *)theTags location:(GHLocation *)theLocation keyword:(NSString *)theKeyword name:(NSString *)theName description:(NSString *)theDescription header:(GHTableRow *)theHeader body:(NSArray<GHTableRow *> *)theBody;
|
22
|
+
|
23
|
+
|
24
|
+
@end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
#import "GHExamples.h"
|
2
|
+
|
3
|
+
#import "GHTag.h"
|
4
|
+
#import "GHTableRow.h"
|
5
|
+
|
6
|
+
@interface GHExamples ()
|
7
|
+
|
8
|
+
@property (nonatomic, strong) NSArray<GHTag *> * tags;
|
9
|
+
@property (nonatomic, strong) GHLocation * location;
|
10
|
+
@property (nonatomic, strong) NSString * keyword;
|
11
|
+
@property (nonatomic, strong) NSString * name;
|
12
|
+
@property (nonatomic, strong) NSString * desc;
|
13
|
+
@property (nonatomic, strong) GHTableRow * tableHeader;
|
14
|
+
@property (nonatomic, strong) NSArray<GHTableRow *> * tableBody;
|
15
|
+
|
16
|
+
@end
|
17
|
+
|
18
|
+
@implementation GHExamples
|
19
|
+
|
20
|
+
@synthesize tags;
|
21
|
+
@synthesize location;
|
22
|
+
@synthesize keyword;
|
23
|
+
@synthesize name;
|
24
|
+
@synthesize desc;
|
25
|
+
@synthesize tableHeader;
|
26
|
+
@synthesize tableBody;
|
27
|
+
|
28
|
+
- (id)initWithTags:(NSArray<GHTag *> *)theTags location:(GHLocation *)theLocation keyword:(NSString *)theKeyword name:(NSString *)theName description:(NSString *)theDescription header:(GHTableRow *)theHeader body:(NSArray<GHTableRow *> *)theBody
|
29
|
+
{
|
30
|
+
if (self = [super init])
|
31
|
+
{
|
32
|
+
tags = theTags;
|
33
|
+
location = theLocation;
|
34
|
+
keyword = theKeyword;
|
35
|
+
name = theName;
|
36
|
+
desc = theDescription;
|
37
|
+
tableHeader = theHeader;
|
38
|
+
tableBody = theBody;
|
39
|
+
}
|
40
|
+
|
41
|
+
return self;
|
42
|
+
}
|
43
|
+
|
44
|
+
- (NSArray<GHTableRow *> *)rows
|
45
|
+
{
|
46
|
+
return [@[ tableHeader ] arrayByAddingObjectsFromArray: tableBody];
|
47
|
+
}
|
48
|
+
|
49
|
+
@end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
#import "GHHasLocationProtocol.h"
|
2
|
+
#import "GHHasDescriptionProtocol.h"
|
3
|
+
#import "GHHasTagsProtocol.h"
|
4
|
+
|
5
|
+
@class GHTag;
|
6
|
+
@class GHLocation;
|
7
|
+
@class GHBackground;
|
8
|
+
@class GHScenarioDefinition;
|
9
|
+
@class GHComment;
|
10
|
+
|
11
|
+
@interface GHFeature : NSObject <GHHasLocationProtocol, GHHasDescriptionProtocol, GHHasTagsProtocol>
|
12
|
+
|
13
|
+
@property (nonatomic, readonly) NSArray<GHTag *> * tags;
|
14
|
+
@property (nonatomic, readonly) GHLocation * location;
|
15
|
+
@property (nonatomic, readonly) NSString * language;
|
16
|
+
@property (nonatomic, readonly) NSString * keyword;
|
17
|
+
@property (nonatomic, readonly) NSString * name;
|
18
|
+
@property (nonatomic, readonly) NSString * desc;
|
19
|
+
@property (nonatomic, readonly) NSArray<GHScenarioDefinition *> * children;
|
20
|
+
@property (nonatomic, readonly) NSArray<GHComment *> * comments;
|
21
|
+
|
22
|
+
- (id)initWithTags:(NSArray<GHTag *> *)theTags location:(GHLocation *)theLocation language:(NSString *)theLanguage keyword:(NSString *)theKeyword name:(NSString *)theName description:(NSString *)theDescription children:(NSArray<GHScenarioDefinition *> *)theChildren comments:(NSArray<GHComment *> *)theComments;
|
23
|
+
|
24
|
+
@end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
#import "GHFeature.h"
|
2
|
+
|
3
|
+
#import "GHTag.h"
|
4
|
+
#import "GHLocation.h"
|
5
|
+
#import "GHBackground.h"
|
6
|
+
#import "GHScenarioDefinition.h"
|
7
|
+
#import "GHComment.h"
|
8
|
+
|
9
|
+
@interface GHFeature ()
|
10
|
+
|
11
|
+
@property (nonatomic, strong) NSArray<GHTag *> * tags;
|
12
|
+
@property (nonatomic, strong) GHLocation * location;
|
13
|
+
@property (nonatomic, strong) NSString * language;
|
14
|
+
@property (nonatomic, strong) NSString * keyword;
|
15
|
+
@property (nonatomic, strong) NSString * name;
|
16
|
+
@property (nonatomic, strong) NSString * desc;
|
17
|
+
@property (nonatomic, strong) NSArray<GHScenarioDefinition *> * children;
|
18
|
+
@property (nonatomic, strong) NSArray<GHComment *> * comments;
|
19
|
+
|
20
|
+
@end
|
21
|
+
|
22
|
+
@implementation GHFeature
|
23
|
+
|
24
|
+
@synthesize tags;
|
25
|
+
@synthesize location;
|
26
|
+
@synthesize language;
|
27
|
+
@synthesize keyword;
|
28
|
+
@synthesize name;
|
29
|
+
@synthesize desc;
|
30
|
+
@synthesize children;
|
31
|
+
@synthesize comments;
|
32
|
+
|
33
|
+
- (id)initWithTags:(NSArray<GHTag *> *)theTags location:(GHLocation *)theLocation language:(NSString *)theLanguage keyword:(NSString *)theKeyword name:(NSString *)theName description:(NSString *)theDescription children:(NSArray<GHScenarioDefinition *> *)theChildren comments:(NSArray<GHComment *> *)theComments
|
34
|
+
{
|
35
|
+
if (self = [super init])
|
36
|
+
{
|
37
|
+
tags = theTags;
|
38
|
+
location = theLocation;
|
39
|
+
language = theLanguage;
|
40
|
+
keyword = theKeyword;
|
41
|
+
name = theName;
|
42
|
+
desc = theDescription;
|
43
|
+
children = theChildren;
|
44
|
+
comments = theComments;
|
45
|
+
}
|
46
|
+
|
47
|
+
return self;
|
48
|
+
}
|
49
|
+
|
50
|
+
@end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
#import <Foundation/Foundation.h>
|
2
|
+
|
3
|
+
@interface GHGherkinDialect : NSObject
|
4
|
+
|
5
|
+
@property (nonatomic, readonly) NSString * language;
|
6
|
+
@property (nonatomic, readonly) NSArray<NSString *> * featureKeywords;
|
7
|
+
@property (nonatomic, readonly) NSArray<NSString *> * backgroundKeywords;
|
8
|
+
@property (nonatomic, readonly) NSArray<NSString *> * scenarioKeywords;
|
9
|
+
@property (nonatomic, readonly) NSArray<NSString *> * scenarioOutlineKeywords;
|
10
|
+
@property (nonatomic, readonly) NSArray<NSString *> * examplesKeywords;
|
11
|
+
@property (nonatomic, readonly) NSArray<NSString *> * givenStepKeywords;
|
12
|
+
@property (nonatomic, readonly) NSArray<NSString *> * whenStepKeywords;
|
13
|
+
@property (nonatomic, readonly) NSArray<NSString *> * thenStepKeywords;
|
14
|
+
@property (nonatomic, readonly) NSArray<NSString *> * andStepKeywords;
|
15
|
+
@property (nonatomic, readonly) NSArray<NSString *> * butStepKeywords;
|
16
|
+
@property (nonatomic, readonly) NSArray<NSString *> * stepKeywords;
|
17
|
+
|
18
|
+
- (id)initWithLanguage:(NSString *)theLanguage featureKeywords:(NSArray<NSString *> *)theFeatureKeywords
|
19
|
+
backgroundKeywords:(NSArray<NSString *> *)theBackgroundKeywords scenarioKeywords:(NSArray<NSString *> *)theScenarioKeywords
|
20
|
+
scenarioOutlineKeywords:(NSArray<NSString *> *)theScenarioOutlineKeywords examplesKeywords:(NSArray<NSString *> *)theExamplesKeywords
|
21
|
+
givenStepKeywords:(NSArray<NSString *> *)theGivenStepKeywords whenStepKeywords:(NSArray<NSString *> *)theWhenStepKeywords
|
22
|
+
thenStepKeywords:(NSArray<NSString *> *)theThenStepKeywords andStepKeywords:(NSArray<NSString *> *)theAndStepKeywords
|
23
|
+
butStepKeywords:(NSArray<NSString *> *)theButStepKeywords;
|
24
|
+
|
25
|
+
@end
|
@@ -0,0 +1,64 @@
|
|
1
|
+
#import "GHGherkinDialect.h"
|
2
|
+
|
3
|
+
@interface GHGherkinDialect ()
|
4
|
+
|
5
|
+
@property (nonatomic, strong) NSString * language;
|
6
|
+
@property (nonatomic, strong) NSArray<NSString *> * featureKeywords;
|
7
|
+
@property (nonatomic, strong) NSArray<NSString *> * backgroundKeywords;
|
8
|
+
@property (nonatomic, strong) NSArray<NSString *> * scenarioKeywords;
|
9
|
+
@property (nonatomic, strong) NSArray<NSString *> * scenarioOutlineKeywords;
|
10
|
+
@property (nonatomic, strong) NSArray<NSString *> * examplesKeywords;
|
11
|
+
@property (nonatomic, strong) NSArray<NSString *> * givenStepKeywords;
|
12
|
+
@property (nonatomic, strong) NSArray<NSString *> * whenStepKeywords;
|
13
|
+
@property (nonatomic, strong) NSArray<NSString *> * thenStepKeywords;
|
14
|
+
@property (nonatomic, strong) NSArray<NSString *> * andStepKeywords;
|
15
|
+
@property (nonatomic, strong) NSArray<NSString *> * butStepKeywords;
|
16
|
+
@property (nonatomic, strong) NSArray<NSString *> * stepKeywords;
|
17
|
+
|
18
|
+
@end
|
19
|
+
|
20
|
+
@implementation GHGherkinDialect
|
21
|
+
|
22
|
+
@synthesize language;
|
23
|
+
@synthesize featureKeywords;
|
24
|
+
@synthesize backgroundKeywords;
|
25
|
+
@synthesize scenarioKeywords;
|
26
|
+
@synthesize scenarioOutlineKeywords;
|
27
|
+
@synthesize examplesKeywords;
|
28
|
+
@synthesize givenStepKeywords;
|
29
|
+
@synthesize whenStepKeywords;
|
30
|
+
@synthesize thenStepKeywords;
|
31
|
+
@synthesize andStepKeywords;
|
32
|
+
@synthesize butStepKeywords;
|
33
|
+
@synthesize stepKeywords;
|
34
|
+
|
35
|
+
- (id)initWithLanguage:(NSString *)theLanguage featureKeywords:(NSArray<NSString *> *)theFeatureKeywords
|
36
|
+
backgroundKeywords:(NSArray<NSString *> *)theBackgroundKeywords scenarioKeywords:(NSArray<NSString *> *)theScenarioKeywords
|
37
|
+
scenarioOutlineKeywords:(NSArray<NSString *> *)theScenarioOutlineKeywords examplesKeywords:(NSArray<NSString *> *)theExamplesKeywords
|
38
|
+
givenStepKeywords:(NSArray<NSString *> *)theGivenStepKeywords whenStepKeywords:(NSArray<NSString *> *)theWhenStepKeywords
|
39
|
+
thenStepKeywords:(NSArray<NSString *> *)theThenStepKeywords andStepKeywords:(NSArray<NSString *> *)theAndStepKeywords
|
40
|
+
butStepKeywords:(NSArray<NSString *> *)theButStepKeywords
|
41
|
+
{
|
42
|
+
if (self = [super init])
|
43
|
+
{
|
44
|
+
language = theLanguage;
|
45
|
+
featureKeywords = theFeatureKeywords;
|
46
|
+
backgroundKeywords = theBackgroundKeywords;
|
47
|
+
scenarioKeywords = theScenarioKeywords;
|
48
|
+
scenarioOutlineKeywords = theScenarioOutlineKeywords;
|
49
|
+
examplesKeywords = theExamplesKeywords;
|
50
|
+
givenStepKeywords = theGivenStepKeywords;
|
51
|
+
whenStepKeywords = theWhenStepKeywords;
|
52
|
+
thenStepKeywords = theThenStepKeywords;
|
53
|
+
andStepKeywords = theAndStepKeywords;
|
54
|
+
butStepKeywords = theButStepKeywords;
|
55
|
+
|
56
|
+
stepKeywords = [[[[givenStepKeywords arrayByAddingObjectsFromArray: whenStepKeywords] arrayByAddingObjectsFromArray: thenStepKeywords] arrayByAddingObjectsFromArray: andStepKeywords] arrayByAddingObjectsFromArray: butStepKeywords];
|
57
|
+
// Distinct using an NSOrderedSet
|
58
|
+
stepKeywords = [[[NSOrderedSet alloc] initWithArray: stepKeywords] array];
|
59
|
+
}
|
60
|
+
|
61
|
+
return self;
|
62
|
+
}
|
63
|
+
|
64
|
+
@end
|
@@ -0,0 +1,124 @@
|
|
1
|
+
#import "GHGherkinDialectProvider.h"
|
2
|
+
|
3
|
+
#import "GHGherkinDialect.h"
|
4
|
+
#import "GHGherkinLanguageSetting.h"
|
5
|
+
#import "GHLocation.h"
|
6
|
+
#import "GHParserException.h"
|
7
|
+
|
8
|
+
@interface GHGherkinDialectProvider ()
|
9
|
+
|
10
|
+
- (GHGherkinDialect *)dialectWithLanguage:(NSString *)theLanguage languageSetting:(GHGherkinLanguageSetting *)theLanguageSetting;
|
11
|
+
- (GHGherkinDialect *)dialectWithLanguage:(NSString *)theLanguage languagesSetting:(NSDictionary<NSString *, GHGherkinLanguageSetting *> *)theLanguagesSetting location:(GHLocation *)theLocation;
|
12
|
+
- (NSDictionary<NSString *, GHGherkinLanguageSetting *> *)parseJsonContent:(NSData *)theLanguagesFileContent;
|
13
|
+
- (NSDictionary<NSString *, GHGherkinLanguageSetting *> *)languagesSetting;
|
14
|
+
|
15
|
+
- (NSArray<NSString *> *)parseStepKeywords:(NSArray<NSString *> *)theStepKeywords;
|
16
|
+
- (NSArray<NSString *> *)parseTitleKeywords:(NSArray<NSString *> *)theKeywords;
|
17
|
+
|
18
|
+
@end
|
19
|
+
|
20
|
+
@implementation GHGherkinDialectProvider
|
21
|
+
{
|
22
|
+
GHGherkinDialect * defaultDialect;
|
23
|
+
NSString * language;
|
24
|
+
}
|
25
|
+
|
26
|
+
- (GHGherkinDialect *)defaultDialect
|
27
|
+
{
|
28
|
+
return [self dialectWithLanguage: language location: nil];
|
29
|
+
}
|
30
|
+
|
31
|
+
- (id)init
|
32
|
+
{
|
33
|
+
return [self initWithLanguage: @"en"];
|
34
|
+
}
|
35
|
+
|
36
|
+
- (id)initWithLanguage:(NSString *)theLanguage
|
37
|
+
{
|
38
|
+
if (self = [super init])
|
39
|
+
{
|
40
|
+
language = theLanguage;
|
41
|
+
}
|
42
|
+
|
43
|
+
return self;
|
44
|
+
}
|
45
|
+
|
46
|
+
- (GHGherkinDialect *)dialectWithLanguage:(NSString *)theLanguage location:(GHLocation *)theLocation
|
47
|
+
{
|
48
|
+
NSDictionary<NSString *, GHGherkinLanguageSetting *> * languagesSetting = [self languagesSetting];
|
49
|
+
|
50
|
+
return [self dialectWithLanguage: theLanguage languagesSetting: languagesSetting location: theLocation];
|
51
|
+
}
|
52
|
+
|
53
|
+
- (NSDictionary<NSString *, GHGherkinLanguageSetting *> *)languagesSetting
|
54
|
+
{
|
55
|
+
NSBundle * gherkinLanguagesBundle = [NSBundle bundleWithPath: [[NSBundle bundleForClass:[self class]] pathForResource: @"GherkinLanguages" ofType: @"bundle"]];
|
56
|
+
if(gherkinLanguagesBundle == nil){
|
57
|
+
gherkinLanguagesBundle = [NSBundle bundleForClass:[self class]];
|
58
|
+
}
|
59
|
+
NSData * languagesFileContent = [NSData dataWithContentsOfFile: [gherkinLanguagesBundle pathForResource: @"gherkin-languages" ofType: @"json"]];
|
60
|
+
|
61
|
+
/*TODO: check for error
|
62
|
+
if (resourceStream == null)
|
63
|
+
throw new InvalidOperationException("Gherkin language resource not found: " + languageFileName);*/
|
64
|
+
|
65
|
+
return [self parseJsonContent: languagesFileContent];
|
66
|
+
}
|
67
|
+
|
68
|
+
- (NSDictionary<NSString *, GHGherkinLanguageSetting *> *)parseJsonContent:(NSData *)theLanguagesFileContent
|
69
|
+
{
|
70
|
+
NSError * error;
|
71
|
+
NSDictionary<NSString *, GHGherkinLanguageSetting *> * languagesSetting = nil;
|
72
|
+
id parsingResult = [NSJSONSerialization JSONObjectWithData: theLanguagesFileContent options: 0 error: &error];
|
73
|
+
if (parsingResult)
|
74
|
+
{
|
75
|
+
NSMutableDictionary<NSString *, GHGherkinLanguageSetting *> * languagesSettingBuffer = [[NSMutableDictionary<NSString *, GHGherkinLanguageSetting *> alloc] initWithCapacity: [parsingResult count]];
|
76
|
+
for (NSString * languageKey in parsingResult)
|
77
|
+
{
|
78
|
+
NSDictionary * languageSettingDictionary = parsingResult[languageKey];
|
79
|
+
GHGherkinLanguageSetting * languageSetting = [[GHGherkinLanguageSetting alloc] init];
|
80
|
+
[languageSetting setValuesForKeysWithDictionary: languageSettingDictionary];
|
81
|
+
|
82
|
+
languagesSettingBuffer[languageKey] = languageSetting;
|
83
|
+
}
|
84
|
+
languagesSetting = [[NSDictionary<NSString *, GHGherkinLanguageSetting *> alloc] initWithDictionary: languagesSettingBuffer];
|
85
|
+
}
|
86
|
+
|
87
|
+
return languagesSetting;
|
88
|
+
}
|
89
|
+
|
90
|
+
- (GHGherkinDialect *)dialectWithLanguage:(NSString *)theLanguage languagesSetting:(NSDictionary<NSString *, GHGherkinLanguageSetting *> *)theLanguagesSetting location:(GHLocation *)theLocation
|
91
|
+
{
|
92
|
+
GHGherkinLanguageSetting * languageSetting = nil;
|
93
|
+
if ((languageSetting = theLanguagesSetting[theLanguage]) == nil)
|
94
|
+
@throw [[GHNoSuchLanguageException alloc] initWithLanguage: theLanguage location: theLocation];
|
95
|
+
|
96
|
+
return [self dialectWithLanguage: theLanguage languageSetting: languageSetting];
|
97
|
+
}
|
98
|
+
|
99
|
+
- (GHGherkinDialect *)dialectWithLanguage:(NSString *)theLanguage languageSetting:(GHGherkinLanguageSetting *)theLanguageSetting
|
100
|
+
{
|
101
|
+
return [[GHGherkinDialect alloc] initWithLanguage: theLanguage
|
102
|
+
featureKeywords: [self parseTitleKeywords: theLanguageSetting.feature]
|
103
|
+
backgroundKeywords: [self parseTitleKeywords: theLanguageSetting.background]
|
104
|
+
scenarioKeywords: [self parseTitleKeywords: theLanguageSetting.scenario]
|
105
|
+
scenarioOutlineKeywords: [self parseTitleKeywords: theLanguageSetting.scenarioOutline]
|
106
|
+
examplesKeywords: [self parseTitleKeywords: theLanguageSetting.examples]
|
107
|
+
givenStepKeywords: [self parseStepKeywords: theLanguageSetting.given]
|
108
|
+
whenStepKeywords: [self parseStepKeywords: theLanguageSetting.when]
|
109
|
+
thenStepKeywords: [self parseStepKeywords: theLanguageSetting.then]
|
110
|
+
andStepKeywords: [self parseStepKeywords: theLanguageSetting.and]
|
111
|
+
butStepKeywords: [self parseStepKeywords: theLanguageSetting.but]];
|
112
|
+
}
|
113
|
+
|
114
|
+
- (NSArray<NSString *> *)parseStepKeywords:(NSArray<NSString *> *)theStepKeywords
|
115
|
+
{
|
116
|
+
return theStepKeywords;
|
117
|
+
}
|
118
|
+
|
119
|
+
- (NSArray<NSString *> *)parseTitleKeywords:(NSArray<NSString *> *)theKeywords
|
120
|
+
{
|
121
|
+
return theKeywords;
|
122
|
+
}
|
123
|
+
|
124
|
+
@end
|