Author: rfm
Date: Thu Nov 20 10:58:52 2014
New Revision: 38190
URL: http://svn.gna.org/viewcvs/gnustep?rev=38190&view=rev
Log:
fixup corrupted commit
Modified:
libs/base/trunk/Tests/base/NSURL/test02.m
Modified: libs/base/trunk/Tests/base/NSURL/test02.m
URL:
http://svn.gna.org/viewcvs/gnustep/libs/base/trunk/Tests/base/NSURL/test02.m?rev=38190&r1=38189&r2=38190&view=diff
==============================================================================
--- libs/base/trunk/Tests/base/NSURL/test02.m (original)
+++ libs/base/trunk/Tests/base/NSURL/test02.m Thu Nov 20 10:58:52 2014
@@ -118,203 +118,3 @@
#endif
return 0;
}
-#import <Foundation/Foundation.h>
-#import "Testing.h"
-#import "ObjectTesting.h"
-
-
-int main()
-{
-#if GNUSTEP
- NSAutoreleasePool *arp = [NSAutoreleasePool new];
- unsigned i;
- NSURL *url;
- NSMutableString *m;
- NSData *data;
- NSString *str;
- NSTask *t;
- NSString *helpers;
- NSString *capture;
- NSMutableURLRequest *request;
- NSHTTPURLResponse *response = nil;
- NSError *error = nil;
- NSFileManager *fm;
- NSRange r;
- NSString *file = @"Capture.dat";
-
- fm = [NSFileManager defaultManager];
- helpers = [fm currentDirectoryPath];
- helpers = [helpers stringByAppendingPathComponent: @"Helpers"];
- helpers = [helpers stringByAppendingPathComponent: @"obj"];
- capture = [helpers stringByAppendingPathComponent: @"capture"];
-
- m = [NSMutableString stringWithCapacity: 2048];
- for (i = 0; i < 128; i++)
- {
- [m appendFormat: @"Hello %d\r\n", i];
- }
-
- t = [NSTask launchedTaskWithLaunchPath: capture
- arguments: [NSArray arrayWithObjects:
- nil]];
- if (t != nil)
- {
- // Pause to allow server subtask to set up.
- [NSThread sleepUntilDate: [NSDate dateWithTimeIntervalSinceNow: 0.5]];
- // remove the captured data from a possible previous run
- [fm removeItemAtPath: file error: NULL];
- // making a POST request
- url = [NSURL URLWithString: @"http://localhost:54321/"];
- request = [NSMutableURLRequest requestWithURL: url];
- data = [m dataUsingEncoding: NSUTF8StringEncoding];
- [request setHTTPBody: data];
- [request setHTTPMethod: @"POST"];
-
- // sending the request
- [NSURLConnection sendSynchronousRequest: request
- returningResponse: &response
- error: &error];
-
- // analyzing the response
- PASS(response != nil && [response statusCode] == 204,
- "NSURLConnection synchronous load returns a response");
-
- data = [NSData dataWithContentsOfFile: @"Capture.dat"];
- str = [[NSString alloc] initWithData: data
- encoding: NSUTF8StringEncoding];
- r = [str rangeOfString: m];
- PASS(r.location != NSNotFound,
- "NSURLConnection capture test OK");
-
- // Wait for server termination
- [t terminate];
- [t waitUntilExit];
- DESTROY(str);
- response = nil;
- error = nil;
- }
-
- // the same but with secure connection (HTTPS)
- t = [NSTask launchedTaskWithLaunchPath: capture
- arguments: [NSArray arrayWithObjects:
- @"-Secure", @"YES",
- nil]];
- if (t != nil)
- {
- // Pause to allow server subtask to set up.
- [NSThread sleepUntilDate: [NSDate dateWithTimeIntervalSinceNow: 0.5]];
- // remove the captured data from a possible previous run
- [fm removeItemAtPath: file error: NULL];
- // making a POST request
- url = [NSURL URLWithString: @"https://localhost:54321/"];
- request = [NSMutableURLRequest requestWithURL: url];
- data = [m dataUsingEncoding: NSUTF8StringEncoding];
- [request setHTTPBody: data];
- [request setHTTPMethod: @"POST"];
-
- // sending the request
- [NSURLConnection sendSynchronousRequest: request
- returningResponse: &response
- error: &error];
-
- // sending the request
- PASS(response != nil && [response statusCode] == 204,
- "NSURLConnection synchronous load returns a response");
-
- data = [NSData dataWithContentsOfFile: @"Capture.dat"];
- str = [[NSString alloc] initWithData: data
- encoding: NSUTF8StringEncoding];
- r = [str rangeOfString: m];
- PASS(r.location != NSNotFound,
- "NSURLConnection capture test OK");
-
- // Wait for server termination
- [t terminate];
- [t waitUntilExit];
- DESTROY(str);
- }
-
- [arp release]; arp = nil;
-#endif
- return 0;
-}
-#import <Foundation/Foundation.h>
-#import "Testing.h"
-#import "ObjectTesting.h"
-
-
-int main()
-{
-#if GNUSTEP
- NSAutoreleasePool *arp = [NSAutoreleasePool new];
- unsigned i;
- NSURL *url;
- NSMutableString *body;
- NSData *data;
- NSString *str;
- NSTask *t;
- NSString *helpers;
- NSString *capture;
- NSMutableURLRequest *request;
- NSHTTPURLResponse *response = nil;
- NSError *error = nil;
- NSFileManager *fm;
- NSRange r;
- NSString *file = @"Capture.dat";
-
- fm = [NSFileManager defaultManager];
- helpers = [fm currentDirectoryPath];
- helpers = [helpers stringByAppendingPathComponent: @"Helpers"];
- helpers = [helpers stringByAppendingPathComponent: @"obj"];
- capture = [helpers stringByAppendingPathComponent: @"capture"];
-
- body = [NSMutableString stringWithCapacity: 2048];
- for (i = 0; i < 128; i++)
- {
- [body appendFormat: @"Hello %d\r\n", i];
- }
-
- t = [NSTask launchedTaskWithLaunchPath: capture
- arguments: [NSArray arrayWithObjects:
- nil]];
- if (t != nil)
- {
- // Pause to allow server subtask to set up.
- [NSThread sleepUntilDate: [NSDate dateWithTimeIntervalSinceNow: 0.5]];
- // remove the captured data from a possible previous run
- [fm removeItemAtPath: file error: NULL];
- // making a POST request
- url = [NSURL URLWithString: @"http://localhost:54321/"];
- request = [NSMutableURLRequest requestWithURL: url];
- data = [body dataUsingEncoding: NSUTF8StringEncoding];
- [request setHTTPBody: data];
- [request setHTTPMethod: @"POST"];
-
- // sending the request
- [NSURLConnection sendSynchronousRequest: request
- returningResponse: &response
- error: &error];
-
- // analyzing the response
- PASS(response != nil && [response statusCode] == 204,
- "NSURLConnection synchronous load returns a response");
-
- data = [NSData dataWithContentsOfFile: @"Capture.dat"];
- str = [[NSString alloc] initWithData: data
- encoding: NSUTF8StringEncoding];
- r = [str rangeOfString: body];
- PASS(r.location != NSNotFound,
- "NSURLConnection capture test OK");
-
- // Wait for server termination
- [t terminate];
- [t waitUntilExit];
- DESTROY(str);
- response = nil;
- error = nil;
- }
-
- [arp release]; arp = nil;
-#endif
- return 0;
-}
_______________________________________________
Gnustep-cvs mailing list
[email protected]
https://mail.gna.org/listinfo/gnustep-cvs