Skip to content
This repository was archived by the owner on Jan 18, 2022. It is now read-only.

Commit

Permalink
Merge pull request #96 from erichoracek/xcode-9-1
Browse files Browse the repository at this point in the history
Update to Xcode 9.1
  • Loading branch information
erichoracek authored Nov 30, 2017
2 parents 78fe7bf + a8811eb commit da184bd
Show file tree
Hide file tree
Showing 78 changed files with 351 additions and 1,702 deletions.
15 changes: 3 additions & 12 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,6 @@
language: objective-c

osx_image: xcode8

# CocoaPods requires ruby 2.0 and above
rvm: 2.0.0

env:
global: LANG=en_US.UTF-8

osx_image: xcode9.1
install:
- bundle install --jobs=3

- bundle install
script:
- rake ci
- rake ci
1 change: 1 addition & 0 deletions Cartfile.private
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ github "jspahrsummers/xcconfigs" ~> 0.9.0
github "specta/specta" ~> 1.0
github "specta/expecta" ~> 1.0
github "yaml/libyaml" == 0.1.4
github "tomaz/GBCli" ~> 1.2.1
5 changes: 3 additions & 2 deletions Cartfile.resolved
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
github "jspahrsummers/xcconfigs" "0.9"
github "specta/expecta" "v1.0.5"
github "specta/specta" "v1.0.6"
github "specta/expecta" "v1.0.6"
github "specta/specta" "v1.0.7"
github "tomaz/GBCli" "1.2.1"
github "yaml/libyaml" "0.1.4"
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
static NSString * const GBCommandLineRequirementKey = @"requirement";
static NSString * const GBCommandLineOptionGroupKey = @"group"; // this is returned while parsing to indicate an option group was detected.
static NSString * const GBCommandLineNotAnOptionKey = @"not-an-option"; // this is returned while parsing to indicate an argument was detected.
static NSString * const GBCommandLineEndOfOptionsKey = @"end-of-options"; // this is returned while parsing to indicate an "end-of-options" option is detected.

#pragma mark -

Expand Down Expand Up @@ -141,7 +142,7 @@ - (GBCommandLineParseBlock)simplifiedOptionsParserBlock {
gbfprintln(stderr, @"Unknown command line option %@, try --help!", argument);
break;
case GBParseFlagMissingValue:
gbfprintln(stderr, @"Missing value for command line option %s, try --help!", argument);
gbfprintln(stderr, @"Missing value for command line option %@, try --help!", argument);
break;
case GBParseFlagWrongGroup:
gbfprintln(stderr, @"Invalid option %@ for group %@!", argument, self.currentOptionsGroupName);
Expand Down Expand Up @@ -196,28 +197,42 @@ - (BOOL)parseOptionsWithArguments:(NSArray *)arguments commandLine:(NSString *)c
id value = nil;
NSString *input = [arguments objectAtIndex:index];
NSDictionary *data = [self optionDataForOption:input value:&value];
if (data == (id)GBCommandLineNotAnOptionKey) break; // no more options, only arguments left...
if (data == (id)GBCommandLineEndOfOptionsKey) {
// End of options detected. Skip this one and end option parsing.
index++;
break;
}
if (data == (id)GBCommandLineOptionGroupKey) {
// If this is group name, continue with next option...
handler(GBParseFlagOption, input, @YES, &stop);
if (stop) break;
index++;
continue;
} else if (data == (id)GBCommandLineNotAnOptionKey) {
// If this is a non-option argument, notify observer.
[self.parsedArguments addObject:input];
handler(GBParseFlagArgument, nil, input, &stop);
if (stop) break;
index++;
continue;
}

NSString *name = data[GBCommandLineLongOptionKey];
NSString *name = nil;
GBParseFlags flags = GBParseFlagOption;

if (data == nil) {
// If no registered option matches given one, notify observer.
name = input;
flags = GBParseFlagUnknownOption;
result = NO;
} else if (self.currentOptionsGroupOptions && ![self.currentOptionsGroupOptions containsObject:name]) {
} else if (self.currentOptionsGroupOptions && ![self.currentOptionsGroupOptions containsObject:data[GBCommandLineLongOptionKey]]) {
// If name of the option is not registered for the current group, notify observer.
name = input;
flags = GBParseFlagWrongGroup;
result = NO;
} else {
name = data[GBCommandLineLongOptionKey];

// Prepare the value or notify about problem with it.
GBValueRequirements requirement = [data[GBCommandLineRequirementKey] unsignedIntegerValue];
switch (requirement) {
Expand All @@ -228,13 +243,19 @@ - (BOOL)parseOptionsWithArguments:(NSArray *)arguments commandLine:(NSString *)c
value = [arguments objectAtIndex:index + 1];
if ([self isShortOrLongOptionName:value]) {
flags = GBParseFlagMissingValue;
result = NO;
stop = YES;
} else if ([self isOptionGroupName:value]) {
flags = GBParseFlagMissingValue;
result = NO;
stop = YES;
} else {
index++;
}
} else {
flags = GBParseFlagMissingValue;
result = NO;
stop = YES;
}
}
break;
Expand Down Expand Up @@ -281,12 +302,12 @@ - (BOOL)parseOptionsWithArguments:(NSArray *)arguments commandLine:(NSString *)c
if (stop) return NO;

// Remember parsed option and continue with next one.
if (value) [self.parsedOptions setObject:value forKey:name];
if (name && value) [self.parsedOptions setObject:value forKey:name];
index++;
}

