Commit b4b56c80 by Brent Gulanowski

Add tests for Cocoa Additions categories.

parent 29128147
//
// BUYModelArrayAdditionsTests.m
// Mobile Buy SDK
//
// Created by Shopify.
// Copyright (c) 2015 Shopify Inc. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
//
#import <XCTest/XCTest.h>
#import "NSArray+BUYAdditions.h"
@interface BUYArrayAdditionsTests : XCTestCase
@end
@implementation BUYArrayAdditionsTests
- (void)testNilMap {
NSArray *empty = @[];
XCTAssertEqualObjects([empty buy_map:nil], empty, @"buy_map failed");
NSArray *array = @[@1, @2];
XCTAssertEqualObjects([array buy_map:nil], empty, @"buy_map failed");
}
- (void)testMap {
NSArray *expected = @[@2, @4, @6];
NSArray *actual = [@[@1, @2, @3] buy_map:^id(NSNumber *number) {
return @([number unsignedIntegerValue] * 2);
}];
XCTAssertEqualObjects(actual, expected, @"map count was incorrect");
}
- (void)testReverse {
NSArray *expected = @[@3, @2, @1];
NSArray *actual = [@[@1, @2, @3] buy_reversedArray];
XCTAssertEqualObjects(actual, expected, @"reversed array was incorrect");
}
- (void)testMutableReverse {
NSArray *array = @[@1, @2, @3];
NSArray *expected = @[@3, @2, @1];
NSMutableArray *actual = [array mutableCopy];
[actual buy_reverse];
XCTAssertEqualObjects(actual, expected, @"reversed array was incorrect");
}
- (void)testTail {
NSArray *array = @[];
NSArray *expected = @[];
XCTAssertEqualObjects(array.buy_tail, expected, @"tail array incorrect");
array = @[@1, @2, @3];
expected = @[@2, @3];
XCTAssertEqualObjects(array.buy_tail, expected, @"tail array incorrect");
}
- (void)testNSObjectToArray {
id value = @"hello";
id expected = @[@"hello"];
id actual = [value buy_array];
XCTAssertEqualObjects(actual, expected, @"array form incorrect");
expected = value;
actual = [NSObject buy_convertArray:@[value]];
XCTAssertEqualObjects(actual, expected, @"unwrapped array was incorrect");
}
- (void)testNSArrayToArray {
id value = @[@1, @2];
id expected = @[@1, @2];
id actual = [value buy_array];
XCTAssertEqualObjects(actual, expected, @"array form incorrect");
expected = value;
actual = [NSArray buy_convertArray:@[@1, @2]];
XCTAssertEqualObjects(actual, expected, @"unwrapped array was incorrect");
}
- (void)testNSSetToArray {
id value = [NSSet setWithArray:@[@1, @2]];
id expected = @[@1, @2];
id actual = [value buy_array];
XCTAssertEqualObjects(actual, expected, @"array form incorrect");
expected = value;
actual = [NSSet buy_convertArray:@[@1, @2]];
XCTAssertEqualObjects(actual, expected, @"unwrapped array was incorrect");
}
- (void)testNSOrderedSetToArray {
id value = [NSOrderedSet orderedSetWithArray:@[@1, @2]];
id expected = @[@1, @2];
id actual = [value buy_array];
XCTAssertEqualObjects(actual, expected, @"array form incorrect");
expected = value;
actual = [NSOrderedSet buy_convertArray:@[@1, @2]];
XCTAssertEqualObjects(actual, expected, @"unwrapped array was incorrect");
}
@end
//
// BUYModelDictionaryAdditionsTests.m
// Mobile Buy SDK
//
// Created by Shopify.
// Copyright (c) 2015 Shopify Inc. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
//
#import <XCTest/XCTest.h>
#import "NSDictionary+BUYAdditions.h"
@interface BUYDictionaryAdditionsTests : XCTestCase
@end
@implementation BUYDictionaryAdditionsTests
- (NSDictionary *)englishToFrench
{
return @{
@"one": @"un",
@"two": @"deux",
@"three": @"trois",
@"four": @"quatre",
};
}
- (NSDictionary *)stringsToNumbers
{
return @{
@"one": @1,
@"two": @2,
@"three": @3,
@"four": @4,
@"five": @5,
};
}
- (void)testReverseDictionary {
NSDictionary *expected = @{
@"un": @"one",
@"deux": @"two",
@"trois": @"three",
@"quatre": @"four",
};
XCTAssertEqualObjects([self englishToFrench].buy_reverseDictionary, expected, @"reverse dictionary was incorrect");
}
- (void)testKeyMapping
{
NSDictionary *JSON = [self stringsToNumbers];
NSDictionary *expected = @{
@"un": @1,
@"deux": @2,
@"trois": @3,
@"quatre": @4,
@"five":@5
};
NSDictionary *mapping = [self englishToFrench];
NSDictionary *actual = [JSON buy_dictionaryByMappingKeysWithBlock:^(NSString *key) {
return mapping[key];
}];
XCTAssertEqualObjects(actual, expected, @"converted dictionary was incorrect");
}
- (void)testValueMapping
{
NSDictionary *JSON = [[self englishToFrench] buy_reverseDictionary];
NSDictionary *mapping = [self stringsToNumbers];
NSDictionary *expected = @{
@"un": @1,
@"deux": @2,
@"trois": @3,
@"quatre": @4,
};
NSDictionary *actual = [JSON buy_dictionaryByMappingValuesWithBlock:^(id value) {
return mapping[value];
}];
XCTAssertEqualObjects(actual, expected, @"converted dictionary was incorrect");
}
@end
//
// BUYExceptionAdditionsTests.m
// Mobile Buy SDK
//
// Created by Shopify.
// Copyright (c) 2015 Shopify Inc. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
//
#import <XCTest/XCTest.h>
#import "NSException+BUYAdditions.h"
@interface BUYExceptionAdditionsTests : XCTestCase
@end
@implementation BUYExceptionAdditionsTests
- (void)abstractMethod
{
@throw BUYAbstractMethod();
}
- (void)testAbstractMethodException
{
@try {
[self abstractMethod];
XCTFail();
}
@catch (NSException *exception) {
XCTAssertNotNil(exception);
}
}
@end
//
// BUYModelRegularExpressionAdditionTests.m
// Mobile Buy SDK
//
// Created by Shopify.
// Copyright (c) 2015 Shopify Inc. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
//
#import <XCTest/XCTest.h>
#import "NSRegularExpression+BUYAdditions.h"
@interface BUYRegularExpressionAdditionsTests : XCTestCase
@end
@implementation BUYRegularExpressionAdditionsTests
- (void)testMatchesInEmptyString {
NSArray *expected = @[];
NSRegularExpression *regex = [NSRegularExpression regularExpressionWithPattern:@"hello" options:0 error:NULL];
NSArray *actual = [regex buy_matchesInString:@""];
XCTAssertEqualObjects(actual, expected, @"matches array was incorrect");
}
- (void)testSingleMatch {
NSRegularExpression *regex = [NSRegularExpression regularExpressionWithPattern:@"hello" options:0 error:NULL];
NSArray *matches = [regex buy_matchesInString:@"_hello_"];
XCTAssertEqual(matches.count, (NSUInteger)1, @"number of matches incorrect");
NSRange expected = NSMakeRange(1, 5);
NSRange actual = [matches.firstObject range];
XCTAssertEqual(actual.location, expected.location, @"location of match was incorrect");
XCTAssertEqual(actual.length, expected.length, @"length of match was incorrect");
}
- (void)testMultipleMatches {
NSRegularExpression *regex = [NSRegularExpression regularExpressionWithPattern:@"hello" options:0 error:NULL];
NSArray *matches = [regex buy_matchesInString:@"_hello_hello___hellhello234234"];
XCTAssertEqual(matches.count, (NSUInteger)3, @"number of matches incorrect");
NSRange expected[3] = {NSMakeRange(1, 5), NSMakeRange(7, 5), NSMakeRange(19, 5)};
for (NSUInteger i = 0; i < 3; ++i) {
NSRange actual = [matches[i] range];
XCTAssertTrue(NSEqualRanges(actual, expected[i]), @"ranges did not match");
}
}
- (void)testFirstMatch {
NSRegularExpression *regex = [NSRegularExpression regularExpressionWithPattern:@"hello" options:0 error:NULL];
NSTextCheckingResult *match = [regex buy_firstMatchInString:@"hello_hello"];
NSRange expected = NSMakeRange(0, 5);
NSRange actual = [match range];
XCTAssertTrue(NSEqualRanges(actual, expected), @"ranges did not match");
}
@end
//
// BUYModelStringAdditionsTests.m
// Mobile Buy SDK
//
// Created by Shopify.
// Copyright (c) 2015 Shopify Inc. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
//
#import <XCTest/XCTest.h>
#import "NSString+BUYAdditions.h"
@interface BUYStringAdditionsTests : XCTestCase
@end
static NSString * const lettersAndNumbers = @"abcdefghijklmnopqrstuvwxyz1234567890";
static NSString * const testMatchingString = @"stringstrongstingstringring";
static NSString * const matchPattern = @"str?\\w?ng";
static NSString * const camelCaseString = @"camelCaseString";
static NSString * const camelCaseSTRING = @"camelCaseSTRING";
static NSString * const camelCASEString = @"camelCASEString";
static NSString * const CAMELCaseString = @"CAMELCaseString";
@implementation BUYStringAdditionsTests {
NSArray *_oldAcronyms;
}
- (void)setUp
{
[super setUp];
_oldAcronyms = [NSString buy_acronymStrings];
}
- (void)tearDown
{
[super tearDown];
[NSString buy_setAcronymStrings:_oldAcronyms];
_oldAcronyms = nil;
}
- (void)testReversedString {
NSString *expected = @"0987654321zyxwvutsrqponmlkjihgfedcba";
NSString *actual = [lettersAndNumbers buy_reversedString];
XCTAssertEqualObjects(actual, expected, @"reversed string was incorrect");
}
- (void)testMatchesForRegularExpression {
NSArray *expected = @[@"string", @"strong", @"sting", @"string"];
NSRegularExpression *regex = [NSRegularExpression regularExpressionWithPattern:matchPattern options:0 error:NULL];
NSArray *actual = [testMatchingString buy_matchesForRegularExpression:regex];
XCTAssertEqualObjects(actual, expected, @"patterns did not match");
}
- (void)testFirstMatchForRegularExpression {
NSString *expected = @"string";
NSRegularExpression *regex = [NSRegularExpression regularExpressionWithPattern:matchPattern options:0 error:NULL];
NSString *actual = [testMatchingString buy_firstMatchForRegularExpression:regex];
XCTAssertEqualObjects(actual, expected, @"patterns did not match");
}
- (void)testMatchesForPattern {
NSArray *expected = @[@"string", @"strong", @"sting", @"string"];
NSArray *actual = [testMatchingString buy_matchesForPattern:matchPattern];
XCTAssertEqualObjects(actual, expected, @"patterns did not match");
}
- (void)testFirstMatchForPattern {
NSString *expected = @"string";
NSString *actual = [testMatchingString buy_firstMatchForPattern:matchPattern];
XCTAssertEqualObjects(actual, expected, @"patterns did not match");
}
- (void)testCamelCaseTokens {
NSArray *expected = @[@"camel", @"Case", @"String"];
NSArray *actual = [camelCaseString buy_camelCaseTokens];
XCTAssertEqualObjects(actual, expected, @"tokens were incorrect");
}
- (void)testCamelCaseALLCAPSTokens {
NSArray *expected = @[@"camel", @"Case", @"STRING"];
NSArray *actual = [camelCaseSTRING buy_camelCaseTokens];
XCTAssertEqualObjects(actual, expected, @"tokens were incorrect");
expected = @[@"camel", @"CASE", @"String"];
actual = [camelCASEString buy_camelCaseTokens];
XCTAssertEqualObjects(actual, expected, @"tokens were incorrect");
expected = @[@"CAMEL", @"Case", @"String"];
actual = [CAMELCaseString buy_camelCaseTokens];
XCTAssertEqualObjects(actual, expected, @"tokens were incorrect");
}
- (void)testSnakeCaseString {
NSString *expected = @"camel_case_string";
NSString *actual = [camelCaseString buy_snakeCaseString];
XCTAssertEqualObjects(actual, expected, @"snake case string was incorrect");
actual = [camelCaseSTRING buy_snakeCaseString];
XCTAssertEqualObjects(actual, expected, @"snake case string was incorrect");
actual = [camelCASEString buy_snakeCaseString];
XCTAssertEqualObjects(actual, expected, @"snake case string was incorrect");
actual = [CAMELCaseString buy_snakeCaseString];
XCTAssertEqualObjects(actual, expected, @"snake case string was incorrect");
}
- (void)testCamelCaseString {
NSString *expected = @"snakeCaseString";
NSString *actual = [@"snake_case_string" buy_camelCaseString];
XCTAssertEqualObjects(actual, expected, @"camel case string was incorrect");
}
- (void)testAcronyms {
NSArray *expected = @[ @"url"];
NSArray *actual = [NSString buy_acronymStrings];
XCTAssertEqualObjects(actual, expected, @"Default acronyms not correct");
NSArray *acronyms = @[ @"hello" ];
[NSString buy_setAcronymStrings:acronyms];
expected = acronyms;
actual = [NSString buy_acronymStrings];
XCTAssertEqualObjects(actual, expected, @"Custom acronyms not correct");
}
- (void)testCamelCaseStringWithAcronyms {
NSString *expected = @"URLString";
NSString *actual = [@"url_string" buy_camelCaseString];
XCTAssertEqualObjects(actual, expected, @"camel case string was incorrect");
expected = @"stringWithURL";
actual = [@"string_with_url" buy_camelCaseString];
XCTAssertEqualObjects(actual, expected, @"camel case string was incorrect");
[NSString buy_setAcronymStrings:@[@"awol", @"GDP", @"sdk"]];
expected = @"goneAWOL";
actual = [@"gone_awol" buy_camelCaseString];
XCTAssertEqualObjects(actual, expected, @"camel case string was incorrect");
expected = @"SDKTypes";
actual = [@"sdk_types" buy_camelCaseString];
XCTAssertEqualObjects(actual, expected, @"camel case string was incorrect");
expected = @"GDPCanada";
actual = [@"gdp_canada" buy_camelCaseString];
XCTAssertEqualObjects(actual, expected, @"camel case string was incorrect");
}
@end
//
// BUYURLAdditionsTests.m
// Mobile Buy SDK
//
// Created by Shopify.
// Copyright (c) 2015 Shopify Inc. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
//
#import <XCTest/XCTest.h>
#import "NSURL+BUYAdditions.h"
@interface BUYURLAdditionsTests : XCTestCase
@end
@implementation BUYURLAdditionsTests
- (void)testAppendBasenameSuffix
{
NSString *string = @"http://shopify.com/file.txt";
NSURL *url = [NSURL URLWithString:string];
NSURL *expected = [NSURL URLWithString:@"http://shopify.com/file_big.txt"];
NSURL *actual = [url buy_URLByAppendingFileBaseNameSuffix:@"_big"];
XCTAssertEqualObjects(actual, expected);
}
@end
......@@ -73,6 +73,12 @@
841ADE241CB6C942000004B0 /* NSURLComponents+BUYAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = 841ADDFD1CB6C942000004B0 /* NSURLComponents+BUYAdditions.h */; };
841ADE251CB6C942000004B0 /* NSURLComponents+BUYAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = 841ADDFE1CB6C942000004B0 /* NSURLComponents+BUYAdditions.m */; };
841ADE261CB6C942000004B0 /* NSURLComponents+BUYAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = 841ADDFE1CB6C942000004B0 /* NSURLComponents+BUYAdditions.m */; };
849110311CCE708900E53B93 /* BUYArrayAdditionsTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 8491102E1CCE708900E53B93 /* BUYArrayAdditionsTests.m */; };
849110321CCE708900E53B93 /* BUYRegularExpressionAdditionsTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 8491102F1CCE708900E53B93 /* BUYRegularExpressionAdditionsTests.m */; };
849110331CCE708900E53B93 /* BUYStringAdditionsTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 849110301CCE708900E53B93 /* BUYStringAdditionsTests.m */; };
849110351CCE70CE00E53B93 /* BUYDictionaryAdditionsTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 849110341CCE70CE00E53B93 /* BUYDictionaryAdditionsTests.m */; };
8491103A1CCE718100E53B93 /* BUYExceptionAdditionsTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 849110391CCE718100E53B93 /* BUYExceptionAdditionsTests.m */; };
8491103C1CCE731900E53B93 /* BUYURLAdditionsTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 8491103B1CCE731900E53B93 /* BUYURLAdditionsTests.m */; };
9003969B1B601DF400226B73 /* BUYCartLineItem.h in Headers */ = {isa = PBXBuildFile; fileRef = 900396991B601DF400226B73 /* BUYCartLineItem.h */; settings = {ATTRIBUTES = (Public, ); }; };
9003969C1B601DF400226B73 /* BUYCartLineItem.m in Sources */ = {isa = PBXBuildFile; fileRef = 9003969A1B601DF400226B73 /* BUYCartLineItem.m */; };
900396AC1B627CB900226B73 /* BUYProductView.h in Headers */ = {isa = PBXBuildFile; fileRef = 900396AA1B627CB900226B73 /* BUYProductView.h */; };
......@@ -394,6 +400,12 @@
841ADDFC1CB6C942000004B0 /* NSURL+BUYAdditions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSURL+BUYAdditions.m"; sourceTree = "<group>"; };
841ADDFD1CB6C942000004B0 /* NSURLComponents+BUYAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSURLComponents+BUYAdditions.h"; sourceTree = "<group>"; };
841ADDFE1CB6C942000004B0 /* NSURLComponents+BUYAdditions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSURLComponents+BUYAdditions.m"; sourceTree = "<group>"; };
8491102E1CCE708900E53B93 /* BUYArrayAdditionsTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BUYArrayAdditionsTests.m; sourceTree = "<group>"; };
8491102F1CCE708900E53B93 /* BUYRegularExpressionAdditionsTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BUYRegularExpressionAdditionsTests.m; sourceTree = "<group>"; };
849110301CCE708900E53B93 /* BUYStringAdditionsTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BUYStringAdditionsTests.m; sourceTree = "<group>"; };
849110341CCE70CE00E53B93 /* BUYDictionaryAdditionsTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BUYDictionaryAdditionsTests.m; sourceTree = "<group>"; };
849110391CCE718100E53B93 /* BUYExceptionAdditionsTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BUYExceptionAdditionsTests.m; sourceTree = "<group>"; };
8491103B1CCE731900E53B93 /* BUYURLAdditionsTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BUYURLAdditionsTests.m; sourceTree = "<group>"; };
900396991B601DF400226B73 /* BUYCartLineItem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BUYCartLineItem.h; sourceTree = "<group>"; };
9003969A1B601DF400226B73 /* BUYCartLineItem.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BUYCartLineItem.m; sourceTree = "<group>"; };
900396AA1B627CB900226B73 /* BUYProductView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; name = BUYProductView.h; path = "Product View/BUYProductView.h"; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; };
......@@ -640,22 +652,28 @@
isa = PBXGroup;
children = (
90F592F91B0D5F4C0026B382 /* BUYApplePayAdditionsTest.m */,
8491102E1CCE708900E53B93 /* BUYArrayAdditionsTests.m */,
90F592FA1B0D5F4C0026B382 /* BUYCartTest.m */,
90F592FB1B0D5F4C0026B382 /* BUYCheckoutTest.m */,
90F592FC1B0D5F4C0026B382 /* BUYClientTest_Storefront.m */,
90F592FD1B0D5F4C0026B382 /* BUYClientTest.m */,
BEB9AE7A1BA866D000575F8A /* BUYClientTestBase.h */,
BEB9AE7C1BA8685600575F8A /* BUYClientTestBase.m */,
849110341CCE70CE00E53B93 /* BUYDictionaryAdditionsTests.m */,
849110391CCE718100E53B93 /* BUYExceptionAdditionsTests.m */,
90F592F81B0D5F4C0026B382 /* BUYIntegrationTest.m */,
90F592FE1B0D5F4C0026B382 /* BUYLineItemTest.m */,
90F592FF1B0D5F4C0026B382 /* BUYObjectTests.m */,
8491102F1CCE708900E53B93 /* BUYRegularExpressionAdditionsTests.m */,
849110301CCE708900E53B93 /* BUYStringAdditionsTests.m */,
90F593001B0D5F4C0026B382 /* BUYTestConstants.h */,
906CF1AE1B8B660F001F7D5B /* PKContact Test Objects */,
90F592EE1B0D5EFE0026B382 /* Supporting Files */,
8491103B1CCE731900E53B93 /* BUYURLAdditionsTests.m */,
BE6C07051BB1E46900BD9F7B /* mocked_responses.json */,
BEB9AE721BA73E6C00575F8A /* test_shop_data.json */,
BE98DB5A1BB1F4D000C29564 /* OHHTTPStubsResponse+Helpers.h */,
BE98DB5B1BB1F4D000C29564 /* OHHTTPStubsResponse+Helpers.m */,
906CF1AE1B8B660F001F7D5B /* PKContact Test Objects */,
90F592EE1B0D5EFE0026B382 /* Supporting Files */,
BEB9AE721BA73E6C00575F8A /* test_shop_data.json */,
);
path = "Mobile Buy SDK Tests";
sourceTree = "<group>";
......@@ -956,8 +974,6 @@
901931471BC5B9BC00D1134E /* BUYPaymentButton.h in Headers */,
901931481BC5B9BC00D1134E /* BUYImageView.h in Headers */,
901931491BC5B9BC00D1134E /* BUYGiftCard.h in Headers */,
BE6D059A1BD6BA6700772EBB /* NSDictionary+Additions.h in Headers */,
9019314A1BC5B9BC00D1134E /* BUYClient+Test.h in Headers */,
9019314B1BC5B9BC00D1134E /* BUYNavigationController.h in Headers */,
9019314D1BC5B9BC00D1134E /* BUYVariantOptionBreadCrumbsView.h in Headers */,
9019314E1BC5B9BC00D1134E /* BUYProductViewFooter.h in Headers */,
......@@ -1037,8 +1053,6 @@
BE9A64821B503DAD0033E558 /* BUYPaymentButton.h in Headers */,
BEB74A771B55646D0005A300 /* BUYImageView.h in Headers */,
BE9A64571B503CCC0033E558 /* BUYGiftCard.h in Headers */,
BE6D05991BD6BA6700772EBB /* NSDictionary+Additions.h in Headers */,
BE2E1D3A1B5E8663009610DA /* BUYClient+Test.h in Headers */,
BEB74A671B55640C0005A300 /* BUYNavigationController.h in Headers */,
90DE92701B9897B6002EF4DA /* BUYVariantOptionBreadCrumbsView.h in Headers */,
BEB74A711B5564300005A300 /* BUYProductViewFooter.h in Headers */,
......@@ -1296,7 +1310,6 @@
841ADE221CB6C942000004B0 /* NSURL+BUYAdditions.m in Sources */,
901931161BC5B9BC00D1134E /* BUYShippingRate.m in Sources */,
841ADE061CB6C942000004B0 /* NSDate+BUYAdditions.m in Sources */,
901931171BC5B9BC00D1134E /* BUYClient+Test.m in Sources */,
901931181BC5B9BC00D1134E /* BUYGradientView.m in Sources */,
901931191BC5B9BC00D1134E /* BUYViewController.m in Sources */,
9019311A1BC5B9BC00D1134E /* BUYImageKit.m in Sources */,
......@@ -1319,7 +1332,10 @@
files = (
BEB9AE7D1BA885E300575F8A /* BUYClientTestBase.m in Sources */,
BEB9AE7B1BA866D000575F8A /* BUYClientTestBase.h in Sources */,
8491103A1CCE718100E53B93 /* BUYExceptionAdditionsTests.m in Sources */,
849110351CCE70CE00E53B93 /* BUYDictionaryAdditionsTests.m in Sources */,
90F5930A1B0D5F4C0026B382 /* BUYLineItemTest.m in Sources */,
849110321CCE708900E53B93 /* BUYRegularExpressionAdditionsTests.m in Sources */,
90F593061B0D5F4C0026B382 /* BUYCartTest.m in Sources */,
90F593051B0D5F4C0026B382 /* BUYApplePayAdditionsTest.m in Sources */,
90F593071B0D5F4C0026B382 /* BUYCheckoutTest.m in Sources */,
......@@ -1328,9 +1344,12 @@
90F593041B0D5F4C0026B382 /* BUYIntegrationTest.m in Sources */,
90F593081B0D5F4C0026B382 /* BUYClientTest_Storefront.m in Sources */,
90BBCD731B87B6BA00FCCE51 /* BUYPKContact.m in Sources */,
849110331CCE708900E53B93 /* BUYStringAdditionsTests.m in Sources */,
906CF1B11B8B66AE001F7D5B /* BUYCNPostalAddress.m in Sources */,
8491103C1CCE731900E53B93 /* BUYURLAdditionsTests.m in Sources */,
906CF1AD1B8B5F7D001F7D5B /* BUYNSPersonNameComponents.m in Sources */,
BE98DB5C1BB1F4D000C29564 /* OHHTTPStubsResponse+Helpers.m in Sources */,
849110311CCE708900E53B93 /* BUYArrayAdditionsTests.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
......@@ -1395,7 +1414,6 @@
841ADE211CB6C942000004B0 /* NSURL+BUYAdditions.m in Sources */,
BE9A644E1B503CA60033E558 /* BUYShippingRate.m in Sources */,
841ADE051CB6C942000004B0 /* NSDate+BUYAdditions.m in Sources */,
BE2E1D3B1B5E8663009610DA /* BUYClient+Test.m in Sources */,
BEB74A661B5564030005A300 /* BUYGradientView.m in Sources */,
BE9A64811B503D9E0033E558 /* BUYViewController.m in Sources */,
900E7C851B5DA559006F3C81 /* BUYImageKit.m in Sources */,
......
......@@ -170,7 +170,7 @@ static NSSet *acronyms;
- (NSString *)buy_stringByReplacingBaseFileName:(NSString *)newName
{
if (self.lastPathComponent.length > self.baseFileName.length) {
if (self.pathExtension.length > 0) {
newName = [newName stringByAppendingPathExtension:self.pathExtension];
}
return [self.directory stringByAppendingPathComponent:newName];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment