#include <stdio.h>

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

using namespace std;

nsresult test1() {
  return NS_OK;
}

nsresult test() {
  nsresult rv = test1();
  if (NS_SUCCEEDED(rv) && 1) {
    return NS_ERROR_FAILURE;
  }
  rv = test1();
  if (NS_SUCCEEDED(rv)) {
    return NS_ERROR_FAILURE;
  }
 
  return NS_OK;
}

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