Fix NSURLRequest test

We can't use parameters containing commas in macros.
This commit is contained in:
Frederik Seiffert 2023-11-15 06:14:48 +01:00
parent fd7f11a134
commit 3b3687afb3

View file

@ -8,6 +8,7 @@ int main()
NSURLRequest *request;
NSMutableURLRequest *mutable;
NSURL *httpURL, *foobarURL;
NSDictionary *expected;
httpURL = [NSURL URLWithString: @"http://www.gnustep.org"];
foobarURL = [NSURL URLWithString: @"foobar://localhost/madeupscheme"];
@ -44,17 +45,14 @@ int main()
PASS_EQUAL([mutable valueForHTTPHeaderField: @"gnustep"], (@"value1,value2"),
"Handle multiple values for an HTTP header field");
[mutable setAllHTTPHeaderFields: [NSDictionary dictionaryWithObject: @"object" forKey: @"key"]];
PASS_EQUAL([mutable allHTTPHeaderFields],
[NSDictionary dictionaryWithObjectsAndKeys:@"object", @"key", @"value1,value2", @"gnustep", nil],
"setAllHTTPHeaderFields adds header");
expected = [NSDictionary dictionaryWithObjectsAndKeys:@"object", @"key", @"value1,value2", @"gnustep", nil];
PASS_EQUAL([mutable allHTTPHeaderFields], expected, "setAllHTTPHeaderFields adds header");
[mutable setValue: @"value3" forHTTPHeaderField: @"gnustep"];
PASS_EQUAL([mutable allHTTPHeaderFields],
[NSDictionary dictionaryWithObjectsAndKeys:@"object", @"key", @"value3", @"gnustep", nil],
"Update header field");
expected = [NSDictionary dictionaryWithObjectsAndKeys:@"object", @"key", @"value3", @"gnustep", nil];
PASS_EQUAL([mutable allHTTPHeaderFields], expected, "Update header field");
[mutable setValue: nil forHTTPHeaderField: @"gnustep"];
PASS_EQUAL([mutable allHTTPHeaderFields],
[NSDictionary dictionaryWithObjectsAndKeys:@"object", @"key", nil],
"Remove header field");
expected = [NSDictionary dictionaryWithObjectsAndKeys:@"object", @"key", nil];
PASS_EQUAL([mutable allHTTPHeaderFields], expected, "Remove header field");
[mutable release];
mutable = [NSMutableURLRequest new];