// Prepare arguments (arguments are command line options after options).
while (index < arguments.count) {
while (!stop && index < arguments.count) {
NSString *input = [arguments objectAtIndex:index];
[self.parsedArguments addObject:input];
handler(GBParseFlagArgument, nil, input, &stop);
Expand All @@ -305,9 +326,11 @@ - (NSDictionary *)optionDataForOption:(NSString *)shortOrLongName value:(NSStrin

// Extract the option name.
if ([shortOrLongName hasPrefix:@"--"]) {
if (shortOrLongName.length == 2) return (id)GBCommandLineEndOfOptionsKey;
name = [shortOrLongName substringFromIndex:2];
options = self.registeredOptionsByLongNames;
} else if ([shortOrLongName hasPrefix:@"-"]) {
if (shortOrLongName.length == 1) return (id)GBCommandLineEndOfOptionsKey;
name = [shortOrLongName substringFromIndex:1];
options = self.registeredOptionsByShortNames;
} else if ([self isOptionGroupName:shortOrLongName]) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ - (void)replacePlaceholdersAndPrintStringFromBlock:(GBOptionStringBlock)block {
return;
}
NSString *string = block();
if (self.applicationBuildFromBlockOrNil)
if (self.applicationNameFromBlockOrDefault)
string = [string stringByReplacingOccurrencesOfString:@"%APPNAME" withString:self.applicationNameFromBlockOrDefault];
if (self.applicationVersionFromBlockOrNil)
string = [string stringByReplacingOccurrencesOfString:@"%APPVERSION" withString:self.applicationVersionFromBlockOrNil];
Expand Down
5 changes: 3 additions & 2 deletions Carthage/Checkouts/expecta/Expecta.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,11 @@ Pod::Spec.new do |s|
s.source_files = 'Expecta/**/*.{h,m}'

s.requires_arc = false
s.ios.deployment_target = '5.1.1'
s.osx.deployment_target = '10.7'
s.ios.deployment_target = '6.0'
s.osx.deployment_target = '10.8'
s.tvos.deployment_target = '9.0'

s.frameworks = 'Foundation', 'XCTest'
s.pod_target_xcconfig = { 'ENABLE_BITCODE' => 'NO' }
s.user_target_xcconfig = { 'FRAMEWORK_SEARCH_PATHS' => '$(PLATFORM_DIR)/Developer/Library/Frameworks' }
end
8 changes: 4 additions & 4 deletions Carthage/Checkouts/expecta/Expecta/EXPDefines.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
#ifndef Expecta_EXPDefines_h
#define Expecta_EXPDefines_h

typedef void (^EXPBasicBlock)();
typedef id (^EXPIdBlock)();
typedef BOOL (^EXPBoolBlock)();
typedef NSString *(^EXPStringBlock)();
typedef void (^EXPBasicBlock)(void);
typedef id (^EXPIdBlock)(void);
typedef BOOL (^EXPBoolBlock)(void);
typedef NSString *(^EXPStringBlock)(void);

#endif
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,16 @@
EXPMatcherImplementationBegin(respondTo, (SEL expected)) {
BOOL actualIsNil = (actual == nil);
BOOL expectedIsNull = (expected == NULL);

prerequisite (^BOOL {
return !(actualIsNil || expectedIsNull);
});

match(^BOOL {
if ([actual respondsToSelector:@selector(instancesRespondToSelector:)] &&
[actual instancesRespondToSelector:expected]) {
return YES;
}
return [actual respondsToSelector:expected];
});

Expand Down
140 changes: 72 additions & 68 deletions Carthage/Checkouts/expecta/README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
#Expecta

[![Build Status](http://img.shields.io/travis/specta/expecta/master.svg?style=flat)](https://travis-ci.org/specta/expecta)
[![Pod Version](http://img.shields.io/cocoapods/v/Expecta.svg?style=flat)](http://cocoadocs.org/docsets/Expecta/)
[![Pod Platform](http://img.shields.io/cocoapods/p/Expecta.svg?style=flat)](http://cocoadocs.org/docsets/Expecta/)
[![Pod License](http://img.shields.io/cocoapods/l/Expecta.svg?style=flat)](https://www.apache.org/licenses/LICENSE-2.0.html)
# Expecta [![Build Status](http://img.shields.io/travis/specta/expecta/master.svg?style=flat)](https://travis-ci.org/specta/expecta) [![Pod Version](http://img.shields.io/cocoapods/v/Expecta.svg?style=flat)](http://cocoadocs.org/docsets/Expecta/)

A matcher framework for Objective-C and Cocoa.

## Introduction
## FEATURES

The main advantage of using Expecta over other matcher frameworks is that you do not have to specify the data types. Also, the syntax of Expecta matchers is much more readable and does not suffer from parenthesitis.

Expand All @@ -18,63 +13,10 @@ expect([bar isBar]).to.equal(YES);
expect(baz).to.equal(3.14159);
```
Expecta is framework-agnostic: it works well with XCTest and XCTest-compatible test frameworks such as [Specta](http://github.com/petejkim/specta/).
## Installation
You can setup Expecta using [Carthage](https://github.com/Carthage/Carthage), [CocoaPods](http://github.com/CocoaPods/CocoaPods) or [completely manually](#setting-up-manually).
### Carthage
1. Add Expecta to your project's `Cartfile.private`:
```ruby
github "specta/expecta" "master"
```
2. Run `carthage update` in your project directory.
3. Drag the appropriate **Expecta.framework** for your platform (located in `Carthage/Build/`) into your application’s Xcode project, and add it to your test target(s).
### CocoaPods
1. Add Expecta to your project's `Podfile`:
```ruby
target :MyApp do
# Your app's dependencies
end
target :MyAppTests do
pod 'Expecta', '~> 1.0.0'
end
```
2. Run `pod update` or `pod install` in your project directory.
### Setting Up Manually
1. Clone Expecta from Github.
2. Run `rake` in your project directory to build the frameworks and libraries.
3. Add a Cocoa or Cocoa Touch Unit Testing Bundle target to your Xcode project if you don't already have one.
4. For **OS X projects**, copy and add `Expecta.framework` in the `Products/osx` folder to your project's test target.
For **iOS projects**, copy and add `Expecta.framework` in the `Products/ios` folder to your project's test target.
You can also use `libExpecta.a` if you prefer to link Expecta as a static library — iOS 7.x and below require this.
Expecta is framework-agnostic: it works well with XCTest and XCTest-compatible test frameworks such as [Specta](http://github.com/petejkim/specta/), or [Kiwi](https://github.com/kiwi-bdd/Kiwi/).
6. Add `-ObjC` and `-all_load` to the **Other Linker Flags** build setting for the test target in your Xcode project.
7. You can now use Expecta in your test classes by adding the following import:
```objective-c
@import Expecta; // If you're using Expecta.framework
// OR
#import <Expecta/Expecta.h> // If you're using the static library, or the framework
```
## Built-in Matchers
## MATCHERS
> `expect(x).to.equal(y);` compares objects or primitives x and y and passes if they are identical (==) or equivalent isEqual:).
Expand Down Expand Up @@ -132,13 +74,13 @@ You can setup Expecta using [Carthage](https://github.com/Carthage/Carthage), [C
> `expect(x).to.match(y);` passes if an instance of NSString `x` matches regular expression (given as NSString) `y` one or more times.
## Inverting Matchers
### Inverting Matchers
Every matcher's criteria can be inverted by prepending `.notTo` or `.toNot`:
>`expect(x).notTo.equal(y);` compares objects or primitives x and y and passes if they are *not* equivalent.
## Asynchronous Testing
### Asynchronous Testing
Every matcher can be made to perform asynchronous testing by prepending `.will`, `.willNot` or `after(...)`:
Expand Down Expand Up @@ -172,14 +114,14 @@ describe(@"Foo", ^{
});
```

## Forced Failing
### Forced Failing

You can fail a test by using the `failure` attribute. This can be used to test branching.

> `failure(@"This should not happen");` outright fails a test.

## Writing New Matchers
### WRITING NEW MATCHERS

Writing a new matcher is easy with special macros provided by Expecta. Take a look at how `.beKindOf()` matcher is defined:

Expand Down Expand Up @@ -246,7 +188,7 @@ EXPMatcherImplementationBegin(beKindOf, (Class expected)) {
EXPMatcherImplementationEnd
```

## Dynamic Predicate Matchers
## DYNAMIC PREDICATE MATCHERS

It is possible to add predicate matchers by simply defining the matcher interface, with the matcher implementation being handled at runtime by delegating to the predicate method on your object.

Expand Down Expand Up @@ -282,6 +224,68 @@ You can now write your assertion as follows:
expect(lightSwitch).isTurnedOn();
```
## INSTALLATION
You can setup Expecta using [CocoaPods](http://github.com/CocoaPods/CocoaPods), [Carthage](https://github.com/Carthage/Carthage) or [completely manually](#setting-up-manually).
### CocoaPods
1. Add Expecta to your project's `Podfile`:
```ruby
target :MyApp do
# your app dependencies
target :MyAppTests do
inherit! search_paths
pod 'Expecta', '~> 1.0'
end
end
```

### Carthage

1. Add Expecta to your project's `Cartfile.private`:

```ruby
github "specta/expecta" "master"
```

2. Run `carthage update` in your project directory.
3. Drag the appropriate **Expecta.framework** for your platform (located in `Carthage/Build/`) into your application’s Xcode project, and add it to your test target(s).


2. Run `pod update` or `pod install` in your project directory.

### Setting Up Manually

1. Clone Expecta from Github.
2. Run `rake` in your project directory to build the frameworks and libraries.
3. Add a Cocoa or Cocoa Touch Unit Testing Bundle target to your Xcode project if you don't already have one.
4. For **OS X projects**, copy and add `Expecta.framework` in the `Products/osx` folder to your project's test target.

For **iOS projects**, copy and add `Expecta.framework` in the `Products/ios` folder to your project's test target.

You can also use `libExpecta.a` if you prefer to link Expecta as a static library — iOS 7.x and below require this.

6. Add `-ObjC` and `-all_load` to the **Other Linker Flags** build setting for the test target in your Xcode project.
7. You can now use Expecta in your test classes by adding the following import:

```objective-c
@import Expecta; // If you're using Expecta.framework

// OR

#import <Expecta/Expecta.h> // If you're using the static library, or the framework
```

## STATUS

Expecta, and Specta are considered done projects, there are no plans for _active_ development on the project at the moment aside from ensuring future Xcode compatability.
Therefore it is a stable dependency, but will not be moving into the Swift world. If you are looking for that, we recommend you consider [Quick](https://github.com/quick/quick) and [Nimble](https://github.com/quick/nimble).


## Contribution Guidelines

* Please use only spaces and indent 2 spaces at a time.
Expand All @@ -290,4 +294,4 @@ expect(lightSwitch).isTurnedOn();

## License

Copyright (c) 2012-2015 [Specta Team](https://github.com/specta?tab=members). This software is licensed under the [MIT License](http://github.com/specta/specta/raw/master/LICENSE).
Copyright (c) 2012-2016 [Specta Team](https://github.com/specta?tab=members). This software is licensed under the [MIT License](http://github.com/specta/specta/raw/master/LICENSE).
Loading

0 comments on commit da184bd

Please sign in to comment.