Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Matcher template semantic issue #30

Closed
jeffremer opened this issue Feb 7, 2012 · 2 comments
Closed

Matcher template semantic issue #30

jeffremer opened this issue Feb 7, 2012 · 2 comments

Comments

@jeffremer
Copy link
Contributor

This may be a case of user error, however after setting up cedar in our iOS project and blank test projects from scratch half a dozen times I'm still here scratching my head as to why I can't get any of the matchers to work with object literals. I sent a message to the Google Group a couple weeks ago but noticed it hadn't been approved.

The issue is that if I pass in object literals like @strings or [NSNumber numberWithInt:2] to the equal or expect macros then the examples won't build. The errors usually look like this:

Semantic Issue
error: no matching function for call to 'equal' [3]

For example, here's a sample spec I set up in a blank project + cedar:

#import <Cedar-iOS/SpecHelper.h>

using namespace Cedar::Matchers;

SPEC_BEGIN(ExampleSpec)
describe(@"Example", ^{
    it(@"should compare scalars", ^{
        expect(1+1).to(equal(2));
    });

    it(@"should compare objects", ^{
        // Works fine
        NSString* aString = @"something";
        expect(aString).to(equal(aString));

        // Works fine
        NSString* bString = @"something";
        expect(aString).to(equal(bString));

        // Semantic Issue
        // error: no matching function for call to 'equal' [3]
        expect(aString).to(equal(@"something"));        

        // Semantic Issue
        // error: no matching function for call to 'equal' [3]
        NSNumber *two = [NSNumber numberWithInt:(1+1)];
        expect([NSNumber numberWithInt:(1+1)]).to(equal([NSNumber numberWithInt:(2)]));        
    });
});
SPEC_END

I've detailed the exact setup instructions I've taken along with code and screenshots in this gist: https://gist.github.com/1691576

I've tried to get the target settings to match the Cedar iPhoneSpecs target settings, but still no joy. Any ideas?

@cppforlife
Copy link
Contributor

Hey Jeff. ARC and Cedar are not very friendly to each other as of now. We are slowly moving towards Cedar being compatible with ARC; however, there are couple of issues that remain unsolved. Problem you're experiencing is one of those issues. If you turn off ARC you should be able to run above spec successfully.

@jeffremer
Copy link
Contributor Author

Thanks for the update Dmitriy. I'd been following issue #20 so when I saw that was closed I thought Cedar was fully ARC compatible now. But like you said, it seems to work fine without ARC.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants