mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-11-24 15:35:52 +00:00
Fixed remaining failing CPURL tests and removed prints from CFURL tests.
Reviewed by me.
This commit is contained in:
1 parent
ae25f489ad
commit
89bd5f5b93
4 files changed
+51
-14
No files matched your search
+6
-1
@@ -122,7 +122,12 @@ CPURLCustomIconKey = @"CPURLCustomIconKey";
|
||||
|
||||
- (Number)port
|
||||
{
|
||||
return parseInt([self absoluteURL].port(), 10);
|
||||
var portNumber = [self absoluteURL].portNumber();
|
||||
|
||||
if (portNumber === -1)
|
||||
return nil;
|
||||
|
||||
return portNumber;
|
||||
}
|
||||
|
||||
- (CPString)parameterString
|
||||
|
||||
+37
-5
@@ -1,3 +1,24 @@
|
||||
/*
|
||||
* CFURL.js
|
||||
* Objective-J
|
||||
*
|
||||
* Created by Francisco Tolmasky.
|
||||
* Copyright 2010, 280 North, Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
var CFURLsForCachedUIDs,
|
||||
CFURLPartsForURLStrings,
|
||||
@@ -58,7 +79,7 @@ var URI_KEYS =
|
||||
"user",
|
||||
"password",
|
||||
"domain",
|
||||
"port",
|
||||
"portNumber",
|
||||
"path",
|
||||
"queryString",
|
||||
"fragment"
|
||||
@@ -88,7 +109,12 @@ function CFURLGetParts(/*CFURL*/ aURL)
|
||||
index = results.length;
|
||||
|
||||
while (index--)
|
||||
parts[URI_KEYS[index]] = results[index] || "";
|
||||
parts[URI_KEYS[index]] = results[index] || NULL;
|
||||
|
||||
parts.portNumber = parseInt(parts.portNumber, 10);
|
||||
|
||||
if (isNaN(parts.portNumber))
|
||||
parts.portNumber = -1;
|
||||
|
||||
parts.pathComponents = [];
|
||||
|
||||
@@ -243,6 +269,12 @@ function resolveURL(aURL)
|
||||
|
||||
resolvedParts.scheme = baseParts.scheme;
|
||||
resolvedParts.authority = baseParts.authority;
|
||||
resolvedParts.userInfo = baseParts.userInfo;
|
||||
resolvedParts.user = baseParts.user;
|
||||
resolvedParts.password = baseParts.password;
|
||||
resolvedParts.domain = baseParts.domain;
|
||||
resolvedParts.portNumber = baseParts.portNumber;
|
||||
|
||||
resolvedParts.queryString = parts.queryString;
|
||||
resolvedParts.fragment = parts.fragment;
|
||||
|
||||
@@ -501,7 +533,7 @@ CFURL.prototype.scheme = function()
|
||||
|
||||
var baseURL = this.baseURL();
|
||||
|
||||
return baseURL && baseURL.scheme() || "";
|
||||
return baseURL && baseURL.scheme();
|
||||
}
|
||||
|
||||
CFURL.prototype.user = function()
|
||||
@@ -514,9 +546,9 @@ CFURL.prototype.password = function()
|
||||
return CFURLGetParts(this).password;
|
||||
}
|
||||
|
||||
CFURL.prototype.port = function()
|
||||
CFURL.prototype.portNumber = function()
|
||||
{
|
||||
return CFURLGetParts(this).port;
|
||||
return CFURLGetParts(this).portNumber;
|
||||
}
|
||||
|
||||
CFURL.prototype.domain = function()
|
||||
|
||||
@@ -53,17 +53,17 @@ var exampleProtocol = "http",
|
||||
urlString = examplePathRelative + "?" + exampleQuery + "#" + exampleAnchor,
|
||||
baseURL = [CPURL URLWithString:baseString],
|
||||
url = [CPURL URLWithString:urlString relativeToURL:baseURL];
|
||||
|
||||
|
||||
[self assert:[url baseURL] equals:baseURL];
|
||||
|
||||
[self assert:[url relativeString] equals:urlString];
|
||||
[self assert:[url absoluteString] equals:exampleURL];
|
||||
|
||||
|
||||
[self assert:[url relativePath] equals:pathString];
|
||||
[self assert:[url path] equals:exampleFullPath];
|
||||
|
||||
[self assert:[url absoluteURL] notSame:url];
|
||||
|
||||
|
||||
[self assert:[url scheme] equals:exampleProtocol];
|
||||
[self assert:[url user] equals:exampleUser];
|
||||
[self assert:[url password] equals:examplePassword];
|
||||
@@ -71,7 +71,7 @@ var exampleProtocol = "http",
|
||||
[self assert:[url port] equals:examplePort];
|
||||
[self assert:[url parameterString] equals:exampleQuery];
|
||||
[self assert:[url fragment] equals:exampleAnchor];
|
||||
|
||||
|
||||
[self assert:[url pathExtension] equals:"php"];
|
||||
[self assert:[url lastPathComponent] equals:examplePathRelative];
|
||||
}
|
||||
@@ -81,7 +81,7 @@ var exampleProtocol = "http",
|
||||
var pathString = examplePathRelative,
|
||||
urlString = examplePathRelative + "?" + exampleQuery + "#" + exampleAnchor,
|
||||
url = [CPURL URLWithString:urlString];
|
||||
|
||||
|
||||
[self assert:[url baseURL] equals:nil];
|
||||
|
||||
[self assert:[url relativeString] equals:urlString];
|
||||
@@ -91,7 +91,7 @@ var exampleProtocol = "http",
|
||||
[self assert:[url path] equals:pathString];
|
||||
|
||||
[self assert:[url absoluteURL] same:url];
|
||||
|
||||
|
||||
[self assert:[url scheme] equals:nil];
|
||||
[self assert:[url user] equals:nil];
|
||||
[self assert:[url password] equals:nil];
|
||||
@@ -99,7 +99,7 @@ var exampleProtocol = "http",
|
||||
[self assert:[url port] equals:nil];
|
||||
[self assert:[url parameterString] equals:exampleQuery];
|
||||
[self assert:[url fragment] equals:exampleAnchor];
|
||||
|
||||
|
||||
[self assert:[url pathExtension] equals:"php"];
|
||||
[self assert:[url lastPathComponent] equals:examplePathRelative];
|
||||
|
||||
|
||||
@@ -55,7 +55,7 @@
|
||||
for (URLString in URLStrings)
|
||||
if (URLStrings.hasOwnProperty(URLString))
|
||||
{
|
||||
print(URLStrings[URLString] + " " + new CFURL(URLString, baseURL).absoluteString());
|
||||
// print(URLStrings[URLString] + " " + new CFURL(URLString, baseURL).absoluteString());
|
||||
[self assert:URLStrings[URLString] equals:new CFURL(URLString, baseURL).absoluteString()];
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user