#include <stdio.h>

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

using namespace std;

class Foo {
public:
  virtual nsresult test();
};

nsresult whoops() {
  return NS_ERROR_OUT_OF_MEMORY;
}

nsresult Foo::test() {
  nsresult return_rv = NS_OK;
  nsresult rv = whoops();
  if (NS_FAILED(rv)) {return_rv = rv;}
  return return_rv;
}

int main(int argc, char **argv) {
  Foo f;
  nsresult rv = f.test();
  if (NS_FAILED(rv)) {
    printf("%s: got error =D\n", argv[0]);
    return 0;
  } 

  printf("error was expected\n");
  return 1;
}
