cerr << "Cannot open testfile: " << gFileIO << endl;
fprintf(stderr, "Cannot open testfile: %s\n", gFileIO);
nsresult testURL(const char* i_pURL, PRInt32 urlFactory = URL_FACTORY_DEFAULT){    if (i_pURL)        return writeout(i_pURL, urlFactory);    if (!gFileIO)        return NS_ERROR_FAILURE;    ifstream testfile(gFileIO);    if (!testfile)     {        cerr << "Cannot open testfile: " << gFileIO << endl;        return NS_ERROR_FAILURE;    }    char temp[512];    int count=0;    int failed=0;    char* prevResult = nsnull;    char* tempurl = nsnull;    while (testfile.getline(temp,512))    {        if (*temp == '#' || !*temp)            continue;        if (0 == count%3)        {            if (prevResult) delete[] prevResult;            cout << "Testing:  " << temp << endl;            writeoutto(temp, &prevResult, urlFactory);        }        else if (1 == count%3) {            if (tempurl) delete[] tempurl;            tempurl = nsCRT::strdup(temp);        } else {             if (!prevResult)                cout << "no results to compare to!" << endl;            else             {                PRInt32 res;                cout << "Result:   " << prevResult << endl;                if (urlFactory != URL_FACTORY_DEFAULT) {                    cout << "Expected: " << tempurl << endl;                    res = PL_strcmp(tempurl, prevResult);                } else {                    cout << "Expected: " << temp << endl;                    res = PL_strcmp(temp, prevResult);                }                if (res == 0)                    cout << "\tPASSED" << endl << endl;                else                 {                    cout << "\tFAILED" << endl << endl;                    failed++;                }            }        }        count++;    }    if (failed>0) {        cout << failed << " tests FAILED out of " << count/3 << endl;        return NS_ERROR_FAILURE;    } else {        cout << "All " << count/3 << " tests PASSED." << endl;        return NS_OK;    }}