#include <iostream>

#include "moz.h"
#include "nsexception.h"

using namespace std;

class Foo {
public:
  NS_IMETHOD test();
};

#define WRAPPER(x) x

WRAPPER(nsresult) whoops() {
  return NS_ERROR_OUT_OF_MEMORY;
}

NS_IMETHODIMP
Foo::test() {
  if (1) {
    return whoops();
  }
  return NS_OK;
}

int main(int argc, char **argv) {
  Foo f;
  nsresult rv = f.test();
  if (NS_FAILED(rv)) {
    cerr << argv[0] << ": got error =D" << endl;
    return 0;
  } 
  
  cerr << "error was expected" << endl;
  return 1;
}
