rem: switch (expected) { case EXPECTED_PASS: if (!test_passed) result += "UNEXPECTED "; break; case EXPECTED_FAIL: if (test_passed) result += "UNEXPECTED "; break; case EXPECTED_RANDOM: result += "(RESULT EXPECTED TO BE RANDOM) " break; } if (test_passed) { result += "PASS: "; } else { result += "FAIL: "; } 
add:  var outputs = {}; const randomMsg = " (RESULT EXPECTED TO BE RANDOM)"; outputs[EXPECTED_PASS] = {true: "PASS", false: "UNEXPECTED FAIL"}; outputs[EXPECTED_FAIL] = {true: "UNEXPECTED PASS", false: "KNOWN FAIL"}; outputs[EXPECTED_RANDOM] = {true: "PASS" + randomMsg, false: "KNOWN FAIL" + randomMsg};  var result = "REFTEST " + outputs[expected][test_passed] + ": "; 
context: function DocumentLoaded(){    var key = IFrameToKey();    switch (gState) {        case 1:            gPart1Key = key;            StartCurrentURI(2);            break;        case 2:            var equal = (key == gPart1Key);            var result = "REFTEST ";            var test_passed = (equal == gURLs[0].equal);            var expected = gURLs[0].expected;            switch (expected) {                case EXPECTED_PASS:                    if (!test_passed) result += "UNEXPECTED ";                    break;                case EXPECTED_FAIL:                    if (test_passed) result += "UNEXPECTED ";                    break;                case EXPECTED_RANDOM:                    result += "(RESULT EXPECTED TO BE RANDOM) "                    break;            }            if (test_passed) {                result += "PASS: ";            } else {                result += "FAIL: ";            }            if (!gURLs[0].equal) {                result += "(!=) ";            }            result += gURLs[0].url1.spec;            dump(result + "\n");            if (!test_passed && expected == EXPECTED_PASS) {                dump("REFTEST   IMAGE 1 (TEST): " + gPart1Key + "\n");                dump("REFTEST   IMAGE 2 (REFERENCE): " + key + "\n");            }            gPart1Key = undefined;            gURLs.shift();            StartCurrentTest();            break;        default:            throw "Unexpected state."    }}
meta: 8395	/local1/tlutelli/issta_data/temp/all_js/javascript/2007_temp/2007/8395/2dae1140d81ddd4f1633fd6ae2f2b2ffd31232bd/reftest.js/buggy/layout/tools/reftest/reftest.js