vl4dimir / ObjectiveMixin

Ruby-like mixin functionality for Objective-C programs.
BSD 2-Clause "Simplified" License
217 stars 17 forks source link

Tests + doc for 'force' option #4

Closed dingbat closed 12 years ago

dingbat commented 12 years ago

By the way, I should say that testing can get tricky since just doing a Mixin once will affect the rest of the runtime, so the latter methods actually aren't testing much. For instance, in testNSObjectCategory:

- (void) testNSObjectCategory {
    DestinationClass* dest = [[[DestinationClass alloc] init] autorelease];
    // [dest mixinFrom:[SourceClass class]];

    [(id)dest helloWorld];
}

You can comment out the the third line and it'll still work since the classes have already been mixed in in previous tests.

I'm not sure how to solve this without making separate classes per test case. Or, writing a method to remove the effects of a mixin, but I can't see how that could be useful in normal use. Regardless, it's not a huge deal, just kind of cute. :)

vl4dimir commented 12 years ago

Yeah, you're right about that. But as you said, I guess it wouldn't be a problem in normal usage situations, just in tests.