Changeset 11801 for lang/objective-c

Show
Ignore:
Timestamp:
05/18/08 00:28:51 (6 months ago)
Author:
mootoh
Message:

activate Model save test case.

Location:
lang/objective-c/HatebuCoreData
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • lang/objective-c/HatebuCoreData/Bookmark.m

    r11714 r11801  
    1010 
    1111@implementation Bookmark 
    12 #if 0 
    13 - (void) awakeFromFetch { 
    14   NSLog(@"Bookmark#awakeFromFetch: %@", self); 
    15 } 
    16 #endif // 0 
    1712 
    1813- (void) willSave { 
    19   NSLog(@"Bookmark#willSave: %@", self); 
    2014  [self update]; 
    2115} 
    2216 
    2317-(void) update { 
    24   abort(); 
     18  NSAssert(NO, @"should not reach here (override this)"); 
    2519} 
    2620 
    2721@end 
     22// vim:set ft=objc: 
  • lang/objective-c/HatebuCoreData/BookmarkTest.m

    r11798 r11801  
    2828 
    2929-(void) testSetValue { 
    30   NSEntityDescription *entity = [NSEntityDescription 
    31     entityForName:@"Bookmark" 
    32     inManagedObjectContext:context_]; 
    33   STAssertNotNil(entity, @"Bookmark"); 
    34  
    35   Bookmark *b = [[NSManagedObject alloc] 
    36     initWithEntity:entity 
    37     insertIntoManagedObjectContext:context_]; 
    38  
    39   /* 
    40  
    41   Bookmark *b = [[NSManagedObject alloc] 
    42     initWithEntity:entity 
    43     insertIntoManagedObjectContext:[delegate_ managedObjectContext]]; 
    44   */ 
    45 #if 0 
    4630  NSManagedObject *b = [NSEntityDescription 
    4731    insertNewObjectForEntityForName:@"Bookmark" 
    4832             inManagedObjectContext:context_]; 
    4933 
    50  
    5134        STAssertNotNil(b, @"not nil", b); 
    5235        STAssertEquals(NO,[b isUpdated], @"updated should be initialized as NO", [b isUpdated]); 
    5336        [b setValue:@"testSetValue" forKey:@"title"]; 
     37 
     38  NSError *err = nil; 
     39  [context_ save:&err]; 
     40  STAssertNil(err, @"no error"); 
    5441        STAssertEquals(YES,[b isUpdated], @"updated should be changed to YES", [b isUpdated]); 
    55         [b release]; 
    56 #endif // 0 
    5742} 
    5843 
  • lang/objective-c/HatebuCoreData/FakeBookmark.m

    r11714 r11801  
    1111 
    1212@implementation Bookmark (Fake) 
     13 
    1314-(id) init { 
    1415  super; 
     
    1819 
    1920-(void) update { 
    20   NSLog(@"Bookmark(Fake)#update: %@", self); 
     21  NSLog(@"Bookmark(Fake)#update"); 
    2122  updated_ = YES; 
    2223}