• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Unit Testing not displaying failed case text/line
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

References: 
 >Unit Testing not displaying failed case text/line (From: David Bainbridge <email@hidden>)

  • Prev by Date: Re: Trying to embed Ruby - How are frameworks discovered
  • Next by Date: Re: Trying to embed Ruby - How are frameworks discovered
  • Previous by thread: Re: Unit Testing not displaying failed case text/line
  • Next by thread: Trying to embed Ruby - How are frameworks discovered
  • Index(es):
    • Date
    • Thread