File: example4.m

package info (click to toggle)
gnustep-make 2.9.3-7
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 3,676 kB
  • sloc: sh: 4,577; objc: 1,031; perl: 453; makefile: 56
file content (30 lines) | stat: -rw-r--r-- 749 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#import	"Testing.h"

/* A fourth test ... testing for an exception.
 *
 * If you run the test with 'gnustep-tests example4.m' it should
 * report three test passes.
 */

/* Import a header because we want to use a method from it.
 */
#import	<Foundation/NSDictionary.h>

int
main()
{
  START_SET("example set")

  /* We test for the code fragment raising an exception.  We don't care
   * about the particular exception, so we pass nil as the expected exception
   * name.
   */
  PASS_EXCEPTION([(NSDictionary*)@"abc" objectForKey: @"xxx"], nil,
    "sending a bad message causes an exception")
  pass(1 == 1, "integer equality works");
  PASS([[NSObject new] autorelease] != nil, "+new creates an object")

  END_SET("example set")

  return 0;
}