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

TypeDescriptor for aBoolProperty description test failing on 64-bit iOS #141

Closed
rhgills opened this issue Jan 2, 2014 · 2 comments
Closed
Labels

Comments

@rhgills
Copy link
Contributor

rhgills commented Jan 2, 2014

- (void)test_type_description_primitive
{
    TyphoonTypeDescriptor* descriptor = [self typeForPropertyWithName:@"aBoolProperty"];
    assertThatBool([descriptor isPrimitive], equalToBool(YES));
    assertThat([descriptor typeBeingDescribed], nilValue());
    assertThat([descriptor protocol], nilValue());
    assertThatBool([descriptor isArray], equalToBool(NO));
    assertThatInt([descriptor arrayLength], equalToInt(0));

    NSString* description = [descriptor description];
    // assertThat(description, equalTo(@"Type descriptor for primitive: 1"));
    // fails when running on iOS 64 bit simulator
}

On my machine, the description is instead: "Type descriptor for primitive: 13".

We should probably improve these descriptions, too. What is a 1, and what is a 13? Looking them up in the TyphoonPrimitiveType, 1 is char and 13 is boolean. Should we implement a TyphoonStringFromPrimitiveType function to map these numbers to a more human readable description?

@jasperblues
Copy link
Member

Yes, that would be good. . . (I think I planned to, and then never got time). . . . unfortunately the Objc runtime is not very helpful here.

@drodriguez
Copy link
Contributor

Fixed in 4eda11f.

Apple (or ARM) decided that BOOL in arm64 is typedef as bool/_Bool from C99 (while it is char in other archs). I simply created another descriptor which I know to be bool (using @encode), which gives us the right description and primitiveType.

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

No branches or pull requests

3 participants