[Pydev-cvs] org.python.pydev.core/tests/org/python/pydev/core/docutils StringUtilsTest.java, 1.5,
Brought to you by:
fabioz
From: Fabio Z. <fa...@us...> - 2008-09-27 19:58:27
|
Update of /cvsroot/pydev/org.python.pydev.core/tests/org/python/pydev/core/docutils In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19948/tests/org/python/pydev/core/docutils Modified Files: StringUtilsTest.java DocUtilsTest.java ParsingUtilsTest.java Log Message: Synching to latest changes: Pydev <ul> <li><strong>Editor</strong>: Cursor settings no longer overridden</li> <li><strong>Code-completion</strong>: If __all__ is defined with runtime elements (and not only in a single assign statement), it's ignored for code-completion purposes</li> <li><strong>Debugger</strong>: Pythonpath the same in debug and regular modes (sys.path[0] is the same directory as the file run)</li> <li><strong>Debugger</strong>: Persist choices done in the debugger when files from the debugger are not found</li> <li><strong>Interpreter config</strong>: "email" automatically added to the "forced builtins"</li> <li><strong>Parser</strong>: Correctly recognizing absolute import with 3 or more levels</li> <li><strong>Syntax check</strong>: Option to do only on active editor</li> </ul> Also: tabs changed for spaces Index: StringUtilsTest.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.core/tests/org/python/pydev/core/docutils/StringUtilsTest.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** StringUtilsTest.java 15 Sep 2007 18:48:22 -0000 1.5 --- StringUtilsTest.java 27 Sep 2008 19:57:34 -0000 1.6 *************** *** 28,37 **** public void testReplaceAllSlashes() throws Exception { ! assertEquals("foo", StringUtils.replaceAllSlashes("foo")); ! assertEquals("foo/", StringUtils.replaceAllSlashes("foo\\")); ! assertEquals("/foo/", StringUtils.replaceAllSlashes("\\foo\\")); ! assertEquals("/foo///", StringUtils.replaceAllSlashes("\\foo\\\\\\")); ! ! } public void testReplaceAll() throws Exception { --- 28,37 ---- public void testReplaceAllSlashes() throws Exception { ! assertEquals("foo", StringUtils.replaceAllSlashes("foo")); ! assertEquals("foo/", StringUtils.replaceAllSlashes("foo\\")); ! assertEquals("/foo/", StringUtils.replaceAllSlashes("\\foo\\")); ! assertEquals("/foo///", StringUtils.replaceAllSlashes("\\foo\\\\\\")); ! ! } public void testReplaceAll() throws Exception { Index: DocUtilsTest.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.core/tests/org/python/pydev/core/docutils/DocUtilsTest.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** DocUtilsTest.java 6 Jul 2008 21:58:28 -0000 1.2 --- DocUtilsTest.java 27 Sep 2008 19:57:34 -0000 1.3 *************** *** 5,29 **** public class DocUtilsTest extends TestCase { ! public static void main(String[] args) { ! junit.textui.TestRunner.run(DocUtilsTest.class); ! } ! protected void setUp() throws Exception { ! super.setUp(); ! } ! protected void tearDown() throws Exception { ! super.tearDown(); ! } ! public void testPeer() throws Exception { ! assertEquals('(', DocUtils.getPeer(')')); ! assertEquals(')', DocUtils.getPeer('(')); ! ! assertEquals('{', DocUtils.getPeer('}')); ! assertEquals('}', DocUtils.getPeer('{')); ! ! assertEquals('[', DocUtils.getPeer(']')); ! assertEquals(']', DocUtils.getPeer('[')); ! } } --- 5,29 ---- public class DocUtilsTest extends TestCase { ! public static void main(String[] args) { ! junit.textui.TestRunner.run(DocUtilsTest.class); ! } ! protected void setUp() throws Exception { ! super.setUp(); ! } ! protected void tearDown() throws Exception { ! super.tearDown(); ! } ! public void testPeer() throws Exception { ! assertEquals('(', DocUtils.getPeer(')')); ! assertEquals(')', DocUtils.getPeer('(')); ! ! assertEquals('{', DocUtils.getPeer('}')); ! assertEquals('}', DocUtils.getPeer('{')); ! ! assertEquals('[', DocUtils.getPeer(']')); ! assertEquals(']', DocUtils.getPeer('[')); ! } } Index: ParsingUtilsTest.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.core/tests/org/python/pydev/core/docutils/ParsingUtilsTest.java,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** ParsingUtilsTest.java 19 Jul 2008 19:53:36 -0000 1.10 --- ParsingUtilsTest.java 27 Sep 2008 19:57:34 -0000 1.11 *************** *** 14,26 **** public static void main(String[] args) { ! try { ! ParsingUtilsTest test = new ParsingUtilsTest(); ! test.setUp(); ! test.testGetFlattenedLine2(); ! test.tearDown(); ! junit.textui.TestRunner.run(ParsingUtilsTest.class); ! } catch (Throwable e) { ! e.printStackTrace(); ! } } --- 14,26 ---- public static void main(String[] args) { ! try { ! ParsingUtilsTest test = new ParsingUtilsTest(); ! test.setUp(); ! test.testGetFlattenedLine2(); ! test.tearDown(); ! junit.textui.TestRunner.run(ParsingUtilsTest.class); ! } catch (Throwable e) { ! e.printStackTrace(); ! } } *************** *** 94,111 **** public void testIterator() throws Exception { ! String str = "" + ! "#c\n" + ! "'s'\n" + ! "pass\n" + ! ""; ! Document d = new Document(str); ! Iterator<String> it = ParsingUtils.getNoLiteralsOrCommentsIterator(d); ! assertEquals("\n",it.next()); ! assertEquals(true,it.hasNext()); ! assertEquals("\n",it.next()); ! assertEquals(true,it.hasNext()); ! assertEquals("pass\n",it.next()); ! assertEquals(false,it.hasNext()); ! } public void testGetFlattenedLine() throws Exception { --- 94,111 ---- public void testIterator() throws Exception { ! String str = "" + ! "#c\n" + ! "'s'\n" + ! "pass\n" + ! ""; ! Document d = new Document(str); ! Iterator<String> it = ParsingUtils.getNoLiteralsOrCommentsIterator(d); ! assertEquals("\n",it.next()); ! assertEquals(true,it.hasNext()); ! assertEquals("\n",it.next()); ! assertEquals(true,it.hasNext()); ! assertEquals("pass\n",it.next()); ! assertEquals(false,it.hasNext()); ! } public void testGetFlattenedLine() throws Exception { *************** *** 145,220 **** public void testIterator2() throws Exception { ! String str = "" + ! "#c\n" + ! "'s'" + ! ""; ! Document d = new Document(str); ! PyDocIterator it = (PyDocIterator) ParsingUtils.getNoLiteralsOrCommentsIterator(d); ! assertEquals(-1, it.getLastReturnedLine()); ! ! assertEquals("\n",it.next()); ! assertEquals(0, it.getLastReturnedLine()); ! assertEquals(true,it.hasNext()); ! ! assertEquals("",it.next()); ! assertEquals(1, it.getLastReturnedLine()); ! assertEquals(false,it.hasNext()); } public void testIterator3() throws Exception { ! String str = "" + ! "#c"; ! Document d = new Document(str); ! PyDocIterator it = (PyDocIterator) ParsingUtils.getNoLiteralsOrCommentsIterator(d); ! assertEquals(-1, it.getLastReturnedLine()); ! assertEquals(true,it.hasNext()); ! ! assertEquals("",it.next()); ! assertEquals(0, it.getLastReturnedLine()); ! assertEquals(false,it.hasNext()); } public void testIterator5() throws Exception { ! String str = "" + ! "class Foo:\n" + ! " '''\n" + ! " \"\n"+ ! " b\n"+ ! " '''a\n"+ ! " pass\n"+ ! "\n"; ! Document d = new Document(str); ! PyDocIterator it = new PyDocIterator(d, false, true, true); ! assertEquals(-1, it.getLastReturnedLine()); ! assertEquals(true,it.hasNext()); ! ! assertEquals("class Foo:",it.next()); ! assertEquals(0, it.getLastReturnedLine()); ! assertEquals(true,it.hasNext()); ! ! assertEquals(" ",it.next()); ! assertEquals(1, it.getLastReturnedLine()); ! assertEquals(true,it.hasNext()); ! ! assertEquals(" ",it.next()); ! assertEquals(2, it.getLastReturnedLine()); ! assertEquals(true,it.hasNext()); ! ! assertEquals(" ",it.next()); ! assertEquals(3, it.getLastReturnedLine()); ! assertEquals(true,it.hasNext()); ! ! assertEquals(" a",it.next()); ! assertEquals(4, it.getLastReturnedLine()); ! assertEquals(true,it.hasNext()); ! ! assertEquals(" pass",it.next()); ! assertEquals(5, it.getLastReturnedLine()); ! assertEquals(true,it.hasNext()); ! ! assertEquals("",it.next()); ! assertEquals(6, it.getLastReturnedLine()); ! assertEquals(false,it.hasNext()); } --- 145,220 ---- public void testIterator2() throws Exception { ! String str = "" + ! "#c\n" + ! "'s'" + ! ""; ! Document d = new Document(str); ! PyDocIterator it = (PyDocIterator) ParsingUtils.getNoLiteralsOrCommentsIterator(d); ! assertEquals(-1, it.getLastReturnedLine()); ! ! assertEquals("\n",it.next()); ! assertEquals(0, it.getLastReturnedLine()); ! assertEquals(true,it.hasNext()); ! ! assertEquals("",it.next()); ! assertEquals(1, it.getLastReturnedLine()); ! assertEquals(false,it.hasNext()); } public void testIterator3() throws Exception { ! String str = "" + ! "#c"; ! Document d = new Document(str); ! PyDocIterator it = (PyDocIterator) ParsingUtils.getNoLiteralsOrCommentsIterator(d); ! assertEquals(-1, it.getLastReturnedLine()); ! assertEquals(true,it.hasNext()); ! ! assertEquals("",it.next()); ! assertEquals(0, it.getLastReturnedLine()); ! assertEquals(false,it.hasNext()); } public void testIterator5() throws Exception { ! String str = "" + ! "class Foo:\n" + ! " '''\n" + ! " \"\n"+ ! " b\n"+ ! " '''a\n"+ ! " pass\n"+ ! "\n"; ! Document d = new Document(str); ! PyDocIterator it = new PyDocIterator(d, false, true, true); ! assertEquals(-1, it.getLastReturnedLine()); ! assertEquals(true,it.hasNext()); ! ! assertEquals("class Foo:",it.next()); ! assertEquals(0, it.getLastReturnedLine()); ! assertEquals(true,it.hasNext()); ! ! assertEquals(" ",it.next()); ! assertEquals(1, it.getLastReturnedLine()); ! assertEquals(true,it.hasNext()); ! ! assertEquals(" ",it.next()); ! assertEquals(2, it.getLastReturnedLine()); ! assertEquals(true,it.hasNext()); ! ! assertEquals(" ",it.next()); ! assertEquals(3, it.getLastReturnedLine()); ! assertEquals(true,it.hasNext()); ! ! assertEquals(" a",it.next()); ! assertEquals(4, it.getLastReturnedLine()); ! assertEquals(true,it.hasNext()); ! ! assertEquals(" pass",it.next()); ! assertEquals(5, it.getLastReturnedLine()); ! assertEquals(true,it.hasNext()); ! ! assertEquals("",it.next()); ! assertEquals(6, it.getLastReturnedLine()); ! assertEquals(false,it.hasNext()); } *************** *** 222,305 **** public void testIterator7() throws Exception { ! String str = "" + ! "'''\n" + ! "\n" + ! "'''\n" + ! ""; ! Document d = new Document(str); ! PyDocIterator it = new PyDocIterator(d, false, true, true); ! ! assertEquals(" ",it.next()); ! assertEquals(0, it.getLastReturnedLine()); ! assertEquals(true,it.hasNext()); ! ! assertEquals("",it.next()); ! assertEquals(1, it.getLastReturnedLine()); ! assertEquals(true,it.hasNext()); ! ! assertEquals(" ",it.next()); ! assertEquals(2, it.getLastReturnedLine()); ! assertEquals(false,it.hasNext()); } public void testIterator6() throws Exception { ! String str = "" + ! "'''\n" + ! "\n" + ! "'''\n" + ! "class Foo:\n" + ! " '''\n" + ! " \"\n"+ ! " b\n"+ ! " '''a\n"+ ! " pass\n"+ ! " def m1(self):\n" + ! " '''\n" + ! " eueueueueue\n" + ! " '''\n" + ! "\n" + ! "\n"; ! Document d = new Document(str); ! PyDocIterator it = new PyDocIterator(d, false, true, true); ! assertEquals(-1, it.getLastReturnedLine()); ! assertEquals(true,it.hasNext()); ! for (int i = 0; i < d.getNumberOfLines()-1; i++) { ! it.next(); ! assertEquals(i, it.getLastReturnedLine()); ! if(i == d.getNumberOfLines()-2){ ! assertTrue("Failed at line:"+i,!it.hasNext()); ! ! }else{ ! assertTrue("Failed at line:"+i,it.hasNext()); ! } ! } } public void testIterator4() throws Exception { ! String str = "" + ! "pass\r" + ! "foo\n" + ! "bla\r\n" + ! "what"; ! Document d = new Document(str); ! PyDocIterator it = (PyDocIterator) ParsingUtils.getNoLiteralsOrCommentsIterator(d); ! assertEquals(-1, it.getLastReturnedLine()); ! assertEquals(true,it.hasNext()); ! ! assertEquals("pass\r",it.next()); ! assertEquals(0, it.getLastReturnedLine()); ! assertEquals(true,it.hasNext()); ! ! assertEquals("foo\n",it.next()); ! assertEquals(1, it.getLastReturnedLine()); ! assertEquals(true,it.hasNext()); ! ! assertEquals("bla\r\n",it.next()); ! assertEquals(2, it.getLastReturnedLine()); ! assertEquals(true,it.hasNext()); ! ! assertEquals("what",it.next()); ! assertEquals(3, it.getLastReturnedLine()); ! assertEquals(false,it.hasNext()); } --- 222,305 ---- public void testIterator7() throws Exception { ! String str = "" + ! "'''\n" + ! "\n" + ! "'''\n" + ! ""; ! Document d = new Document(str); ! PyDocIterator it = new PyDocIterator(d, false, true, true); ! ! assertEquals(" ",it.next()); ! assertEquals(0, it.getLastReturnedLine()); ! assertEquals(true,it.hasNext()); ! ! assertEquals("",it.next()); ! assertEquals(1, it.getLastReturnedLine()); ! assertEquals(true,it.hasNext()); ! ! assertEquals(" ",it.next()); ! assertEquals(2, it.getLastReturnedLine()); ! assertEquals(false,it.hasNext()); } public void testIterator6() throws Exception { ! String str = "" + ! "'''\n" + ! "\n" + ! "'''\n" + ! "class Foo:\n" + ! " '''\n" + ! " \"\n"+ ! " b\n"+ ! " '''a\n"+ ! " pass\n"+ ! " def m1(self):\n" + ! " '''\n" + ! " eueueueueue\n" + ! " '''\n" + ! "\n" + ! "\n"; ! Document d = new Document(str); ! PyDocIterator it = new PyDocIterator(d, false, true, true); ! assertEquals(-1, it.getLastReturnedLine()); ! assertEquals(true,it.hasNext()); ! for (int i = 0; i < d.getNumberOfLines()-1; i++) { ! it.next(); ! assertEquals(i, it.getLastReturnedLine()); ! if(i == d.getNumberOfLines()-2){ ! assertTrue("Failed at line:"+i,!it.hasNext()); ! ! }else{ ! assertTrue("Failed at line:"+i,it.hasNext()); ! } ! } } public void testIterator4() throws Exception { ! String str = "" + ! "pass\r" + ! "foo\n" + ! "bla\r\n" + ! "what"; ! Document d = new Document(str); ! PyDocIterator it = (PyDocIterator) ParsingUtils.getNoLiteralsOrCommentsIterator(d); ! assertEquals(-1, it.getLastReturnedLine()); ! assertEquals(true,it.hasNext()); ! ! assertEquals("pass\r",it.next()); ! assertEquals(0, it.getLastReturnedLine()); ! assertEquals(true,it.hasNext()); ! ! assertEquals("foo\n",it.next()); ! assertEquals(1, it.getLastReturnedLine()); ! assertEquals(true,it.hasNext()); ! ! assertEquals("bla\r\n",it.next()); ! assertEquals(2, it.getLastReturnedLine()); ! assertEquals(true,it.hasNext()); ! ! assertEquals("what",it.next()); ! assertEquals(3, it.getLastReturnedLine()); ! assertEquals(false,it.hasNext()); } |