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,55 @@
|
|
1
|
+
#import <Foundation/Foundation.h>
|
2
|
+
@class GHLocation;
|
3
|
+
@class GHToken;
|
4
|
+
|
5
|
+
@interface GHParserException : NSException
|
6
|
+
|
7
|
+
@property (nonatomic, readonly) GHLocation * location;
|
8
|
+
|
9
|
+
@end
|
10
|
+
|
11
|
+
@interface GHAstBuilderException : GHParserException
|
12
|
+
|
13
|
+
- (id)initWithMessage:(NSString *)theMessage;
|
14
|
+
- (id)initWithMessage:(NSString *)theMessage location:(GHLocation *)theLocation;
|
15
|
+
|
16
|
+
@end
|
17
|
+
|
18
|
+
@interface GHNoSuchLanguageException : GHParserException
|
19
|
+
|
20
|
+
- (id)initWithLanguage:(NSString *)theLanguage location:(GHLocation *)theLocation;
|
21
|
+
|
22
|
+
@end
|
23
|
+
|
24
|
+
@interface GHTokenParserException : GHParserException
|
25
|
+
|
26
|
+
- (id)initWithMessage:(NSString *)theMessage token:(GHToken *)theToken;
|
27
|
+
|
28
|
+
@end
|
29
|
+
|
30
|
+
@interface GHUnexpectedTokenException : GHTokenParserException
|
31
|
+
|
32
|
+
@property (nonatomic, readonly) NSString * stateComment;
|
33
|
+
@property (nonatomic, readonly) GHToken * receivedToken;
|
34
|
+
@property (nonatomic, readonly) NSArray<NSString *> * expectedTokenTypes;
|
35
|
+
|
36
|
+
- (id)initWithToken:(GHToken *)theReceivedToken expectedTokenTypes:(NSArray<NSString *> *)theExpectedTokenTypes stateComment:(NSString *)theStateComment;
|
37
|
+
|
38
|
+
@end
|
39
|
+
|
40
|
+
@interface GHUnexpectedEOFException : GHTokenParserException
|
41
|
+
|
42
|
+
@property (nonatomic, readonly) NSString * stateComment;
|
43
|
+
@property (nonatomic, readonly) NSArray<NSString *> * expectedTokenTypes;
|
44
|
+
|
45
|
+
- (id)initWithToken:(GHToken *)theReceivedToken expectedTokenTypes:(NSArray<NSString *> *)theExpectedTokenTypes stateComment:(NSString *)theStateComment;
|
46
|
+
|
47
|
+
@end
|
48
|
+
|
49
|
+
@interface GHCompositeParserException : GHParserException
|
50
|
+
|
51
|
+
@property (nonatomic, readonly) NSArray<GHParserException *> * errors;
|
52
|
+
|
53
|
+
- (id)initWithErrors:(NSArray<GHParserException *> *)theErrors;
|
54
|
+
|
55
|
+
@end
|
@@ -0,0 +1,192 @@
|
|
1
|
+
#import "GHParserException.h"
|
2
|
+
|
3
|
+
#import "GHLocation.h"
|
4
|
+
#import "GHToken.h"
|
5
|
+
|
6
|
+
@interface GHParserException ()
|
7
|
+
|
8
|
+
@property (nonatomic, strong) GHLocation * location;
|
9
|
+
|
10
|
+
- (id)initWithMessage:(NSString *)theMessage location:(GHLocation *)theLocation;
|
11
|
+
|
12
|
+
@end
|
13
|
+
|
14
|
+
@implementation GHParserException
|
15
|
+
|
16
|
+
@synthesize location;
|
17
|
+
|
18
|
+
- (id)initWithMessage:(NSString *)theMessage
|
19
|
+
{
|
20
|
+
return [super initWithName: NSParseErrorException reason: theMessage userInfo: nil];
|
21
|
+
}
|
22
|
+
|
23
|
+
- (id)initWithMessage:(NSString *)theMessage location:(GHLocation *)theLocation
|
24
|
+
{
|
25
|
+
NSAssert(theLocation != nil, @"Location should not be nil");
|
26
|
+
|
27
|
+
if (self = [super initWithName: NSParseErrorException reason: [[self class] message: theMessage withLocation: theLocation] userInfo: nil])
|
28
|
+
{
|
29
|
+
location = theLocation;
|
30
|
+
}
|
31
|
+
|
32
|
+
return self;
|
33
|
+
}
|
34
|
+
|
35
|
+
+ (NSString *)message:(NSString *)theMessage withLocation:(GHLocation *)theLocation
|
36
|
+
{
|
37
|
+
NSAssert(theLocation != nil, @"Location should not be nil");
|
38
|
+
|
39
|
+
return [NSString stringWithFormat: @"(%d:%d): %@", (int)[theLocation line], (int)[theLocation column], theMessage];
|
40
|
+
}
|
41
|
+
|
42
|
+
@end
|
43
|
+
|
44
|
+
@implementation GHAstBuilderException
|
45
|
+
|
46
|
+
- (id)initWithMessage:(NSString *)theMessage
|
47
|
+
{
|
48
|
+
NSAssert(theMessage != nil, @"Message should not be nil");
|
49
|
+
|
50
|
+
return [super initWithMessage: theMessage];
|
51
|
+
}
|
52
|
+
|
53
|
+
- (id)initWithMessage:(NSString *)theMessage location:(GHLocation *)theLocation
|
54
|
+
{
|
55
|
+
NSAssert(theLocation != nil, @"Location should not be nil");
|
56
|
+
NSAssert(theMessage != nil, @"Location should not be nil");
|
57
|
+
|
58
|
+
return [super initWithMessage: theMessage location: theLocation];
|
59
|
+
}
|
60
|
+
|
61
|
+
@end
|
62
|
+
|
63
|
+
@implementation GHNoSuchLanguageException
|
64
|
+
|
65
|
+
- (id)initWithLanguage:(NSString *)theLanguage location:(GHLocation *)theLocation
|
66
|
+
{
|
67
|
+
return [super initWithMessage: [@"Language not supported: " stringByAppendingString: theLanguage] location: theLocation];
|
68
|
+
}
|
69
|
+
|
70
|
+
@end
|
71
|
+
|
72
|
+
@implementation GHTokenParserException
|
73
|
+
|
74
|
+
- (id)initWithMessage:(NSString *)theMessage token:(GHToken *)theToken
|
75
|
+
{
|
76
|
+
return [super initWithMessage: theMessage location: [[self class] locationWithToken: theToken]];
|
77
|
+
}
|
78
|
+
|
79
|
+
+ (GHLocation *)locationWithToken:(GHToken *)theReceivedToken
|
80
|
+
{
|
81
|
+
return [theReceivedToken isEOF] || [[theReceivedToken location] column] > 1
|
82
|
+
? [theReceivedToken location]
|
83
|
+
: [[GHLocation alloc] initWithLine: [[theReceivedToken location] line] column: [[theReceivedToken line] indent] + 1];
|
84
|
+
}
|
85
|
+
|
86
|
+
@end
|
87
|
+
|
88
|
+
@interface GHUnexpectedTokenException ()
|
89
|
+
|
90
|
+
@property (nonatomic, strong) NSString * stateComment;
|
91
|
+
@property (nonatomic, strong) GHToken * receivedToken;
|
92
|
+
@property (nonatomic, strong) NSArray<NSString *> * expectedTokenTypes;
|
93
|
+
|
94
|
+
@end
|
95
|
+
|
96
|
+
@implementation GHUnexpectedTokenException
|
97
|
+
|
98
|
+
@synthesize stateComment;
|
99
|
+
@synthesize receivedToken;
|
100
|
+
@synthesize expectedTokenTypes;
|
101
|
+
|
102
|
+
- (id)initWithToken:(GHToken *)theReceivedToken expectedTokenTypes:(NSArray<NSString *> *)theExpectedTokenTypes stateComment:(NSString *)theStateComment
|
103
|
+
{
|
104
|
+
NSAssert(theReceivedToken != nil, @"receivedToken should not be nil");
|
105
|
+
NSAssert(theExpectedTokenTypes != nil, @"expectedTokenTypes should not be nil");
|
106
|
+
|
107
|
+
if (self = [super initWithMessage: [[self class] messageWithToken: theReceivedToken expectedTokenTypes: theExpectedTokenTypes] token: theReceivedToken])
|
108
|
+
{
|
109
|
+
receivedToken = theReceivedToken;
|
110
|
+
expectedTokenTypes = theExpectedTokenTypes;
|
111
|
+
stateComment = theStateComment;
|
112
|
+
}
|
113
|
+
|
114
|
+
return self;
|
115
|
+
}
|
116
|
+
|
117
|
+
+ (NSString *)messageWithToken:(GHToken *)theReceivedToken expectedTokenTypes:(NSArray<NSString *> *)theExpectedTokenTypes
|
118
|
+
{
|
119
|
+
NSAssert(theReceivedToken != nil, @"receivedToken");
|
120
|
+
NSAssert(theExpectedTokenTypes != nil, @"expectedTokenTypes");
|
121
|
+
|
122
|
+
return [NSString stringWithFormat: @"expected: %@, got '%@'", [theExpectedTokenTypes componentsJoinedByString: @", "], [[theReceivedToken tokenValue] stringByTrimmingCharactersInSet: [NSCharacterSet whitespaceAndNewlineCharacterSet]]];
|
123
|
+
}
|
124
|
+
|
125
|
+
@end
|
126
|
+
|
127
|
+
@interface GHUnexpectedEOFException ()
|
128
|
+
|
129
|
+
@property (nonatomic, strong) NSString * stateComment;
|
130
|
+
@property (nonatomic, strong) NSArray<NSString *> * expectedTokenTypes;
|
131
|
+
|
132
|
+
@end
|
133
|
+
|
134
|
+
@implementation GHUnexpectedEOFException
|
135
|
+
|
136
|
+
@synthesize stateComment;
|
137
|
+
@synthesize expectedTokenTypes;
|
138
|
+
|
139
|
+
- (id)initWithToken:(GHToken *)theReceivedToken expectedTokenTypes:(NSArray<NSString *> *)theExpectedTokenTypes stateComment:(NSString *)theStateComment
|
140
|
+
{
|
141
|
+
NSAssert(theExpectedTokenTypes != nil, @"expectedTokenTypes should not be nil");
|
142
|
+
|
143
|
+
if (self = [super initWithMessage: [[self class] messageWithExpectedTokenTypes: theExpectedTokenTypes] token: theReceivedToken])
|
144
|
+
{
|
145
|
+
expectedTokenTypes = theExpectedTokenTypes;
|
146
|
+
stateComment = theStateComment;
|
147
|
+
}
|
148
|
+
|
149
|
+
return self;
|
150
|
+
}
|
151
|
+
|
152
|
+
+ (NSString *)messageWithExpectedTokenTypes:(NSArray<NSString *> *)theExpectedTokenTypes
|
153
|
+
{
|
154
|
+
NSAssert(theExpectedTokenTypes != nil, @"expectedTokenTypes should not be nil");
|
155
|
+
|
156
|
+
return [NSString stringWithFormat: @"unexpected end of file, expected: %@", [theExpectedTokenTypes componentsJoinedByString: @", "]];
|
157
|
+
}
|
158
|
+
|
159
|
+
@end
|
160
|
+
|
161
|
+
|
162
|
+
@interface GHCompositeParserException ()
|
163
|
+
|
164
|
+
@property (nonatomic, strong) NSArray<GHParserException *> * errors;
|
165
|
+
|
166
|
+
@end
|
167
|
+
|
168
|
+
@implementation GHCompositeParserException
|
169
|
+
|
170
|
+
@synthesize errors;
|
171
|
+
|
172
|
+
- (id)initWithErrors:(NSArray<GHParserException *> *)theErrors
|
173
|
+
{
|
174
|
+
NSAssert([theErrors count] != 0, @"Errors list should not be nil or empty");
|
175
|
+
|
176
|
+
if (self = [super initWithMessage: [[self class] messageWithErrors: theErrors]])
|
177
|
+
{
|
178
|
+
errors = theErrors;
|
179
|
+
}
|
180
|
+
|
181
|
+
return self;
|
182
|
+
}
|
183
|
+
|
184
|
+
+ (NSString *)messageWithErrors:(NSArray<GHParserException *> *)theErrors
|
185
|
+
{
|
186
|
+
if (!theErrors)
|
187
|
+
@throw [NSException exceptionWithName: NSInvalidArgumentException reason: @"errors list should not be null" userInfo: nil];
|
188
|
+
|
189
|
+
return [@"Parser errors:\n" stringByAppendingString: [[theErrors valueForKey: @"reason"] componentsJoinedByString: @"\n"]];
|
190
|
+
}
|
191
|
+
|
192
|
+
@end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
#import <Foundation/Foundation.h>
|
2
|
+
#import "GHScenarioDefinition.h"
|
3
|
+
|
4
|
+
@class GHTag;
|
5
|
+
@class GHLocation;
|
6
|
+
@class GHStep;
|
7
|
+
|
8
|
+
@interface GHScenario : GHScenarioDefinition
|
9
|
+
|
10
|
+
@property (nonatomic, readonly) NSArray<GHTag *> * tags;
|
11
|
+
|
12
|
+
- (id)initWithTags:(NSArray<GHTag *> *)theTags location:(GHLocation *)theLocation keyword:(NSString *)theKeyword name:(NSString *)theName description:(NSString *)theDescription steps:(NSArray<GHStep *> *)theSteps;
|
13
|
+
|
14
|
+
@end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
#import "GHScenario.h"
|
2
|
+
|
3
|
+
#import "GHScenarioDefinition_Private.h"
|
4
|
+
|
5
|
+
#import "GHLocation.h"
|
6
|
+
|
7
|
+
@implementation GHScenario
|
8
|
+
@synthesize tags;
|
9
|
+
- (id)initWithTags:(NSArray<GHTag *> *)theTags location:(GHLocation *)theLocation keyword:(NSString *)theKeyword name:(NSString *)theName description:(NSString *)theDescription steps:(NSArray<GHStep *> *)theSteps
|
10
|
+
{
|
11
|
+
|
12
|
+
self = [super initWithLocation: theLocation keyword: theKeyword name: theName description: theDescription steps: theSteps];
|
13
|
+
tags = theTags;
|
14
|
+
return self;
|
15
|
+
}
|
16
|
+
|
17
|
+
@end
|
18
|
+
|
@@ -0,0 +1,23 @@
|
|
1
|
+
#import <Foundation/Foundation.h>
|
2
|
+
#import "GHHasLocationProtocol.h"
|
3
|
+
#import "GHHasDescriptionProtocol.h"
|
4
|
+
#import "GHHasStepsProtocol.h"
|
5
|
+
#import "GHHasTagsProtocol.h"
|
6
|
+
|
7
|
+
@class GHTag;
|
8
|
+
@class GHLocation;
|
9
|
+
@class GHStep;
|
10
|
+
|
11
|
+
@interface GHScenarioDefinition : NSObject <GHHasLocationProtocol, GHHasDescriptionProtocol, GHHasStepsProtocol, GHHasTagsProtocol>
|
12
|
+
|
13
|
+
|
14
|
+
|
15
|
+
@property (nonatomic, readonly) GHLocation * location;
|
16
|
+
@property (nonatomic, readonly) NSString * keyword;
|
17
|
+
@property (nonatomic, readonly) NSString * name;
|
18
|
+
@property (nonatomic, readonly) NSString * desc;
|
19
|
+
@property (nonatomic, readonly) NSArray<GHStep *> * steps;
|
20
|
+
|
21
|
+
- (id)initWithLocation:(GHLocation *)theLocation keyword:(NSString *)theKeyword name:(NSString *)theName description:(NSString *)theDescription steps:(NSArray *)theSteps;
|
22
|
+
|
23
|
+
@end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
#import "GHScenarioDefinition.h"
|
2
|
+
|
3
|
+
#import "GHScenarioDefinition_Private.h"
|
4
|
+
|
5
|
+
#import "GHTag.h"
|
6
|
+
#import "GHStep.h"
|
7
|
+
|
8
|
+
@interface GHScenarioDefinition ()
|
9
|
+
|
10
|
+
@property (nonatomic, strong) NSArray<GHTag *> * tags;
|
11
|
+
@property (nonatomic, strong) GHLocation * location;
|
12
|
+
@property (nonatomic, strong) NSString * keyword;
|
13
|
+
@property (nonatomic, strong) NSString * name;
|
14
|
+
@property (nonatomic, strong) NSString * desc;
|
15
|
+
@property (nonatomic, strong) NSArray<GHStep *> * steps;
|
16
|
+
|
17
|
+
@end
|
18
|
+
|
19
|
+
@implementation GHScenarioDefinition
|
20
|
+
|
21
|
+
@synthesize location;
|
22
|
+
@synthesize keyword;
|
23
|
+
@synthesize name;
|
24
|
+
@synthesize desc;
|
25
|
+
@synthesize steps;
|
26
|
+
|
27
|
+
- (id)initWithLocation:(GHLocation *)theLocation keyword:(NSString *)theKeyword name:(NSString *)theName description:(NSString *)theDescription steps:(NSArray<GHStep *> *)theSteps
|
28
|
+
{
|
29
|
+
if (self = [super init])
|
30
|
+
{
|
31
|
+
location = theLocation;
|
32
|
+
keyword = theKeyword;
|
33
|
+
name = theName;
|
34
|
+
desc = theDescription;
|
35
|
+
steps = theSteps;
|
36
|
+
}
|
37
|
+
|
38
|
+
return self;
|
39
|
+
}
|
40
|
+
|
41
|
+
@end
|
@@ -0,0 +1,6 @@
|
|
1
|
+
#import <Foundation/Foundation.h>
|
2
|
+
@interface GHScenarioDefinition (Private)
|
3
|
+
|
4
|
+
- (id)initWithLocation:(GHLocation *)theLocation keyword:(NSString *)theKeyword name:(NSString *)theName description:(NSString *)theDescription steps:(NSArray<GHStep *> *)theSteps;
|
5
|
+
|
6
|
+
@end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
#import <Foundation/Foundation.h>
|
2
|
+
#import "GHScenarioDefinition.h"
|
3
|
+
|
4
|
+
@class GHExamples;
|
5
|
+
|
6
|
+
@interface GHScenarioOutline : GHScenarioDefinition
|
7
|
+
|
8
|
+
@property (nonatomic, readonly) NSArray<GHExamples *> * examples;
|
9
|
+
|
10
|
+
@property (nonatomic, readonly) NSArray<GHTag *> * tags;
|
11
|
+
|
12
|
+
|
13
|
+
- (id)initWithTags:(NSArray<GHTag *> *)theTags location:(GHLocation *)theLocation keyword:(NSString *)theKeyword name:(NSString *)theName description:(NSString *)theDescription steps:(NSArray<GHStep *> *)theSteps examples:(NSArray<GHExamples *> *)theExamples;
|
14
|
+
|
15
|
+
@end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
#import "GHScenarioOutline.h"
|
2
|
+
|
3
|
+
#import "GHScenarioDefinition_Private.h"
|
4
|
+
|
5
|
+
@interface GHScenarioOutline ()
|
6
|
+
|
7
|
+
@property (nonatomic, strong) NSArray<GHExamples *> * examples;
|
8
|
+
|
9
|
+
@end
|
10
|
+
|
11
|
+
@implementation GHScenarioOutline
|
12
|
+
|
13
|
+
@synthesize examples;
|
14
|
+
@synthesize tags;
|
15
|
+
|
16
|
+
- (id)initWithTags:(NSArray<GHTag *> *)theTags location:(GHLocation *)theLocation keyword:(NSString *)theKeyword name:(NSString *)theName description:(NSString *)theDescription steps:(NSArray<GHStep *> *)theSteps examples:(NSArray<GHExamples *> *)theExamples
|
17
|
+
{
|
18
|
+
if (self = [super initWithLocation: theLocation keyword: theKeyword name: theName description: theDescription steps: theSteps])
|
19
|
+
{
|
20
|
+
examples = theExamples;
|
21
|
+
tags = theTags;
|
22
|
+
}
|
23
|
+
return self;
|
24
|
+
}
|
25
|
+
|
26
|
+
@end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
#import <Foundation/Foundation.h>
|
2
|
+
#import "GHHasLocationProtocol.h"
|
3
|
+
|
4
|
+
@class GHLocation;
|
5
|
+
@class GHStepArgument;
|
6
|
+
|
7
|
+
@interface GHStep : NSObject <GHHasLocationProtocol>
|
8
|
+
|
9
|
+
@property (nonatomic, readonly) GHLocation * location;
|
10
|
+
@property (nonatomic, readonly) NSString * keyword;
|
11
|
+
@property (nonatomic, readonly) NSString * text;
|
12
|
+
@property (nonatomic, readonly) GHStepArgument * argument;
|
13
|
+
|
14
|
+
- (id)initWithLocation:(GHLocation *)theLocation keyword:(NSString *)theKeyword text:(NSString *)theText stepArgument:(GHStepArgument *)theStepArgument;
|
15
|
+
|
16
|
+
@end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
#import "GHStep.h"
|
2
|
+
|
3
|
+
#import "GHLocation.h"
|
4
|
+
#import "GHStepArgument.h"
|
5
|
+
|
6
|
+
@interface GHStep ()
|
7
|
+
|
8
|
+
@property (nonatomic, strong) GHLocation * location;
|
9
|
+
@property (nonatomic, strong) NSString * keyword;
|
10
|
+
@property (nonatomic, strong) NSString * text;
|
11
|
+
@property (nonatomic, strong) GHStepArgument * argument;
|
12
|
+
|
13
|
+
@end
|
14
|
+
|
15
|
+
@implementation GHStep
|
16
|
+
|
17
|
+
@synthesize location;
|
18
|
+
@synthesize keyword;
|
19
|
+
@synthesize text;
|
20
|
+
@synthesize argument;
|
21
|
+
|
22
|
+
- (id)initWithLocation:(GHLocation *)theLocation keyword:(NSString *)theKeyword text:(NSString *)theText stepArgument:(GHStepArgument *)theArgument
|
23
|
+
{
|
24
|
+
if (self = [super init])
|
25
|
+
{
|
26
|
+
location = theLocation;
|
27
|
+
keyword = theKeyword;
|
28
|
+
text = theText;
|
29
|
+
argument = theArgument;
|
30
|
+
}
|
31
|
+
|
32
|
+
return self;
|
33
|
+
}
|
34
|
+
|
35
|
+
@end
|