[Pydev-cvs] org.python.pydev.parser/tests/org/python/pydev/parser/fastparser FastParserTest.java,
Brought to you by:
fabioz
From: Fabio Z. <fa...@us...> - 2008-05-03 13:37:34
|
Update of /cvsroot/pydev/org.python.pydev.parser/tests/org/python/pydev/parser/fastparser In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12840/tests/org/python/pydev/parser/fastparser Modified Files: FastParserTest.java Log Message: Previous/next method could match 'class' and 'def' on invalid location Index: FastParserTest.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.parser/tests/org/python/pydev/parser/fastparser/FastParserTest.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** FastParserTest.java 23 Feb 2008 18:58:15 -0000 1.1 --- FastParserTest.java 3 May 2008 13:37:39 -0000 1.2 *************** *** 18,21 **** --- 18,34 ---- public class FastParserTest extends TestCase { + public static void main(String[] args) { + try { + FastParserTest test = new FastParserTest(); + test.setUp(); + test.testGettingClass3(); + test.tearDown(); + junit.textui.TestRunner.run(FastParserTest.class); + + } catch (Throwable e) { + e.printStackTrace(); + } + } + public void testGettingClassOrFunc() throws Exception { Document doc = new Document(); *************** *** 82,85 **** --- 95,146 ---- } + + public void testGettingClass2() throws Exception { + Document doc = new Document(); + doc.set("def GetClassesAndData():\n" + + " curr_widget_class = 10\n" + + "\n" + + "" + + ""); + + List<stmtType> all = FastParser.parseClassesAndFunctions(doc); + assertEquals(1, all.size()); + } + + public void testGettingClass3() throws Exception { + Document doc = new Document(); + doc.set("class A(object):\n" + + " curr_widget_class = 10\n" + + "\n" + + "" + + ""); + + List<stmtType> all = FastParser.parseClassesAndFunctions(doc); + assertEquals(1, all.size()); + } + + public void testGettingClass4() throws Exception { + Document doc = new Document(); + doc.set("\nclass A(object):\n" + + " curr_widget_class = 10\n" + + "\n" + + "" + + ""); + + List<stmtType> all = FastParser.parseClassesAndFunctions(doc); + assertEquals(1, all.size()); + } + + public void testGettingMethod() throws Exception { + Document doc = new Document(); + doc.set("def a():\n" + + " curr_widget_def = 10\n" + + "\n" + + "" + + ""); + + List<stmtType> all = FastParser.parseClassesAndFunctions(doc); + assertEquals(1, all.size()); + } private void check(List<stmtType> all, int position, int classBeginLine, int classBeginCol, int nameBeginLine, int nameBeginCol) { |