100 lines
3.8 KiB
HTML
100 lines
3.8 KiB
HTML
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
|
<html>
|
|
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
|
<title>JsUnit StackTrace Tests</title>
|
|
<link rel="stylesheet" type="text/css" href="../css/jsUnitStyle.css">
|
|
<script language="JavaScript" type="text/javascript" src="../app/jsUnitCore.js"></script>
|
|
|
|
<script language="JavaScript" type="text/javascript">
|
|
|
|
function testStackTrace() {
|
|
doStackTraceTest(3, "testStackTrace");
|
|
}
|
|
|
|
function doStackTraceTest(numberLeft, testFunctionName) {
|
|
if (numberLeft > 0) {
|
|
doStackTraceTest(numberLeft - 1, testFunctionName);
|
|
return;
|
|
}
|
|
assertEquals("> doStackTraceTest\n> doStackTraceTest\n> doStackTraceTest\n> doStackTraceTest\n> " + testFunctionName + "\n", getStackTrace());
|
|
}
|
|
|
|
function testJsUnitTestSuiteClass() {
|
|
var aSuite = new top.jsUnitTestSuite();
|
|
aSuite.addTestPage("foo.html");
|
|
aSuite.addTestPage("bar.html");
|
|
assertEquals(2, aSuite.testPages.length);
|
|
assertEquals("foo.html", aSuite.testPages[0]);
|
|
assertEquals("bar.html", aSuite.testPages[1]);
|
|
var anotherSuite = new top.jsUnitTestSuite();
|
|
anotherSuite.addTestPage("foo2.html");
|
|
anotherSuite.addTestPage("bar2.html");
|
|
aSuite.addTestSuite(anotherSuite);
|
|
assertEquals(4, aSuite.testPages.length);
|
|
assertEquals("foo.html", aSuite.testPages[0]);
|
|
assertEquals("bar.html", aSuite.testPages[1]);
|
|
assertEquals("foo2.html", aSuite.testPages[2]);
|
|
assertEquals("bar2.html", aSuite.testPages[3]);
|
|
}
|
|
|
|
function testTracing() {
|
|
warn("This is warning 1", "foo");
|
|
warn("This is warning 2");
|
|
inform("This is info 1", "foo");
|
|
inform("This is info 2");
|
|
debug("This is debug 1", "foo");
|
|
debug("This is debug 2");
|
|
info("This is info 3", "foo");
|
|
info("This is info 4");
|
|
}
|
|
|
|
function testTracingWithUndefinedValue() {
|
|
inform(JSUNIT_UNDEFINED_VALUE);
|
|
inform("JSUNIT_UNDEFINED_VALUE", JSUNIT_UNDEFINED_VALUE);
|
|
}
|
|
|
|
function testTraceLevel() {
|
|
var levelA = new top.JsUnitTraceLevel(100, "foo");
|
|
var levelB = new top.JsUnitTraceLevel(200, "bar");
|
|
var levelC = new top.JsUnitTraceLevel(300, "foobar");
|
|
assertFalse(levelA.matches(levelB));
|
|
assertTrue(levelB.matches(levelB));
|
|
assertTrue(levelC.matches(levelB));
|
|
assertEquals("bar", levelB.getColor());
|
|
}
|
|
|
|
function testDisplayStringForNumber() {
|
|
assertEquals("<3> (Number)", _displayStringForValue(3));
|
|
}
|
|
|
|
function testDisplayStringForString() {
|
|
assertEquals("<foo> (String)", _displayStringForValue("foo"));
|
|
}
|
|
|
|
function testDisplayStringForNull() {
|
|
assertEquals("<null>", _displayStringForValue(null));
|
|
}
|
|
|
|
function testDisplayStringForUndefined() {
|
|
assertEquals("<undefined>", _displayStringForValue(JSUNIT_UNDEFINED_VALUE));
|
|
}
|
|
|
|
function testDisplayStringForArray() {
|
|
var anArray = new Array();
|
|
anArray[0] = "foo";
|
|
anArray[1] = "bar";
|
|
assertEquals("<foo,bar> (Array)", _displayStringForValue(anArray));
|
|
}
|
|
|
|
</script>
|
|
</head>
|
|
|
|
<body>
|
|
<h1>JsUnit Utility Tests</h1>
|
|
|
|
<p>This page contains tests for the JsUnit framework uses. To see them, take a look at the source.</p>
|
|
</body>
|
|
</html>
|