mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-10-10 18:52:19 +00:00
Make blendtask work with new system.
Reviewed by me.
This commit is contained in:
1 parent
06261559fc
commit
794d8a754c
14 files changed
+112
-71
No files matched your search
+1
-1
@@ -484,7 +484,7 @@ var CPDocumentUntitledCount = 0;
|
||||
else
|
||||
[_writeRequest setHTTPMethod:@"PUT"];
|
||||
|
||||
[_writeRequest setHTTPBody:[data string]];
|
||||
[_writeRequest setHTTPBody:[data encodedString]];
|
||||
|
||||
[_writeRequest setValue:@"close" forHTTPHeaderField:@"Connection"];
|
||||
|
||||
|
||||
@@ -415,7 +415,7 @@ var DOMDataTransferPasteboard = nil;
|
||||
if (type === CPStringPboardType)
|
||||
_dataTransfer.setData(type, [aPasteboard stringForType:type]);
|
||||
else
|
||||
_dataTransfer.setData(type, [[aPasteboard dataForType:type] string]);
|
||||
_dataTransfer.setData(type, [[aPasteboard dataForType:type] encodedString]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ BlendTask.prototype.infoPlist = function()
|
||||
{
|
||||
var infoPlist = BundleTask.prototype.infoPlist.apply(this, arguments);
|
||||
|
||||
infoPlist.setValue("CPKeyedThemes", require("util").unique(this._keyedThemes));
|
||||
infoPlist.setValueForKey("CPKeyedThemes", require("util").unique(this._keyedThemes));
|
||||
|
||||
return infoPlist;
|
||||
}
|
||||
@@ -72,20 +72,20 @@ BlendTask.prototype.defineThemeDescriptorTasks = function()
|
||||
|
||||
this.enhance(themesTaskName);
|
||||
|
||||
objj_import(themeDescriptors.toArray(), YES, function()
|
||||
themeDescriptors.forEach(function(/*CPString*/ themeDescriptorPath)
|
||||
{
|
||||
[BKThemeDescriptor allThemeDescriptorClasses].forEach(function(aClass)
|
||||
{
|
||||
var keyedThemePath = FILE.join(intermediatesPath, [aClass themeName] + ".keyedtheme");
|
||||
|
||||
filedir (keyedThemePath, themesTaskName);
|
||||
filedir (staticPath, [keyedThemePath]);
|
||||
|
||||
keyedThemes.push([aClass themeName] + ".keyedtheme");
|
||||
});
|
||||
objj_importFile(FILE.absolute(themeDescriptorPath), YES);
|
||||
});
|
||||
|
||||
require("browser/timeout").serviceTimeouts();
|
||||
[BKThemeDescriptor allThemeDescriptorClasses].forEach(function(aClass)
|
||||
{
|
||||
var keyedThemePath = FILE.join(intermediatesPath, [aClass themeName] + ".keyedtheme");
|
||||
|
||||
filedir (keyedThemePath, themesTaskName);
|
||||
filedir (staticPath, [keyedThemePath]);
|
||||
|
||||
keyedThemes.push([aClass themeName] + ".keyedtheme");
|
||||
});
|
||||
|
||||
task (themesTaskName, function()
|
||||
{
|
||||
@@ -158,7 +158,7 @@ function themeFromCibData(data)
|
||||
|
||||
[templates makeObjectsPerformSelector:@selector(blendAddThemedObjectAttributesToTheme:) withObject:theme];
|
||||
|
||||
return [[CPKeyedArchiver archivedDataWithRootObject:theme] string];
|
||||
return [[CPKeyedArchiver archivedDataWithRootObject:theme] encodedString];
|
||||
}
|
||||
|
||||
@implementation CPCib (BlendAdditions)
|
||||
|
||||
+23
-3
@@ -23,7 +23,7 @@
|
||||
@import "CPObject.j"
|
||||
@import "CPString.j"
|
||||
|
||||
/*!
|
||||
/*!
|
||||
@class CPData
|
||||
@ingroup foundation
|
||||
@brief A Cappuccino wrapper for any data type.
|
||||
@@ -50,6 +50,11 @@
|
||||
return [[self alloc] initWithEncodedString:aString];
|
||||
}
|
||||
|
||||
+ (CPData)dataWithSerializedPlistObject:(id)aPlistObject
|
||||
{
|
||||
return [[self alloc] initWithSerializedPlistObject:aPlistObject];
|
||||
}
|
||||
|
||||
+ (CPData)dataWithSerializedPlistObject:(id)aPlistObject format:(CPPropertyListFormat)aFormat
|
||||
{
|
||||
return [[self alloc] initWithSerializedPlistObject:aPlistObject format:aFormat];
|
||||
@@ -65,13 +70,23 @@
|
||||
return self;
|
||||
}
|
||||
|
||||
- (id)initWithSerializedPlistObject:(id)aPlistObject
|
||||
{
|
||||
self = [super init];
|
||||
|
||||
if (self)
|
||||
[self setSerializedPlistObject:aPlistObject];
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
- (id)initWithSerializedPlistObject:(id)aPlistObject format:aFormat
|
||||
{
|
||||
self = [super init];
|
||||
|
||||
if (self)
|
||||
[self setSerializedPlistObject:aPlistObject format:aFormat];
|
||||
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
@@ -97,7 +112,12 @@
|
||||
|
||||
- (id)serializedPlistObject
|
||||
{
|
||||
self.serializedPropertyList();
|
||||
return self.serializedPropertyList();
|
||||
}
|
||||
|
||||
- (void)setSerializedPlistObject:(id)aPlistObject
|
||||
{
|
||||
self.setSerializedPropertyList(aPlistObject);
|
||||
}
|
||||
|
||||
- (void)setSerializedPlistObject:(id)aPlistObject format:(CPPropertyListFormat)aFormat
|
||||
|
||||
@@ -46,6 +46,7 @@ if (input == nil)
|
||||
*/
|
||||
@implementation CPException : CPObject
|
||||
{
|
||||
id _userInfo;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -53,7 +54,7 @@ if (input == nil)
|
||||
*/
|
||||
+ (id)alloc
|
||||
{
|
||||
return new objj_exception();
|
||||
return new Error();
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -93,7 +94,7 @@ if (input == nil)
|
||||
{
|
||||
name = aName;
|
||||
message = aReason;
|
||||
userInfo = aUserInfo;
|
||||
_userInfo = aUserInfo;
|
||||
}
|
||||
|
||||
return self;
|
||||
@@ -120,7 +121,7 @@ if (input == nil)
|
||||
*/
|
||||
- (CPDictionary)userInfo
|
||||
{
|
||||
return userInfo;
|
||||
return _userInfo;
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -136,7 +137,7 @@ if (input == nil)
|
||||
*/
|
||||
- (void)raise
|
||||
{
|
||||
objj_exception_throw(self);
|
||||
throw self;
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -145,7 +146,7 @@ if (input == nil)
|
||||
|
||||
- (id)copy
|
||||
{
|
||||
return [[self class] exceptionWithName:name reason:message userInfo:userInfo];
|
||||
return [[self class] exceptionWithName:name reason:message userInfo:_userInfo];
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -169,7 +170,7 @@ var CPExceptionNameKey = "CPExceptionNameKey",
|
||||
{
|
||||
name = [aCoder decodeObjectForKey:CPExceptionNameKey];
|
||||
message = [aCoder decodeObjectForKey:CPExceptionReasonKey];
|
||||
userInfo = [aCoder decodeObjectForKey:CPExceptionUserInfoKey];
|
||||
_userInfo = [aCoder decodeObjectForKey:CPExceptionUserInfoKey];
|
||||
}
|
||||
|
||||
return self;
|
||||
@@ -183,7 +184,7 @@ var CPExceptionNameKey = "CPExceptionNameKey",
|
||||
{
|
||||
[aCoder encodeObject:name forKey:CPExceptionNameKey];
|
||||
[aCoder encodeObject:message forKey:CPExceptionReasonKey];
|
||||
[aCoder encodeObject:userInfo forKey:CPExceptionUserInfoKey];
|
||||
[aCoder encodeObject:_userInfo forKey:CPExceptionUserInfoKey];
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -191,6 +192,7 @@ var CPExceptionNameKey = "CPExceptionNameKey",
|
||||
// toll-free bridge Error to CPException
|
||||
// [CPException alloc] uses an objj_exception, which is a subclass of Error
|
||||
Error.prototype.isa = CPException;
|
||||
Error.prototype._userInfo = NULL;
|
||||
|
||||
[CPException initialize];
|
||||
|
||||
|
||||
@@ -147,7 +147,7 @@ var _CPKeyedArchiverStringClass = Nil,
|
||||
*/
|
||||
+ (CPData)archivedDataWithRootObject:(id)anObject
|
||||
{
|
||||
var data = [CPData dataWithPlistObject:nil],
|
||||
var data = [CPData dataWithSerializedPlistObject:nil],
|
||||
archiver = [[self alloc] initForWritingWithMutableData:data];
|
||||
|
||||
[archiver encodeObject:anObject forKey:@"root"];
|
||||
@@ -222,7 +222,7 @@ var _CPKeyedArchiverStringClass = Nil,
|
||||
[_plistObject setObject:[self className] forKey:_CPKeyedArchiverArchiverKey];
|
||||
[_plistObject setObject:@"100000" forKey:_CPKeyedArchiverVersionKey];
|
||||
|
||||
[_data setPlistObject:_plistObject];
|
||||
[_data setSerializedPlistObject:_plistObject];
|
||||
|
||||
if (_delegate && _delegateSelectors & _CPKeyedArchiverDidFinishSelector)
|
||||
[_delegate archiverDidFinish:self];
|
||||
|
||||
@@ -142,7 +142,7 @@ var _CPKeyedUnarchiverArrayClass = Ni
|
||||
|
||||
if (self)
|
||||
{
|
||||
_archive = [data plistObject];
|
||||
_archive = [data serializedPlistObject];
|
||||
_objects = [CPArray arrayWithObject:[CPNull null]];
|
||||
|
||||
_plistObject = [_archive objectForKey:_CPKeyedArchiverTopKey];
|
||||
|
||||
@@ -100,7 +100,7 @@ CPWebDAVManagerNonCollectionResourceType = 0;
|
||||
[request setHTTPBody:HTTPBody.join("")];
|
||||
|
||||
if (!aBlock)
|
||||
return parsePROPFINDResponse([[CPURLConnection sendSynchronousRequest:request returningResponse:nil error:nil] string]);
|
||||
return parsePROPFINDResponse([[CPURLConnection sendSynchronousRequest:request returningResponse:nil error:nil] encodedString]);
|
||||
|
||||
else
|
||||
{
|
||||
|
||||
+4
-4
@@ -10,10 +10,10 @@ function Data()
|
||||
|
||||
Data.prototype.serializedPropertyList = function()
|
||||
{
|
||||
if (!this._plistObject)
|
||||
this._plistObject = PropertyList.createFromString(this.encodedString());
|
||||
if (!this._serializedPropertyList)
|
||||
this._serializedPropertyList = PropertyList.propertyListFromString(this.encodedString());
|
||||
|
||||
return this._plistObject;
|
||||
return this._serializedPropertyList;
|
||||
}
|
||||
|
||||
Data.prototype.encodedString = function()
|
||||
@@ -23,7 +23,7 @@ Data.prototype.encodedString = function()
|
||||
var serializedPropertyList = this._serializedPropertyList;
|
||||
|
||||
if (this._serializedPropertyList)
|
||||
this._encodedString = PropertyList.createStringFromPropertyList(serializedPropertyList);
|
||||
this._encodedString = PropertyList.stringFromPropertyList(serializedPropertyList);
|
||||
|
||||
// Ideally we would convert these bytes or base64 into a string.
|
||||
// else if (this._bytes)
|
||||
|
||||
@@ -115,9 +115,11 @@ Executable.prototype.execute = function()
|
||||
|
||||
CONTEXT_BUNDLE = Bundle.bundleContainingPath(this.path());
|
||||
|
||||
this._function.apply(global, this.functionArguments());
|
||||
var result = this._function.apply(global, this.functionArguments());
|
||||
|
||||
CONTEXT_BUNDLE = oldContextBundle;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
Executable.prototype.code = function()
|
||||
|
||||
+24
-24
@@ -205,19 +205,19 @@ Preprocessor.prototype.accessors = function(tokens)
|
||||
value = true;
|
||||
|
||||
if (!IS_WORD(name))
|
||||
objj_exception_throw(new objj_exception(OBJJParseException, this.error_message("*** @property attribute name not valid.")));
|
||||
throw new SyntaxError(this.error_message("*** @property attribute name not valid."));
|
||||
|
||||
if ((token = tokens.skip_whitespace()) == TOKEN_EQUAL)
|
||||
{
|
||||
value = tokens.skip_whitespace();
|
||||
|
||||
if (!IS_WORD(value))
|
||||
objj_exception_throw(new objj_exception(OBJJParseException, this.error_message("*** @property attribute value not valid.")));
|
||||
throw new SyntaxError(this.error_message("*** @property attribute value not valid."));
|
||||
|
||||
if (name == "setter")
|
||||
{
|
||||
if ((token = tokens.next()) != TOKEN_COLON)
|
||||
objj_exception_throw(new objj_exception(OBJJParseException, this.error_message("*** @property setter attribute requires argument with \":\" at end of selector name.")));
|
||||
throw new SyntaxError(this.error_message("*** @property setter attribute requires argument with \":\" at end of selector name."));
|
||||
|
||||
value += ":";
|
||||
}
|
||||
@@ -231,7 +231,7 @@ Preprocessor.prototype.accessors = function(tokens)
|
||||
break;
|
||||
|
||||
if (token != TOKEN_COMMA)
|
||||
objj_exception_throw(new objj_exception(OBJJParseException, this.error_message("*** Expected ',' or ')' in @property attribute list.")));
|
||||
throw new SyntaxError(this.error_message("*** Expected ',' or ')' in @property attribute list."));
|
||||
}
|
||||
|
||||
return attributes;
|
||||
@@ -342,7 +342,7 @@ Preprocessor.prototype.implementation = function(tokens, /*StringBuffer*/ aStrin
|
||||
class_methods = new StringBuffer();
|
||||
|
||||
if (!(/^\w/).test(class_name))
|
||||
objj_exception_throw(new objj_exception(OBJJParseException, this.error_message("*** Expected class name, found \"" + class_name + "\".")));
|
||||
throw new Error(this.error_message("*** Expected class name, found \"" + class_name + "\"."));
|
||||
|
||||
this._currentSuperClass = "objj_getClass(\"" + class_name + "\").super_class";
|
||||
this._currentSuperMetaClass = "objj_getMetaClass(\"" + class_name + "\").super_class";
|
||||
@@ -356,13 +356,13 @@ Preprocessor.prototype.implementation = function(tokens, /*StringBuffer*/ aStrin
|
||||
token = tokens.skip_whitespace();
|
||||
|
||||
if (token == TOKEN_CLOSE_PARENTHESIS)
|
||||
objj_exception_throw(new objj_exception(OBJJParseException, this.error_message("*** Can't Have Empty Category Name for class \"" + class_name + "\".")));
|
||||
throw new SyntaxError(this.error_message("*** Can't Have Empty Category Name for class \"" + class_name + "\"."));
|
||||
|
||||
if (tokens.skip_whitespace() != TOKEN_CLOSE_PARENTHESIS)
|
||||
objj_exception_throw(new objj_exception(OBJJParseException, this.error_message("*** Improper Category Definition for class \"" + class_name + "\".")));
|
||||
throw new SyntaxError(this.error_message("*** Improper Category Definition for class \"" + class_name + "\"."));
|
||||
|
||||
CONCAT(buffer, "{\nvar the_class = objj_getClass(\"" + class_name + "\")\n");
|
||||
CONCAT(buffer, "if(!the_class) objj_exception_throw(new objj_exception(OBJJClassNotFoundException, \"*** Could not find definition for class \\\"" + class_name + "\\\"\"));\n");
|
||||
CONCAT(buffer, "if(!the_class) throw new SyntaxError(\"*** Could not find definition for class \\\"" + class_name + "\\\"\");\n");
|
||||
CONCAT(buffer, "var meta_class = the_class.isa;");
|
||||
}
|
||||
else
|
||||
@@ -373,7 +373,7 @@ Preprocessor.prototype.implementation = function(tokens, /*StringBuffer*/ aStrin
|
||||
token = tokens.skip_whitespace();
|
||||
|
||||
if (!TOKEN_IDENTIFIER.test(token))
|
||||
objj_exception_throw(new objj_exception(OBJJParseException, this.error_message("*** Expected class name, found \"" + token + "\".")));
|
||||
throw new SyntaxError(this.error_message("*** Expected class name, found \"" + token + "\"."));
|
||||
|
||||
superclass_name = token;
|
||||
|
||||
@@ -421,14 +421,14 @@ Preprocessor.prototype.implementation = function(tokens, /*StringBuffer*/ aStrin
|
||||
|
||||
// If we have objects in our declaration, the user forgot a ';'.
|
||||
if (declaration.length)
|
||||
objj_exception_throw(new objj_exception(OBJJParseException, this.error_message("*** Expected ';' in ivar declaration, found '}'.")));
|
||||
throw new SytnaxError(this.error_message("*** Expected ';' in ivar declaration, found '}'."));
|
||||
|
||||
if (ivar_count)
|
||||
CONCAT(buffer, "]);\n");
|
||||
|
||||
if (!token)
|
||||
objj_exception_throw(new objj_exception(OBJJParseException, this.error_message("*** Expected '}'")));
|
||||
|
||||
throw new SyntaxError(this.error_message("*** Expected '}'"));
|
||||
|
||||
for (ivar_name in accessors)
|
||||
{
|
||||
var accessor = accessors[ivar_name],
|
||||
@@ -505,7 +505,7 @@ Preprocessor.prototype.implementation = function(tokens, /*StringBuffer*/ aStrin
|
||||
break;
|
||||
|
||||
else
|
||||
objj_exception_throw(new objj_exception(OBJJParseException, this.error_message("*** Expected \"@end\", found \"@" + token + "\".")));
|
||||
throw new SyntaxError(this.error_message("*** Expected \"@end\", found \"@" + token + "\"."));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -540,14 +540,14 @@ Preprocessor.prototype._import = function(tokens)
|
||||
path += token;
|
||||
|
||||
if(!token)
|
||||
objj_exception_throw(new objj_exception(OBJJParseException, this.error_message("*** Unterminated import statement.")));
|
||||
throw new SyntaxError(this.error_message("*** Unterminated import statement."));
|
||||
}
|
||||
|
||||
else if (token.charAt(0) == TOKEN_DOUBLE_QUOTE)
|
||||
path = token.substr(1, token.length - 2);
|
||||
|
||||
else
|
||||
objj_exception_throw(new objj_exception(OBJJParseException, this.error_message("*** Expecting '<' or '\"', found \"" + token + "\".")));
|
||||
throw new SyntaxError(this.error_message("*** Expecting '<' or '\"', found \"" + token + "\"."));
|
||||
|
||||
CONCAT(this._buffer, "objj_executeFile(\"");
|
||||
CONCAT(this._buffer, path);
|
||||
@@ -608,8 +608,8 @@ Preprocessor.prototype.method = function(/*Lexer*/ tokens)
|
||||
{
|
||||
// At this point, "..." MUST follow.
|
||||
if ((token = tokens.skip_whitespace()) != TOKEN_PERIOD || tokens.next() != TOKEN_PERIOD || tokens.next() != TOKEN_PERIOD)
|
||||
objj_exception_throw(new objj_exception(OBJJParseException, this.error_message("*** Argument list expected after ','.")));
|
||||
|
||||
throw new SyntaxError(this.error_message("*** Argument list expected after ','."));
|
||||
|
||||
// FIXME: Shouldn't allow any more after this.
|
||||
}
|
||||
|
||||
@@ -848,7 +848,7 @@ Preprocessor.prototype.preprocess = function(tokens, /*StringBuffer*/ aStringBuf
|
||||
|
||||
// If we get this far and we're parsing an objj_msgSend (or array), then we have a problem.
|
||||
if (tuple)
|
||||
objj_exception_throw(new objj_exception(OBJJParseException, this.error_message("*** Expected ']' - Unterminated message send or array.")));
|
||||
new SyntaxError(this.error_message("*** Expected ']' - Unterminated message send or array."));
|
||||
|
||||
if (!aStringBuffer)
|
||||
return buffer;
|
||||
@@ -862,14 +862,14 @@ Preprocessor.prototype.selector = function(tokens, aStringBuffer)
|
||||
|
||||
// Swallow open parenthesis.
|
||||
if (tokens.skip_whitespace() != TOKEN_OPEN_PARENTHESIS)
|
||||
objj_exception_throw(new objj_exception(OBJJParseException, this.error_message("*** Expected '('")));
|
||||
|
||||
throw new SyntaxError(this.error_message("*** Expected '('"));
|
||||
|
||||
// Eat leading whitespace
|
||||
var selector = tokens.skip_whitespace();
|
||||
|
||||
if (selector == TOKEN_CLOSE_PARENTHESIS)
|
||||
objj_exception_throw(new objj_exception(OBJJParseException, this.error_message("*** Unexpected ')', can't have empty @selector()")));
|
||||
|
||||
throw new SyntaxError(this.error_message("*** Unexpected ')', can't have empty @selector()"));
|
||||
|
||||
CONCAT(aStringBuffer, selector);
|
||||
|
||||
var token,
|
||||
@@ -884,9 +884,9 @@ Preprocessor.prototype.selector = function(tokens, aStringBuffer)
|
||||
if (tokens.skip_whitespace() == TOKEN_CLOSE_PARENTHESIS)
|
||||
break;
|
||||
else
|
||||
objj_exception_throw(new objj_exception(OBJJParseException, this.error_message("*** Unexpected whitespace in @selector().")));
|
||||
throw new SyntaxError(this.error_message("*** Unexpected whitespace in @selector()."));
|
||||
else
|
||||
objj_exception_throw(new objj_exception(OBJJParseException, this.error_message("*** Illegal character '" + token + "' in @selector().")));
|
||||
throw new SyntaxError(this.error_message("*** Illegal character '" + token + "' in @selector()."));
|
||||
}
|
||||
|
||||
CONCAT(buffer, token);
|
||||
|
||||
@@ -42,6 +42,23 @@ PropertyList.sniffedFormatOfString = function(/*String*/ aString)
|
||||
|
||||
// Serialization
|
||||
|
||||
PropertyList.dataFromPropertyList = function(/*PropertyList*/ aPropertyList, /*Format*/ aFormat)
|
||||
{
|
||||
return new Data(PropertyList.stringWithPropertyList(aPropertyList, aFormat));
|
||||
}
|
||||
|
||||
PropertyList.stringFromPropertyList = function(/*PropertyList*/ aPropertyList, /*Format*/ aFormat)
|
||||
{
|
||||
if (!aFormat)
|
||||
aFormat = PropertyList.Format280North_v1_0;
|
||||
|
||||
var serializers = PropertyListSerializers[aFormat];
|
||||
|
||||
return serializers["start"]() +
|
||||
serializePropertyList(aPropertyList, serializers) +
|
||||
serializers["finish"]();
|
||||
}
|
||||
|
||||
PropertyList.createDataWithFormat = function(/*Format*/ aFormat)
|
||||
{
|
||||
return new Data(PropertyList.createStringWithFormat(aFormat));
|
||||
|
||||
@@ -34,41 +34,41 @@
|
||||
var data = [[CPData alloc] initWithPlistObject:dict];
|
||||
[self assert:[data length] equals:93];
|
||||
|
||||
var data_cm = [CPData dataWithPlistObject:dict];
|
||||
var data_cm = [CPData serializedDataWithPlistObject:dict];
|
||||
[self assert:[data length] equals:93];
|
||||
}
|
||||
|
||||
-(void)testDescription
|
||||
{
|
||||
[self assert:[string_data description] equals:[string_data string]];
|
||||
[self assert:[string_data description] equals:[string_data encodedString]];
|
||||
}
|
||||
|
||||
-(void)testString
|
||||
{
|
||||
[self assert:[string_data string] equals:@"CPData Test"];
|
||||
[self assert:[string_data encodedString] equals:@"CPData Test"];
|
||||
}
|
||||
|
||||
-(void)testStringFromPlist
|
||||
{
|
||||
[self assert:[plist_data string] equals:"280NPLIST;1.0;D;K;4;key4f;3;8.8K;4;key3f;3;9.9K;4;key2F;K;4;key1S;22;Some random charactersE;"];
|
||||
[self assert:[plist_data encodedString] equals:"280NPLIST;1.0;D;K;4;key4f;3;8.8K;4;key3f;3;9.9K;4;key2F;K;4;key1S;22;Some random charactersE;"];
|
||||
}
|
||||
|
||||
-(void)testPlistObject
|
||||
{
|
||||
[self assert:[[plist_data plistObject] objectForKey:@"key1"] equals:@"Some random characters"];
|
||||
[self assert:[[plist_data plistObject] objectForKey:@"key2"] equals:[CPNumber numberWithBool:NO]];
|
||||
[self assert:[[plist_data plistObject] objectForKey:@"key3"] equals:[CPNumber numberWithDouble:9.9]];
|
||||
[self assert:[[plist_data plistObject] objectForKey:@"key4"] equals:[CPNumber numberWithDouble:8.8]];
|
||||
[self assert:[[plist_data serializedPlistObject] objectForKey:@"key1"] equals:@"Some random characters"];
|
||||
[self assert:[[plist_data serializedPlistObject] objectForKey:@"key2"] equals:[CPNumber numberWithBool:NO]];
|
||||
[self assert:[[plist_data serializedPlistObject] objectForKey:@"key3"] equals:[CPNumber numberWithDouble:9.9]];
|
||||
[self assert:[[plist_data serializedPlistObject] objectForKey:@"key4"] equals:[CPNumber numberWithDouble:8.8]];
|
||||
|
||||
[self assert:[plist_data plistObject] equals:dict];
|
||||
[self assert:[plist_data serializedPlistObject] equals:dict];
|
||||
}
|
||||
|
||||
-(void)testSetPlistObject
|
||||
{
|
||||
var data = [[CPData alloc] init];
|
||||
[data setPlistObject:dict];
|
||||
[data setSerializedPlistObject:dict];
|
||||
|
||||
[self assert:[data plistObject] equals:dict];
|
||||
[self assert:[data serializedPlistObject] equals:dict];
|
||||
}
|
||||
|
||||
-(void)testSetString
|
||||
@@ -76,7 +76,7 @@
|
||||
var data = [[CPData alloc] init];
|
||||
[data setString:@"CPData Test"];
|
||||
|
||||
[self assert:[data string] equals:@"CPData Test"];
|
||||
[self assert:[data encodedString] equals:@"CPData Test"];
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -87,7 +87,7 @@ ConverterConversionException = @"ConverterConversionException";
|
||||
if (![outputPath length])
|
||||
outputPath = inputPath.substr(0, inputPath.length - FILE.extension(inputPath).length) + ".cib";
|
||||
|
||||
FILE.write(outputPath, [convertedData string], { charset:"UTF-8" });
|
||||
FILE.write(outputPath, [convertedData encodedString], { charset:"UTF-8" });
|
||||
}
|
||||
catch(anException)
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user