Cédric Luthi

Merge branch 'master' of git://github.com/pokeb/asi-http-request

@@ -9,3 +9,4 @@ build @@ -9,3 +9,4 @@ build
9 profile 9 profile
10 *.pbxuser 10 *.pbxuser
11 *.mode1v3 11 *.mode1v3
  12 +External/GHUnit/*
1 -[submodule "External/GHUnit"]  
2 - path = External/GHUnit  
3 - url = git://github.com/gabriel/gh-unit.git  
  1 +#!/usr/bin/env ruby
  2 +
  3 +# This script fetches a pre-compiled copy of the iOS GHUnit.framework, if one isn't already in the External/GHUnit folder
  4 +# This replaces the old system, where GHUnit was included as a git submodule, because:
  5 +# a) git submodules confuse people (including me)
  6 +# b) GHUnit seems to be tricky to build without warnings
  7 +# The pre-compiled frameworks on allseeing-i.com were taken directly from those on the GHUnit downloads page on GitHub
  8 +# If you'd rather build GHUnit yourself, simply grab a copy from http://github.com/gabriel/gh-unit and drop your built framework into External/GHUnit
  9 +
  10 +require 'net/http'
  11 +if (!File.exists?('External/GHUnit/GHUnitIOS.framework'))
  12 + `curl -s http://allseeing-i.com/ASIHTTPRequest/GHUnit/GHUnit-IOS.zip > External/GHUnit/GHUnit-IOS.zip`
  13 + `unzip External/GHUnit/GHUnit-IOS.zip -d External/GHUnit/ & rm External/GHUnit/GHUnit-IOS.zip`
  14 +end
  1 +#!/usr/bin/env ruby
  2 +
  3 +# This script fetches a pre-compiled copy of the Mac GHUnit.framework, if one isn't already in the External/GHUnit folder
  4 +# This replaces the old system, where GHUnit was included as a git submodule, because:
  5 +# a) git submodules confuse people (including me)
  6 +# b) GHUnit seems to be tricky to build without warnings
  7 +# The pre-compiled frameworks on allseeing-i.com were taken directly from those on the GHUnit downloads page on GitHub
  8 +# If you'd rather build GHUnit yourself, simply grab a copy from http://github.com/gabriel/gh-unit and drop your built framework into External/GHUnit
  9 +
  10 +require 'net/http'
  11 +if (!File.exists?('External/GHUnit/GHUnit.framework'))
  12 + `curl -s http://allseeing-i.com/ASIHTTPRequest/GHUnit/GHUnit-Mac.zip > External/GHUnit/GHUnit-Mac.zip`
  13 + `unzip External/GHUnit/GHUnit-Mac.zip -d External/GHUnit/ & rm External/GHUnit/GHUnit-Mac.zip`
  14 +end
@@ -3,7 +3,7 @@ @@ -3,7 +3,7 @@
3 # This script sets a version number for ASIHTTPRequest based on the last commit, and is run when you build one of the targets in the Xcode projects that come with ASIHTTPRequest 3 # This script sets a version number for ASIHTTPRequest based on the last commit, and is run when you build one of the targets in the Xcode projects that come with ASIHTTPRequest
4 # It only really needs to run on my computer, not on yours... :) 4 # It only really needs to run on my computer, not on yours... :)
5 require 'find' 5 require 'find'
6 -if (File.exists?('/usr/local/bin/git')) 6 +if (File.exists?('.git') && File.directory?('.git') && File.exists?('/usr/local/bin/git'))
7 newversion = `/usr/local/bin/git describe --tags`.match(/(v([0-9]+)(\.([0-9]+)){1,}-([0-9]+))/).to_s.gsub(/[0-9]+$/){|commit| (commit.to_i + 1).to_s}+Time.now.strftime(" %Y-%m-%d") 7 newversion = `/usr/local/bin/git describe --tags`.match(/(v([0-9]+)(\.([0-9]+)){1,}-([0-9]+))/).to_s.gsub(/[0-9]+$/){|commit| (commit.to_i + 1).to_s}+Time.now.strftime(" %Y-%m-%d")
8 buffer = File.new('Classes/ASIHTTPRequest.m','r').read 8 buffer = File.new('Classes/ASIHTTPRequest.m','r').read
9 if !buffer.match(/#{Regexp.quote(newversion)}/) 9 if !buffer.match(/#{Regexp.quote(newversion)}/)
@@ -83,7 +83,7 @@ @@ -83,7 +83,7 @@
83 NSError *theError = nil; 83 NSError *theError = nil;
84 84
85 NSInteger bytesProcessedAlready = zStream.total_out; 85 NSInteger bytesProcessedAlready = zStream.total_out;
86 - while (zStream.avail_out == 0) { 86 + while (zStream.avail_in != 0) {
87 87
88 if (zStream.total_out-bytesProcessedAlready >= [outputData length]) { 88 if (zStream.total_out-bytesProcessedAlready >= [outputData length]) {
89 [outputData increaseLengthBy:halfLength]; 89 [outputData increaseLengthBy:halfLength];
@@ -80,7 +80,7 @@ @@ -80,7 +80,7 @@
80 NSError *theError = nil; 80 NSError *theError = nil;
81 81
82 NSInteger bytesProcessedAlready = zStream.total_out; 82 NSInteger bytesProcessedAlready = zStream.total_out;
83 - while (zStream.avail_out == 0) { 83 + while (zStream.avail_in != 0) {
84 84
85 if (zStream.total_out-bytesProcessedAlready >= [outputData length]) { 85 if (zStream.total_out-bytesProcessedAlready >= [outputData length]) {
86 [outputData increaseLengthBy:halfLength]; 86 [outputData increaseLengthBy:halfLength];
@@ -479,6 +479,21 @@ typedef void (^ASIDataBlock)(NSData *data); @@ -479,6 +479,21 @@ typedef void (^ASIDataBlock)(NSData *data);
479 // Setting this to NO may be especially useful for users using ASIHTTPRequest in conjunction with a streaming parser, as it will allow partial gzipped responses to be inflated and passed on to the parser while the request is still running 479 // Setting this to NO may be especially useful for users using ASIHTTPRequest in conjunction with a streaming parser, as it will allow partial gzipped responses to be inflated and passed on to the parser while the request is still running
480 BOOL shouldWaitToInflateCompressedResponses; 480 BOOL shouldWaitToInflateCompressedResponses;
481 481
  482 + // Will be YES if this is a request created behind the scenes to download a PAC file - these requests do not attempt to configure their own proxies
  483 + BOOL isPACFileRequest;
  484 +
  485 + // Used for downloading PAC files from http / https webservers
  486 + ASIHTTPRequest *PACFileRequest;
  487 +
  488 + // Used for asynchronously reading PAC files from file:// URLs
  489 + NSInputStream *PACFileReadStream;
  490 +
  491 + // Used for storing PAC data from file URLs as it is downloaded
  492 + NSMutableData *PACFileData;
  493 +
  494 + // Set to YES in startSynchronous. Currently used by proxy detection to download PAC files synchronously when appropriate
  495 + BOOL isSynchronous;
  496 +
482 #if NS_BLOCKS_AVAILABLE 497 #if NS_BLOCKS_AVAILABLE
483 //block to execute when request starts 498 //block to execute when request starts
484 ASIBasicBlock startedBlock; 499 ASIBasicBlock startedBlock;
@@ -780,11 +795,6 @@ typedef void (^ASIDataBlock)(NSData *data); @@ -780,11 +795,6 @@ typedef void (^ASIDataBlock)(NSData *data);
780 // Is only used when you have specified a Bundle Display Name (CFDisplayBundleName) or Bundle Name (CFBundleName) in your plist 795 // Is only used when you have specified a Bundle Display Name (CFDisplayBundleName) or Bundle Name (CFBundleName) in your plist
781 + (NSString *)defaultUserAgentString; 796 + (NSString *)defaultUserAgentString;
782 797
783 -#pragma mark proxy autoconfiguration  
784 -  
785 -// Returns an array of proxies to use for a particular url, given the url of a PAC script  
786 -+ (NSArray *)proxiesForURL:(NSURL *)theURL fromPAC:(NSURL *)pacScriptURL;  
787 -  
788 #pragma mark mime-type detection 798 #pragma mark mime-type detection
789 799
790 // Return the mime type for a file 800 // Return the mime type for a file
This diff is collapsed. Click to expand it.
@@ -8,7 +8,7 @@ @@ -8,7 +8,7 @@
8 // 8 //
9 9
10 10
11 -#if !TARGET_OS_IPHONE || (TARGET_OS_IPHONE && __IPHONE_OS_VERSION_MAX_ALLOWED <= __IPHONE_4_0) 11 +#if (!TARGET_OS_IPHONE && __MAC_OS_X_VERSION_MAX_ALLOWED < __MAC_10_6) || (TARGET_OS_IPHONE && __IPHONE_OS_VERSION_MAX_ALLOWED <= __IPHONE_4_0)
12 @protocol NSXMLParserDelegate 12 @protocol NSXMLParserDelegate
13 13
14 @optional 14 @optional
@@ -10,6 +10,13 @@ @@ -10,6 +10,13 @@
10 #import "ASIDownloadCache.h" 10 #import "ASIDownloadCache.h"
11 #import "ASIHTTPRequest.h" 11 #import "ASIHTTPRequest.h"
12 12
  13 +// Stop clang complaining about undeclared selectors
  14 +@interface ASIDownloadCacheTests ()
  15 +- (void)runCacheOnlyCallsRequestFinishedOnceTest;
  16 +- (void)finishCached:(ASIHTTPRequest *)request;
  17 +@end
  18 +
  19 +
13 @implementation ASIDownloadCacheTests 20 @implementation ASIDownloadCacheTests
14 21
15 - (void)testDownloadCache 22 - (void)testDownloadCache
@@ -51,12 +51,6 @@ @@ -51,12 +51,6 @@
51 - (void)testTimeOutWithoutDownloadDelegate; 51 - (void)testTimeOutWithoutDownloadDelegate;
52 - (void)testThrottlingDownloadBandwidth; 52 - (void)testThrottlingDownloadBandwidth;
53 - (void)testThrottlingUploadBandwidth; 53 - (void)testThrottlingUploadBandwidth;
54 -- (void)requestStarted:(ASIHTTPRequest *)request;  
55 -- (void)requestFinished:(ASIHTTPRequest *)request;  
56 -- (void)requestFailed:(ASIHTTPRequest *)request;  
57 -- (void)delegateTestStarted:(ASIHTTPRequest *)request;  
58 -- (void)delegateTestFinished:(ASIHTTPRequest *)request;  
59 -- (void)delegateTestFailed:(ASIHTTPRequest *)request;  
60 #if TARGET_OS_IPHONE 54 #if TARGET_OS_IPHONE
61 - (void)testReachability; 55 - (void)testReachability;
62 #endif 56 #endif
@@ -25,6 +25,33 @@ @@ -25,6 +25,33 @@
25 } 25 }
26 @end 26 @end
27 27
  28 +
  29 +// Stop clang complaining about undeclared selectors
  30 +@interface ASIHTTPRequestTests ()
  31 +- (void)runCancelTest;
  32 +- (void)performDelegateMethodsTest;
  33 +- (void)requestStarted:(ASIHTTPRequest *)request;
  34 +- (void)requestFinished:(ASIHTTPRequest *)request;
  35 +- (void)requestFailed:(ASIHTTPRequest *)request;
  36 +- (void)delegateTestStarted:(ASIHTTPRequest *)request;
  37 +- (void)delegateTestResponseHeaders:(ASIHTTPRequest *)request;
  38 +- (void)delegateTestFinished:(ASIHTTPRequest *)request;
  39 +- (void)delegateTestFailed:(ASIHTTPRequest *)request;
  40 +- (void)runRemoveUploadProgressTest;
  41 +- (void)runRedirectedResume;
  42 +- (void)performDownloadProgressTest;
  43 +- (void)theTestRequest:(ASIHTTPRequest *)request didReceiveData:(NSData *)data;
  44 +- (void)theTestRequestFinished:(ASIHTTPRequest *)request;
  45 +- (void)performUploadProgressTest;
  46 +- (void)performPostBodyStreamedFromDiskTest;
  47 +- (void)performPartialFetchTest;
  48 +- (void)asyncFail:(ASIHTTPRequest *)request;
  49 +- (void)asyncSuccess:(ASIHTTPRequest *)request;
  50 +- (void)request:(ASIHTTPRequest *)request isGoingToRedirectToURL:(NSURL *)url;
  51 +- (void)redirectURLTestFailed:(ASIHTTPRequest *)request;
  52 +- (void)redirectURLTestSucceeded:(ASIHTTPRequest *)request;
  53 +@end
  54 +
28 @implementation ASIHTTPRequestTests 55 @implementation ASIHTTPRequestTests
29 56
30 - (void)testBasicDownload 57 - (void)testBasicDownload
@@ -1068,12 +1095,23 @@ @@ -1068,12 +1095,23 @@
1068 1095
1069 [ASIHTTPRequest clearSession]; 1096 [ASIHTTPRequest clearSession];
1070 1097
1071 - // Test credentials set on the request are sent before the server asks for them 1098 + // Test credentials set on the request are not sent before the server asks for them unless they are cached credentials from a previous request to this server
  1099 + request = [[[ASIHTTPRequest alloc] initWithURL:url] autorelease];
  1100 + [request setUseSessionPersistence:NO];
  1101 + [request setUsername:@"secret_username"];
  1102 + [request setPassword:@"secret_password"];
  1103 + [request setShouldPresentCredentialsBeforeChallenge:YES];
  1104 + [request startSynchronous];
  1105 + BOOL fail = [request authenticationRetryCount] == 0;
  1106 + GHAssertFalse(fail,@"Sent Basic credentials even though request did not have kCFHTTPAuthenticationSchemeBasic set as authenticationScheme.");
  1107 +
  1108 + // Test basic credentials set on the request are sent before the server asks for them if we've explictly set the authentication scheme to basic
1072 request = [[[ASIHTTPRequest alloc] initWithURL:url] autorelease]; 1109 request = [[[ASIHTTPRequest alloc] initWithURL:url] autorelease];
1073 [request setUseSessionPersistence:NO]; 1110 [request setUseSessionPersistence:NO];
1074 [request setUsername:@"secret_username"]; 1111 [request setUsername:@"secret_username"];
1075 [request setPassword:@"secret_password"]; 1112 [request setPassword:@"secret_password"];
1076 [request setShouldPresentCredentialsBeforeChallenge:YES]; 1113 [request setShouldPresentCredentialsBeforeChallenge:YES];
  1114 + [request setAuthenticationScheme:(NSString *)kCFHTTPAuthenticationSchemeBasic];
1077 [request startSynchronous]; 1115 [request startSynchronous];
1078 success = [request authenticationRetryCount] == 0; 1116 success = [request authenticationRetryCount] == 0;
1079 GHAssertTrue(success,@"Didn't supply credentials before being asked for them, even though they were set on the request and shouldPresentCredentialsBeforeChallenge == YES"); 1117 GHAssertTrue(success,@"Didn't supply credentials before being asked for them, even though they were set on the request and shouldPresentCredentialsBeforeChallenge == YES");
@@ -26,6 +26,36 @@ IMPORTANT @@ -26,6 +26,36 @@ IMPORTANT
26 @implementation ASINetworkQueueSubclass 26 @implementation ASINetworkQueueSubclass
27 @end 27 @end
28 28
  29 +// Stop clang complaining about undeclared selectors
  30 +@interface ASINetworkQueueTests ()
  31 +- (void)queueFinished:(ASINetworkQueue *)request;
  32 +- (void)addedRequestComplete:(ASIHTTPRequest *)request;
  33 +- (void)addAnotherRequest;
  34 +- (void)immediateCancelFail:(ASIHTTPRequest *)request;
  35 +- (void)immediateCancelFinish:(ASIHTTPRequest *)request;
  36 +- (void)finish:(ASIHTTPRequest *)request;
  37 +- (void)throttleFail:(ASIHTTPRequest *)request;
  38 +- (void)postDone:(ASIHTTPRequest *)request;
  39 +- (void)ntlmDone:(ASIHTTPRequest *)request;
  40 +- (void)ntlmFailed:(ASIHTTPRequest *)request;
  41 +- (void)runHEADFailureTest;
  42 +- (void)queueFailureFinish:(ASINetworkQueue *)request;
  43 +- (void)queueFailureFinishCallOnce:(ASINetworkQueue *)request;
  44 +- (void)request:(ASIHTTPRequest *)request isGoingToRedirectToURL:(NSURL *)url;
  45 +- (void)redirectURLTestFailed:(ASIHTTPRequest *)request;
  46 +- (void)redirectURLTestSucceeded:(ASIHTTPRequest *)request;
  47 +- (void)runDelegateMethodsTest;
  48 +- (void)delegateTestStarted:(ASIHTTPRequest *)request;
  49 +- (void)delegateTestFinished:(ASIHTTPRequest *)request;
  50 +- (void)delegateTestFailed:(ASIHTTPRequest *)request;
  51 +- (void)delegateTestRequest:(ASIHTTPRequest *)request receivedResponseHeaders:(NSDictionary *)headers;
  52 +- (void)addMoreRequestsQueueFinished:(ASINetworkQueue *)request;
  53 +- (void)requestFailedCancellingOthers:(ASINetworkQueue *)request;
  54 +- (void)fail:(ASIHTTPRequest *)request;
  55 +- (void)HEADFail:(ASIHTTPRequest *)request;
  56 +- (void)runTestQueueFinishedCalledOnFailureTest;
  57 +@end
  58 +
29 @implementation ASINetworkQueueTests 59 @implementation ASINetworkQueueTests
30 60
31 - (void)testDelegateAuthenticationCredentialsReuse 61 - (void)testDelegateAuthenticationCredentialsReuse
@@ -34,6 +34,16 @@ static NSString *bucket = @""; @@ -34,6 +34,16 @@ static NSString *bucket = @"";
34 @implementation ASIS3BucketObjectSubclass; 34 @implementation ASIS3BucketObjectSubclass;
35 @end 35 @end
36 36
  37 +// Stop clang complaining about undeclared selectors
  38 +@interface ASIS3RequestTests ()
  39 +- (void)GETRequestDone:(ASIHTTPRequest *)request;
  40 +- (void)GETRequestFailed:(ASIHTTPRequest *)request;
  41 +- (void)PUTRequestDone:(ASIHTTPRequest *)request;
  42 +- (void)PUTRequestFailed:(ASIHTTPRequest *)request;
  43 +- (void)DELETERequestDone:(ASIHTTPRequest *)request;
  44 +- (void)DELETERequestFailed:(ASIHTTPRequest *)request;
  45 +@end
  46 +
37 @implementation ASIS3RequestTests 47 @implementation ASIS3RequestTests
38 48
39 // All these tests are based on Amazon's examples at: http://docs.amazonwebservices.com/AmazonS3/2006-03-01/ 49 // All these tests are based on Amazon's examples at: http://docs.amazonwebservices.com/AmazonS3/2006-03-01/
@@ -101,16 +111,16 @@ static NSString *bucket = @""; @@ -101,16 +111,16 @@ static NSString *bucket = @"";
101 GHAssertTrue(success,@"Failed to generate the correct authorisation header for a list request"); 111 GHAssertTrue(success,@"Failed to generate the correct authorisation header for a list request");
102 112
103 // Test Unicode keys 113 // Test Unicode keys
104 - exampleBucket = @"dictionary";  
105 - key = @"français/préfère";  
106 - dateString = @"Wed, 28 Mar 2007 01:49:49 +0000";  
107 - request = [ASIS3ObjectRequest requestWithBucket:exampleBucket key:key];  
108 - [request setDateString:dateString];  
109 - [request setSecretAccessKey:exampleSecretAccessKey];  
110 - [request setAccessKey:exampleAccessKey];  
111 - [request buildRequestHeaders];  
112 - success = [[[request requestHeaders] valueForKey:@"Authorization"] isEqualToString:@"AWS 0PN5J17HBGZHT7JJ3X82:dxhSBHoI6eVSPcXJqEghlUzZMnY="];  
113 // Comment out this test for now, as the S3 example is relying on mixed-case hex-encoded characters in the url, which isn't going to be easy to replicate 114 // Comment out this test for now, as the S3 example is relying on mixed-case hex-encoded characters in the url, which isn't going to be easy to replicate
  115 +// exampleBucket = @"dictionary";
  116 +// key = @"français/préfère";
  117 +// dateString = @"Wed, 28 Mar 2007 01:49:49 +0000";
  118 +// request = [ASIS3ObjectRequest requestWithBucket:exampleBucket key:key];
  119 +// [request setDateString:dateString];
  120 +// [request setSecretAccessKey:exampleSecretAccessKey];
  121 +// [request setAccessKey:exampleAccessKey];
  122 +// [request buildRequestHeaders];
  123 +// success = [[[request requestHeaders] valueForKey:@"Authorization"] isEqualToString:@"AWS 0PN5J17HBGZHT7JJ3X82:dxhSBHoI6eVSPcXJqEghlUzZMnY="];
114 //GHAssertTrue(success,@"Failed to generate the correct authorisation header for a list request"); 124 //GHAssertTrue(success,@"Failed to generate the correct authorisation header for a list request");
115 } 125 }
116 126
@@ -9,7 +9,7 @@ @@ -9,7 +9,7 @@
9 #import <Foundation/Foundation.h> 9 #import <Foundation/Foundation.h>
10 10
11 #if TARGET_OS_IPHONE 11 #if TARGET_OS_IPHONE
12 -#import "GHUnit.h" 12 +#import <GHUnitIOS/GHUnit.h>
13 #else 13 #else
14 #import <GHUnit/GHUnit.h> 14 #import <GHUnit/GHUnit.h>
15 #endif 15 #endif
@@ -20,6 +20,15 @@ @@ -20,6 +20,15 @@
20 @synthesize tag; 20 @synthesize tag;
21 @end 21 @end
22 22
  23 +// Stop clang complaining about undeclared selectors
  24 +@interface PerformanceTests ()
  25 +- (void)runSynchronousASIHTTPRequests;
  26 +- (void)runSynchronousNSURLConnections;
  27 +- (void)startASIHTTPRequests;
  28 +- (void)startASIHTTPRequestsWithQueue;
  29 +- (void)startNSURLConnections;
  30 +@end
  31 +
23 32
24 @implementation PerformanceTests 33 @implementation PerformanceTests
25 34
@@ -16,6 +16,13 @@ static int proxyPort = 0; @@ -16,6 +16,13 @@ static int proxyPort = 0;
16 static NSString *proxyUsername = @""; 16 static NSString *proxyUsername = @"";
17 static NSString *proxyPassword = @""; 17 static NSString *proxyPassword = @"";
18 18
  19 +// Stop clang complaining about undeclared selectors
  20 +@interface ProxyTests ()
  21 +- (void)requestDone:(ASIHTTPRequest *)request;
  22 +- (void)requestFailed:(ASIHTTPRequest *)request;
  23 +@end
  24 +
  25 +
19 @implementation ProxyTests 26 @implementation ProxyTests
20 27
21 - (void)testProxyForHTTPS 28 - (void)testProxyForHTTPS
@@ -29,6 +29,13 @@ IMPORTANT @@ -29,6 +29,13 @@ IMPORTANT
29 @synthesize request; 29 @synthesize request;
30 @end 30 @end
31 31
  32 +// Stop clang complaining about undeclared selectors
  33 +@interface StressTests ()
  34 +- (void)cancelRedirectRequest;
  35 +- (void)cancelSetDelegateRequest;
  36 +@end
  37 +
  38 +
32 39
33 @implementation StressTests 40 @implementation StressTests
34 41
@@ -2,6 +2,7 @@ ASIHTTPRequest donors @@ -2,6 +2,7 @@ ASIHTTPRequest donors
2 2
3 I am very grateful to the following people for their generous donations: 3 I am very grateful to the following people for their generous donations:
4 4
  5 +AzroTech, Inc
5 Karl Beck 6 Karl Beck
6 John Brayton 7 John Brayton
7 Stephan Burlot (http://www.coriolis.ch) 8 Stephan Burlot (http://www.coriolis.ch)
@@ -16,6 +17,7 @@ Nathan de Vries (http://www.atnan.com) @@ -16,6 +17,7 @@ Nathan de Vries (http://www.atnan.com)
16 Matthew Frederick 17 Matthew Frederick
17 James Hartzell 18 James Hartzell
18 Hunter Hillegas 19 Hunter Hillegas
  20 +Marcus Hobbs
19 Felix Holmgren 21 Felix Holmgren
20 Cesar Jacquet 22 Cesar Jacquet
21 Philip Jespersen 23 Philip Jespersen
@@ -29,8 +31,10 @@ Spencer Pieters (http://www.appwizard.be) @@ -29,8 +31,10 @@ Spencer Pieters (http://www.appwizard.be)
29 Alessandro Segala (http://letsdev.it) 31 Alessandro Segala (http://letsdev.it)
30 Ben Scheirman 32 Ben Scheirman
31 Basil Shkara (http://www.oiledmachine.com) 33 Basil Shkara (http://www.oiledmachine.com)
  34 +Jacob Sologub (http://irompler.com)
32 Jakub Suder (http://psionides.jogger.pl) 35 Jakub Suder (http://psionides.jogger.pl)
33 Kyle Van Essen 36 Kyle Van Essen
  37 +Rowan Willson
34 Dan Zeitman 38 Dan Zeitman
35 39
36 Many thanks! 40 Many thanks!
1 -Subproject commit ffb51729219514fb7948b9be29bbae3dfabb1f4a  
  1 +This folder is where ASIHTTPRequest looks for GHUnit frameworks.
  2 +
  3 +When you run one of the test targets, a build script will attempt to download a pre-compiled framework and install it here, if one does not already exist. If you would prefer to build GHUnit yourself, simply grab a copy from https://github.com/gabriel/gh-unit, and drop your built framework in this folder.
1 -* Copyright (c) 2007-2010, All-Seeing Interactive 1 +* Copyright (c) 2007-2011, All-Seeing Interactive
2 * All rights reserved. 2 * All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
This diff was suppressed by a .gitattributes entry.
1 -#!/bin/sh  
2 -scan-build xcodebuild -target iPhone -configuration Debug -project iPhone.xcodeproj -sdk iphonesimulator2.2.1  
3 -scan-build xcodebuild -target Mac -configuration Debug -project Mac.xcodeproj  
  1 +//
  2 +// GHUnitIOSTestMain.m
  3 +// GHUnitIPhone
  4 +//
  5 +// Created by Gabriel Handford on 1/25/09.
  6 +// Copyright 2009. All rights reserved.
  7 +//
  8 +// Permission is hereby granted, free of charge, to any person
  9 +// obtaining a copy of this software and associated documentation
  10 +// files (the "Software"), to deal in the Software without
  11 +// restriction, including without limitation the rights to use,
  12 +// copy, modify, merge, publish, distribute, sublicense, and/or sell
  13 +// copies of the Software, and to permit persons to whom the
  14 +// Software is furnished to do so, subject to the following
  15 +// conditions:
  16 +//
  17 +// The above copyright notice and this permission notice shall be
  18 +// included in all copies or substantial portions of the Software.
  19 +//
  20 +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  21 +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
  22 +// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  23 +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
  24 +// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
  25 +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
  26 +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
  27 +// OTHER DEALINGS IN THE SOFTWARE.
  28 +//
  29 +
  30 +#import <UIKit/UIKit.h>
  31 +
  32 +// If you are using the framework
  33 +#import <GHUnitIOS/GHUnit.h>
  34 +// If you are using the static library and importing header files manually
  35 +//#import "GHUnit.h"
  36 +
  37 +// Default exception handler
  38 +void exceptionHandler(NSException *exception) {
  39 + NSLog(@"%@\n%@", [exception reason], GHUStackTraceFromException(exception));
  40 +}
  41 +
  42 +int main(int argc, char *argv[]) {
  43 +
  44 + /*!
  45 + For debugging:
  46 + Go into the "Get Info" contextual menu of your (test) executable (inside the "Executables" group in the left panel of XCode).
  47 + Then go in the "Arguments" tab. You can add the following environment variables:
  48 +
  49 + Default: Set to:
  50 + NSDebugEnabled NO "YES"
  51 + NSZombieEnabled NO "YES"
  52 + NSDeallocateZombies NO "YES"
  53 + NSHangOnUncaughtException NO "YES"
  54 +
  55 + NSEnableAutoreleasePool YES "NO"
  56 + NSAutoreleaseFreedObjectCheckEnabled NO "YES"
  57 + NSAutoreleaseHighWaterMark 0 non-negative integer
  58 + NSAutoreleaseHighWaterResolution 0 non-negative integer
  59 +
  60 + For info on these varaiables see NSDebug.h; http://theshadow.uw.hu/iPhoneSDKdoc/Foundation.framework/NSDebug.h.html
  61 +
  62 + For malloc debugging see: http://developer.apple.com/mac/library/documentation/Performance/Conceptual/ManagingMemory/Articles/MallocDebug.html
  63 + */
  64 +
  65 + NSSetUncaughtExceptionHandler(&exceptionHandler);
  66 +
  67 + NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
  68 +
  69 + // Register any special test case classes
  70 + //[[GHTesting sharedInstance] registerClassName:@"GHSpecialTestCase"];
  71 +
  72 + int retVal = 0;
  73 + // If GHUNIT_CLI is set we are using the command line interface and run the tests
  74 + // Otherwise load the GUI app
  75 + if (getenv("GHUNIT_CLI")) {
  76 + retVal = [GHTestRunner run];
  77 + } else {
  78 + retVal = UIApplicationMain(argc, argv, nil, @"GHUnitIPhoneAppDelegate");
  79 + }
  80 + [pool release];
  81 + return retVal;
  82 +}
This diff was suppressed by a .gitattributes entry.