Re: Unit Testing not displaying failed case text/line
Re: Unit Testing not displaying failed case text/line
- Subject: Re: Unit Testing not displaying failed case text/line
- From: "Sean McBride" <email@hidden>
- Date: Wed, 19 Mar 2008 13:07:56 -0400
- Organization: Rogue Research
On 3/19/08 10:34 AM, David Bainbridge said:
> STAssertEquals(0, [aNumber intValue],
> @"The number is not zero!",
> [aNumber intValue]);
It seems gcc is unable to generate a warning for this situation. Try this:
---START----num_args_test.m---------
#include <string.h>
#import <SenTestingKit/SenTestingKit.h>
int main (void)
{
printf ("blah", 1);
printf ("%d %d", 1);
printf ("%d %d", 1, 2, 3);
return 0;
}
@interface TestClass : SenTestCase
{
}
@end
@implementation TestClass
- (void) testSimple
{
NSNumber *aNumber = [NSNumber numberWithInt:4];
STAssertEquals(0, [aNumber intValue],
@"The number is not zero!", [aNumber intValue]);
}
@end
-----END------num_args_test.m---------
Then compile:
gcc -Wformat=2 -F/Developer/Library/Frameworks -framework SenTestingKit -
framework Foundation num_args_test.m
num_args_test.m: In function 'main':
num_args_test.m:6: warning: too many arguments for format
num_args_test.m:7: warning: too few arguments for format
num_args_test.m:8: warning: too many arguments for format
For printf(), it gives those handy warnings, but for STAssertEquals() it
does not. That's a real shame. I'd file a bug....
--
____________________________________________________________
Sean McBride, B. Eng email@hidden
Rogue Research www.rogue-research.com
Mac Software Developer Montréal, Québec, Canada
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden