mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-11-24 07:25:52 +00:00
CPNull valueForKey:X returns CPNull for any value of X, paralleling [nil valueForKey:X]. Verified against Cocoa through empirical testing.
This commit is contained in:
1 parent
0ec7d4cd9a
commit
068cdb9817
2 files changed
+42
No files matched your search
@@ -277,5 +277,14 @@ CPUnknownUserInfoKey = @"CPUnknownUserInfoKey";
|
||||
|
||||
@end
|
||||
|
||||
@implementation CPNull (KeyValueCoding)
|
||||
|
||||
- (id)valueForKey:(CPString)aKey
|
||||
{
|
||||
return self;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@import "CPKeyValueObserving.j"
|
||||
@import "CPArray+KVO.j"
|
||||
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
* CPKeyValueCodingTest.j
|
||||
* Foundation
|
||||
*
|
||||
* Created by Alexander Ljungberg.
|
||||
* Copyright 2010, WireLoad, LLC.
|
||||
*
|
||||
* 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
|
||||
*/
|
||||
|
||||
@implementation CPKeyValueCodingTest : OJTestCase
|
||||
{
|
||||
}
|
||||
|
||||
- (void)testCPNull
|
||||
{
|
||||
var nullObject = [CPNull null];
|
||||
[self assert:[CPNull null] equals:[nullObject valueForKey:@"a"] message:@"CPNull valueForKey:X returns nil"];
|
||||
}
|
||||
|
||||
@end
|
||||
Reference in new issue
Block a user