Skip to content

NSLibraryPath and [NSString $appendPath] #10

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ConciseKit.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Pod::Spec.new do |s|

s.source_files = 'src/**/*.{h,m}'

s.clean_paths = 'ConciseKitSpecs'


s.frameworks = 'Foundation'
end
Expand Down
4 changes: 2 additions & 2 deletions ConciseKitSpecs/Spec/ConciseKitSpec.m
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@
[$ waitUntil:condition timeOut:20.0];
NSArray *array = [CKMocks callsForSelector:@selector(waitUntil:timeOut:interval:) in:[$ class]];
assertThatUnsignedInteger([array count], equalToUnsignedInteger(1));
assertThat([array $at:0], equalTo($arr(condition, $double(20.0), $double(0.1))));
assertThat([array at:0], equalTo($arr(condition, $double(20.0), $double(0.1))));
[$ swizzleClassMethod:@selector(waitUntil:timeOut:interval:) in:[$ class] with:@selector(waitUntil:timeOut:interval:) in:[CKMocks class]];
});
});
Expand All @@ -177,7 +177,7 @@
[$ waitUntil:condition];
NSArray *array = [CKMocks callsForSelector:@selector(waitUntil:timeOut:interval:) in:[$ class]];
assertThatUnsignedInteger([array count], equalToUnsignedInteger(1));
assertThat([array $at:0], equalTo($arr(condition, $double(10.0), $double(0.1))));
assertThat([array at:0], equalTo($arr(condition, $double(10.0), $double(0.1))));
[$ swizzleClassMethod:@selector(waitUntil:timeOut:interval:) in:[$ class] with:@selector(waitUntil:timeOut:interval:) in:[CKMocks class]];
});
});
Expand Down
2 changes: 1 addition & 1 deletion ConciseKitSpecs/Spec/Fixtures/CKMocks.m
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ + (void)addReceivedValues:(NSArray *)values forSelector:(SEL)selector in:(Class)
if([dict objectForKey:key] == nil) {
[dict setObject:$marr(nil) forKey:key];
}
[(NSMutableArray *)[dict objectForKey:key] $push:values];
[(NSMutableArray *)[dict objectForKey:key] push:values];
}

