Revision: 1740 http://svn.sourceforge.net/vexi/?rev=1740&view=rev Author: mkpg2 Date: 2007-03-18 06:03:28 -0700 (Sun, 18 Mar 2007)
Log Message: ----------- Development - refactoring debug tests Modified Paths: -------------- core/trunk/org.vexi.core/src_junit/test/core/shared/util.t core/trunk/org.vexi.debugclient/.project core/trunk/org.vexi.debugclient/src/org/vexi/debugclient/core/model.t core/trunk/org.vexi.debugclient/src/org/vexi/debugclient/core/server.t core/trunk/org.vexi.devl/.classpath core/trunk/org.vexi.devl/src_junit/test/debug/simple/TestSimple.java core/trunk/org.vexi.devl/src_junit/test/debug/simple/testStepOver.t core/trunk/org.vexi.devl/src_junit/test/debug/testclient.t core/trunk/org.vexi.devl/src_junit/test/debug/vars/TestVars.java core/trunk/org.vexi.devl/src_junit/test/debug/vars/shared.t core/trunk/org.vexi.devl/src_junit/test/debug/vars/testVars.t Modified: core/trunk/org.vexi.core/src_junit/test/core/shared/util.t =================================================================== --- core/trunk/org.vexi.core/src_junit/test/core/shared/util.t 2007-03-16 20:41:32 UTC (rev 1739) +++ core/trunk/org.vexi.core/src_junit/test/core/shared/util.t 2007-03-18 13:03:28 UTC (rev 1740) @@ -10,10 +10,14 @@ } }; - static.assertEquals = function(expected,actual){ + static.assertEquals = function(expected,actual,about){ if(expected !=actual){ - throw "Expected: '" + expected + "'\n" + + var msg = + "Expected: '" + expected + "'\n" + "Actual: '" + actual +"'"; + if(about!=null) + msg = about + "\n" + msg; + throw msg; } }; Modified: core/trunk/org.vexi.debugclient/.project =================================================================== --- core/trunk/org.vexi.debugclient/.project 2007-03-16 20:41:32 UTC (rev 1739) +++ core/trunk/org.vexi.debugclient/.project 2007-03-18 13:03:28 UTC (rev 1740) @@ -7,5 +7,6 @@ <buildSpec> </buildSpec> <natures> + <nature>org.vexi.vexidev.vexiNature</nature> </natures> </projectDescription> Modified: core/trunk/org.vexi.debugclient/src/org/vexi/debugclient/core/model.t =================================================================== --- core/trunk/org.vexi.debugclient/src/org/vexi/debugclient/core/model.t 2007-03-16 20:41:32 UTC (rev 1739) +++ core/trunk/org.vexi.debugclient/src/org/vexi/debugclient/core/model.t 2007-03-18 13:03:28 UTC (rev 1740) @@ -14,20 +14,28 @@ // Position of currently broken. Null otherwise static.breakPosition; // {srcName: xxxx, ln: n} + + static.vars; + /////// + // THREADS + /////// + // Array of pos in current thread + static.currentThread; + // Arrays (1 per thread) of arrays of positions + static.scheduledThreads = []; + static.sleepingThreads = []; + + + ////// + /// BREAKPOINTS + ////// static.breakPoints = {}; static.breakPointAdded; // Fired when bp added static.breakPointRemoved; // Fired when bp removed - - // Array of pos in current thread - static.currentThread; - // Arrays (1 per thread) of arrays of positions - static.scheduledThreads = []; - static.sleepingThreads = []; - static.setBreakPoint = function(srcName, ln){ var key = srcName +":"+ln; if(breakPoints[key]!=null) return; @@ -38,5 +46,7 @@ } }; + + <ui:box/> </vexi> \ No newline at end of file Modified: core/trunk/org.vexi.debugclient/src/org/vexi/debugclient/core/server.t =================================================================== --- core/trunk/org.vexi.debugclient/src/org/vexi/debugclient/core/server.t 2007-03-16 20:41:32 UTC (rev 1739) +++ core/trunk/org.vexi.debugclient/src/org/vexi/debugclient/core/server.t 2007-03-18 13:03:28 UTC (rev 1740) @@ -18,7 +18,7 @@ model..currentThread = r.currentThread; if(r.sleepingThreads!=null) model..sleepingThreads = r.sleepingThreads; if(r.scheduledThreads!=null) model..scheduledThreads = r.scheduledThreads; - + if(r.vars!=null)model..vars = r.vars; } static.start = function(serverFactory){ Modified: core/trunk/org.vexi.devl/.classpath =================================================================== --- core/trunk/org.vexi.devl/.classpath 2007-03-16 20:41:32 UTC (rev 1739) +++ core/trunk/org.vexi.devl/.classpath 2007-03-18 13:03:28 UTC (rev 1740) @@ -2,7 +2,7 @@ <classpath> <classpathentry kind="src" path="src"/> <classpathentry kind="src" path="src_gen"/> - <classpathentry kind="src" path="src_junit"/> + <classpathentry excluding="testold/debug/|testold/debug/simple/|testold/debug/thread/|testold/debug/vars/" kind="src" path="src_junit"/> <classpathentry combineaccessrules="false" kind="src" path="/org.ibex.js"/> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> <classpathentry kind="lib" path="lib/commons-codec-1.3.jar"/> Modified: core/trunk/org.vexi.devl/src_junit/test/debug/simple/TestSimple.java =================================================================== --- core/trunk/org.vexi.devl/src_junit/test/debug/simple/TestSimple.java 2007-03-16 20:41:32 UTC (rev 1739) +++ core/trunk/org.vexi.devl/src_junit/test/debug/simple/TestSimple.java 2007-03-18 13:03:28 UTC (rev 1740) @@ -1,11 +1,7 @@ package test.debug.simple; -import org.ibex.util.Log; - import junit.framework.Test; -import junit.framework.TestCase; import test.core.CoreTestSuite; -import test.core.linenumbering.TestLineNumbering; import test.debug.DebuggerTestSuite; public class TestSimple extends DebuggerTestSuite { Modified: core/trunk/org.vexi.devl/src_junit/test/debug/simple/testStepOver.t =================================================================== --- core/trunk/org.vexi.devl/src_junit/test/debug/simple/testStepOver.t 2007-03-16 20:41:32 UTC (rev 1739) +++ core/trunk/org.vexi.devl/src_junit/test/debug/simple/testStepOver.t 2007-03-18 13:03:28 UTC (rev 1740) @@ -2,7 +2,7 @@ static.runtest = function(){ tc..waitForHalt(); tc..assertPosition("main:2"); - tc..assertCallStack(["main:2"]); + tc..assertCurrentStack(["main:2"]); tc..stepOver(); tc..waitForHalt(); tc..assertPosition("main:4"); Modified: core/trunk/org.vexi.devl/src_junit/test/debug/testclient.t =================================================================== --- core/trunk/org.vexi.devl/src_junit/test/debug/testclient.t 2007-03-16 20:41:32 UTC (rev 1739) +++ core/trunk/org.vexi.devl/src_junit/test/debug/testclient.t 2007-03-18 13:03:28 UTC (rev 1740) @@ -112,5 +112,27 @@ } }; + static.assertVar = function(name, val, vartype){ + if(vartype==null)vartype = "primitive"; + var vs = model..vars; + for(var i=0; vs.length>i; i++){ + if(vs[i].name==name){ + if(val!=null).util..assertEquals(val,vs[i].value, "var " + name + " value incorrect"); + .util..assertEquals(vartype,vs[i].type, "var " + name + " vartype incorrect"); + return; + } + } + throw "No variable named " + name; + }; + + static.assertNoVar = function(name){ + var vs = model..vars; + for(var i=0; vs.length>i; i++){ + if(vs[i].name==name){ + throw "var " + name + " should not be defined"; + } + } + }; + <ui:box/> </vexi> Modified: core/trunk/org.vexi.devl/src_junit/test/debug/vars/TestVars.java =================================================================== --- core/trunk/org.vexi.devl/src_junit/test/debug/vars/TestVars.java 2007-03-16 20:41:32 UTC (rev 1739) +++ core/trunk/org.vexi.devl/src_junit/test/debug/vars/TestVars.java 2007-03-18 13:03:28 UTC (rev 1740) @@ -1,19 +1,24 @@ package test.debug.vars; +import junit.framework.Test; +import test.core.CoreTestSuite; import test.debug.DebuggerTestSuite; public class TestVars extends DebuggerTestSuite { - protected TestVars() { + public TestVars() { super(TestVars.class); } // Main method to just execute client (so server can be manually executed // as a debugable process. public static void main(String[] args) throws Exception { - new TestVars().run("testSwitchingThreads"); + new TestVars().run("testVars"); } + public static Test suite(){ + return CoreTestSuite.suite(new TestVars()); + } /////////// // TESTS Modified: core/trunk/org.vexi.devl/src_junit/test/debug/vars/shared.t =================================================================== --- core/trunk/org.vexi.devl/src_junit/test/debug/vars/shared.t 2007-03-16 20:41:32 UTC (rev 1739) +++ core/trunk/org.vexi.devl/src_junit/test/debug/vars/shared.t 2007-03-18 13:03:28 UTC (rev 1740) @@ -1,25 +1,22 @@ <vexi xmlns:ui="vexi://ui" xmlns:tc="testclient" xmlns:model="org.vexi.debugclient.core.model" xmlns=""> - - - /* - private void assertBeforeC(VarInfo vi){ - - vi.assertVar("a",new Integer(1)); - vi.assertVar("b","b"); - vi.assertVar("c",null, VARTYPE_FUNCTION); + + static.assertBeforeC = function(){ + tc..assertVar("a",1); + tc..assertVar("b","b"); + tc..assertVar("c","[main:7]","function"); // FEATURE - don't display uninitialized/undeclared variables somehow - vi.assertVar("f", null); //tc.assertNoVar("f"); - vi.assertNoVar("d"); - vi.assertNoVar("e"); + tc..assertVar("f", null, "null"); //tc.assertNoVar("f"); + tc..assertNoVar("d"); + tc..assertNoVar("e"); + }; + + static.assertInsideC = function(){ + tc..assertVar("a",1); + tc..assertVar("b","b"); + tc..assertVar("c","[main:7]", "function"); + tc..assertVar("d","d"); } - - private void assertInsideC(VarInfo vi){ - vi.assertVar("a",new Integer(1)); - vi.assertVar("b","b"); - vi.assertVar("c",null, VARTYPE_FUNCTION); - vi.assertVar("d","d"); - }*/ <ui:box/> </vexi> Modified: core/trunk/org.vexi.devl/src_junit/test/debug/vars/testVars.t =================================================================== --- core/trunk/org.vexi.devl/src_junit/test/debug/vars/testVars.t 2007-03-16 20:41:32 UTC (rev 1739) +++ core/trunk/org.vexi.devl/src_junit/test/debug/vars/testVars.t 2007-03-18 13:03:28 UTC (rev 1740) @@ -3,20 +3,38 @@ xmlns=""> static.runtest = function(){ tc..waitForHalt(); - tc..assertPosition("main:2"); - var x; - model..breakPointAdded ++=function(v){ - x = v.toString; - }; - tc..setBreakPoint("main", 7); - tc..assertBreakPoint("main:7"); - .util..assertEquals("main:7",x); - tc..resume(); - tc..waitForHalt(); - tc..assertPosition("main:7"); - tc..resume(); - tc..waitForStop(); + //tc.setBreakPoint("main", 17); + // Test start + tc..setBreakPoint("main", 12); + tc..resume();tc..waitForHalt(); + .shared..assertBeforeC(); + // Test within function + tc..setBreakPoint("main", 9); + tc..resume();tc..waitForHalt(); + .shared..assertInsideC(); + + // Test later + tc..setBreakPoint("main", 21); + tc..resume();tc..waitForHalt(); + tc..assertVar("a",1); + tc..assertVar("b","b"); + tc..assertVar("c",null, "function"); + tc..assertVar("f", 6); + + // Test in thread + tc..setBreakPoint("main", 17); + tc..resume();tc..waitForHalt(); + + tc..assertVar("a", 1); + tc..assertVar("b","b"); + tc..assertVar("c",null, "function"); + tc..assertVar("e","e"); + tc..assertNoVar("f"); + + + tc..resume();tc..waitForStop(); + }; <ui:box/> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ Vexi-svn mailing list Vexi-svn@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/vexi-svn