+ (void)resetAll {
Expand Down
46 changes: 23 additions & 23 deletions ConciseKitSpecs/Spec/NSArrayConciseKitSpec.m
Original file line number Diff line number Diff line change
Expand Up @@ -17,26 +17,26 @@

describe(@"-$first", ^{
it(@"returns the first object", ^{
assertThat([array $first], equalTo(@"foo"));
assertThat([array first], equalTo(@"foo"));
});
});

describe(@"-$last", ^{
it(@"returns the first object", ^{
assertThat([array $last], equalTo(@"baz"));
assertThat([array last], equalTo(@"baz"));
});
});

describe(@"-$at:", ^{
it(@"returns the object at the given index", ^{
assertThat([array $at:1], equalTo(@"bar"));
assertThat([array at:1], equalTo(@"bar"));
});
});

describe(@"-$each:", ^{
it(@"runs block for each item, passing the item as an argument", ^{
__block NSInteger i=0;
[$arr($integer(1), $integer(2), $integer(3)) $each:^(id obj) {
[$arr($integer(1), $integer(2), $integer(3)) each:^(id obj) {
i += [obj integerValue];
}];
assertThatInteger(i, equalToInteger(6));
Expand All @@ -46,7 +46,7 @@
describe(@"-$eachWithIndex:", ^{
it(@"runs block for each item, passing the item and its index as arguments", ^{
__block NSInteger i=0;
[$arr($integer(1), $integer(2), $integer(3)) $eachWithIndex:^(id obj, NSUInteger j) {
[$arr($integer(1), $integer(2), $integer(3)) eachWithIndex:^(id obj, NSUInteger j) {
i += [obj integerValue] + j;
}];
assertThatInteger(i, equalToInteger(9));
Expand All @@ -56,7 +56,7 @@
describe(@"-$eachWithStop:", ^{
it(@"runs block for each item, passing the item as an argument, until stop is set to YES", ^{
__block NSInteger i=0;
[$arr($integer(1), $integer(2), $integer(3)) $eachWithStop:^(id obj, BOOL *stop) {
[$arr($integer(1), $integer(2), $integer(3)) eachWithStop:^(id obj, BOOL *stop) {
i += [obj integerValue];
if([obj integerValue] == 2) {
*stop = YES;
Expand All @@ -69,7 +69,7 @@
describe(@"-$eachWithIndexAndStop:", ^{
it(@"runs block for each item, passing the item and its index as arguments, until stop is set to YES", ^{
__block NSInteger i=0;
[$arr($integer(1), $integer(2), $integer(3)) $eachWithIndexAndStop:^(id obj, NSUInteger j, BOOL *stop) {
[$arr($integer(1), $integer(2), $integer(3)) eachWithIndexAndStop:^(id obj, NSUInteger j, BOOL *stop) {
i += [obj integerValue] + j;
if([obj integerValue] == 2) {
*stop = YES;
Expand All @@ -81,7 +81,7 @@

describe(@"-$map:", ^{
it(@"runs block for each item, passing the item as an argument, and creates a new array containing the return values of the block", ^{
array = [$arr($integer(1), $integer(2), $integer(3)) $map:^(id obj) {
array = [$arr($integer(1), $integer(2), $integer(3)) map:^(id obj) {
return (id)$integer([obj integerValue] * 2);
}];
assertThat(array, equalTo($arr($integer(2), $integer(4), $integer(6))));
Expand All @@ -90,7 +90,7 @@

describe(@"-$mapWithIndex:", ^{
it(@"runs block for each item, passing the item and its index as arguments and creates a new array containing the return values of the block", ^{
array = [$arr($integer(1), $integer(2), $integer(3)) $mapWithIndex:^(id obj, NSUInteger j) {
array = [$arr($integer(1), $integer(2), $integer(3)) mapWithIndex:^(id obj, NSUInteger j) {
return (id)$integer([obj integerValue] * 2 + j);
}];
assertThat(array, equalTo($arr($integer(2), $integer(5), $integer(8))));
Expand All @@ -99,7 +99,7 @@

describe(@"-$reduce:", ^{
it(@"runs a block for each item, passing in a memoized value and the item, reassigning the memoized value from the return value of each iteration, finally returning the last return value", ^{
NSNumber *result = [$arr($integer(1), $integer(2), $integer(3), $integer(4)) $reduce:^(NSNumber *memo, NSNumber *obj) {
NSNumber *result = [$arr($integer(1), $integer(2), $integer(3), $integer(4)) reduce:^(NSNumber *memo, NSNumber *obj) {
return $integer([memo integerValue] + [obj integerValue]);
}];
assertThat(result, equalTo($integer(10)));
Expand All @@ -108,7 +108,7 @@

describe(@"-$reduceStartingAt:with:", ^{
it(@"performs a reduce function with a starting value", ^{
NSNumber *result = [$arr($integer(10), $integer(2), $integer(3)) $reduceStartingAt:$integer(1) with:^(NSNumber *memo, NSNumber *obj) {
NSNumber *result = [$arr($integer(10), $integer(2), $integer(3)) reduceStartingAt:$integer(1) with:^(NSNumber *memo, NSNumber *obj) {
return $integer([memo integerValue] * [obj integerValue]);
}];
assertThat(result, equalTo($integer(60)));
Expand All @@ -117,7 +117,7 @@

describe(@"-$select:", ^{
it(@"creates a subarray from elements where the block returns YES", ^{
array = [$arr($integer(1), $integer(2), $integer(3), $integer(4)) $select:^BOOL(NSNumber *obj) {
array = [$arr($integer(1), $integer(2), $integer(3), $integer(4)) select:^BOOL(NSNumber *obj) {
return ([obj integerValue] % 2) == 0;
}];
assertThat(array, equalTo($arr($integer(2), $integer(4))));
Expand All @@ -126,7 +126,7 @@

describe(@"-$detect:", ^{
it(@"returns the first value for which the block returns YES", ^{
NSNumber *result = [$arr($integer(1), $integer(2), $integer(3)) $detect:^BOOL(NSNumber *obj) {
NSNumber *result = [$arr($integer(1), $integer(2), $integer(3)) detect:^BOOL(NSNumber *obj) {
return ([obj integerValue] % 2) == 1;
}];
assertThat(result, equalTo($integer(1)));
Expand All @@ -135,13 +135,13 @@

describe(@"-$join", ^{
it(@"joins the strings in the array without a separator, (more concise than componentsJoinedByString)", ^{
assertThat([$arr(@"a", @"b", @"c") $join], equalTo(@"abc"));
assertThat([$arr(@"a", @"b", @"c") join], equalTo(@"abc"));
});
});

describe(@"-$join:", ^{
it(@"joins the strings in the array with the supplied separator, (more concise than componentsJoinedByString)", ^{
assertThat([$arr(@"a", @"b", @"c") $join:@"-"], equalTo(@"a-b-c"));
assertThat([$arr(@"a", @"b", @"c") join:@"-"], equalTo(@"a-b-c"));
});
});
});
Expand Down Expand Up @@ -173,45 +173,45 @@

describe(@"-$push:", ^{
it(@"adds an object", ^{
[marray $push:@"obj"];
[marray push:@"obj"];
assertThat([marray lastObject], equalTo(@"obj"));
});

it(@"returns self", ^{
assertThat([marray $push:@"obj"], equalTo(marray));
assertThat([marray push:@"obj"], equalTo(marray));
});
});

describe(@"-$pop", ^{
it(@"removes last object", ^{
[marray $pop];
[marray pop];
assertThat([marray lastObject], equalTo(@"bar"));
});

it(@"returns last object", ^{
assertThat([marray $pop], equalTo(@"baz"));
assertThat([marray pop], equalTo(@"baz"));
});
});

describe(@"-$unshift:", ^{
it(@"adds first object", ^{
[marray $unshift:@"obj"];
[marray unshift:@"obj"];
assertThat([marray objectAtIndex:0], equalTo(@"obj"));
});

it(@"returns self", ^{
assertThat([marray $unshift:@"obj"], equalTo(marray));
assertThat([marray unshift:@"obj"], equalTo(marray));
});
});

describe(@"-$shift", ^{
it(@"removes first object", ^{
[marray $shift];
[marray shift];
assertThat([marray objectAtIndex:0], equalTo(@"bar"));
});

it(@"returns first object", ^{
assertThat([marray $shift], equalTo(@"foo"));
assertThat([marray shift], equalTo(@"foo"));
});
});
});
Expand Down
36 changes: 18 additions & 18 deletions ConciseKitSpecs/Spec/NSDictionaryConciseKitSpec.m
Original file line number Diff line number Diff line change
Expand Up @@ -19,64 +19,64 @@

describe(@"-$for:", ^{
it(@"returns the object for the given key", ^{
assertThat([dict $for:@"foo"], equalTo(@"bar"));
assertThat([dict for:@"foo"], equalTo(@"bar"));
});
});

describe(@"-$keys:", ^{
it(@"returns the keys for the dict", ^{
assertThat([[dict $keys] $join], equalTo(@"foohello"));
assertThat([[dict keys] join], equalTo(@"foohello"));
});
});

describe(@"-$values:", ^{
it(@"returns the values for the dict", ^{
assertThat([[dict $values] $join], equalTo(@"barworld"));
assertThat([[dict values] join], equalTo(@"barworld"));
});
});

describe(@"-$each:", ^{
it(@"runs block for each key value pair, passing the key and value as arguments", ^{
NSMutableArray *result = $marrnew;
[dict $each:^(id key, id value) {
[result $push:[key $append:value]];
[dict each:^(id key, id value) {
[result push:[key append:value]];
}];
assertThat([result $first], equalTo(@"foobar"));
assertThat([result $last], equalTo(@"helloworld"));
assertThat([result first], equalTo(@"foobar"));
assertThat([result last], equalTo(@"helloworld"));
});
});

describe(@"-$eachWithStop:", ^{
it(@"runs block for each key value pair, passing the key and value as an argument, until stop is set to YES", ^{
NSMutableArray *result = $marrnew;
[dict $eachWithStop:^(id key, id value, BOOL *stop) {
[result $push:[key $append:value]];
[dict eachWithStop:^(id key, id value, BOOL *stop) {
[result push:[key append:value]];
if($eql(key, @"foo")) {
*stop = YES;
}
}];
assertThatInteger([result count], equalToInteger(1));
assertThat([result $last], equalTo(@"foobar"));
assertThat([result last], equalTo(@"foobar"));
});
});

describe(@"-$eachKey:", ^{
it(@"runs block for each key, passing the key as an argument", ^{
NSMutableArray *result = $marrnew;
[dict $eachKey:^(id key) {
[result $push:key];
[dict eachKey:^(id key) {
[result push:key];
}];
assertThat([result $join], equalTo(@"foohello"));
assertThat([result join], equalTo(@"foohello"));
});
});

describe(@"-$eachValue:", ^{
it(@"runs block for each value, passing the value as an argument", ^{
NSMutableArray *result = $marrnew;
[dict $eachValue:^(id value) {
[result $push:value];
[dict eachValue:^(id value) {
[result push:value];
}];
assertThat([result $join], equalTo(@"barworld"));
assertThat([result join], equalTo(@"barworld"));
});
});
});
Expand Down Expand Up @@ -110,12 +110,12 @@

describe(@"-$obj:for:", ^{
it(@"sets an object for a key", ^{
[mdict $obj:@"qux" for:@"baz"];
[mdict obj:@"qux" for:@"baz"];
assertThat([mdict objectForKey:@"baz"], equalTo(@"qux"));
});

it(@"returns self", ^{
assertThat([mdict $obj:@"qux" for:@"baz"], equalTo(mdict));
assertThat([mdict obj:@"qux" for:@"baz"], equalTo(mdict));
});
});
});
Expand Down
16 changes: 8 additions & 8 deletions ConciseKitSpecs/Spec/NSStringConciseKitSpec.m
Original file line number Diff line number Diff line change
Expand Up @@ -17,25 +17,25 @@

describe(@"-$append", ^{
it(@"appends another string", ^{
assertThat([string $append:@"bar"], equalTo(@"foobar"));
assertThat([string append:@"bar"], equalTo(@"foobar"));
});
});

describe(@"-$prepend", ^{
it(@"prepends another string", ^{
assertThat([string $prepend:@"bar"], equalTo(@"barfoo"));
assertThat([string prepend:@"bar"], equalTo(@"barfoo"));
});
});

describe(@"-$split:", ^{
it(@"divides string into an array of strings by a given string", ^{
assertThat([@"f,o,o" $split:@","], equalTo($arr(@"f",@"o",@"o")));
assertThat([@"f,o,o" split:@","], equalTo($arr(@"f",@"o",@"o")));
});
});

describe(@"-$split", ^{
it(@"divides string into an array of strings using whitespace", ^{
assertThat([@"ab cd ef" $split], equalTo($arr(@"ab",@"cd",@"ef")));
assertThat([@"ab cd ef" split], equalTo($arr(@"ab",@"cd",@"ef")));
});
});
});
Expand Down Expand Up @@ -67,27 +67,27 @@

describe(@"-$append_", ^{
it(@"appends another string and returns self", ^{
assertThat([mstring $append_:@"bar"], equalTo(@"foobar"));
assertThat([mstring append_:@"bar"], equalTo(@"foobar"));
});
});

describe(@"-$prepend_", ^{
it(@"prepends another string and returns self", ^{
assertThat([mstring $prepend_:@"bar"], equalTo(@"barfoo"));
assertThat([mstring prepend_:@"bar"], equalTo(@"barfoo"));
assertThat(mstring, equalTo(@"barfoo"));
});
});

describe(@"-$insert:at:", ^{
it(@"inserts a string at given position and returns self", ^{
assertThat([mstring $insert:@"bar" at:1], equalTo(@"fbaroo"));
assertThat([mstring insert:@"bar" at:1], equalTo(@"fbaroo"));
assertThat(mstring, equalTo(@"fbaroo"));
});
});

describe(@"-$set:", ^{
it(@"sets the mutable string to be given string", ^{
assertThat([mstring $set:@"bar"], equalTo(@"bar"));
assertThat([mstring set:@"bar"], equalTo(@"bar"));
assertThat(mstring, equalTo(@"bar"));
});
});
Expand Down
Loading