|
From: Christopher W. <caw...@us...> - 2006-05-12 21:56:16
|
Update of /cvsroot/rubyeclipse/org.rubypeople.rdt.ui.tests/src/org/rubypeople/rdt/internal/ui/rubyeditor In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv3940/src/org/rubypeople/rdt/internal/ui/rubyeditor Modified Files: TS_InternalUiRubyEditor.java Added Files: TC_TabConverter.java Removed Files: TC_TabExpander.java Log Message: try to fix up the tests to compile (though they're still broken), add more tests for our partition scanner (needs to be integrated with our already existing tests) --- NEW FILE: TC_TabConverter.java --- package org.rubypeople.rdt.internal.ui.rubyeditor; import junit.framework.TestCase; import org.eclipse.jface.text.Document; import org.eclipse.jface.text.DocumentCommand; import org.rubypeople.rdt.internal.ui.rubyeditor.RubyEditor.TabConverter; public class TC_TabConverter extends TestCase { private static final String TEST_TEXT = "012345678\n123456789\n"; private static class TestDocumentCommand extends DocumentCommand { public TestDocumentCommand(int offset) { this.offset = offset; } } public void testSpacesForTab() { verifyTabExpansion(4, 0, 4); verifyTabExpansion(4, 1, 3); verifyTabExpansion(4, 2, 2); verifyTabExpansion(4, 3, 1); verifyTabExpansion(4, 4, 4); verifyTabExpansion(4, 5, 3); verifyTabExpansion(5, 4, 1); } public void testSubsequentLines() { verifyTabExpansion(4, 10, 4); verifyTabExpansion(4, 12, 2); verifyTabExpansion(4, 14, 4); } public void testSpacesOneSpacePerTab() { verifyTabExpansion(1, 0, 1); verifyTabExpansion(1, 1, 1); verifyTabExpansion(1, 2, 1); verifyTabExpansion(1, 3, 1); verifyTabExpansion(1, 4, 1); } public void testSpacesZeroSpacPerTab() { verifyTabExpansion(0, 0, 1); verifyTabExpansion(0, 1, 1); verifyTabExpansion(0, 2, 1); verifyTabExpansion(0, 3, 1); verifyTabExpansion(0, 4, 1); } private void verifyTabExpansion(int spacesPerTab, int currentOffset, int expectedCountOfTabs) { TabConverter converter = new TabConverter(); converter.setNumberOfSpacesPerTab(spacesPerTab); TestDocumentCommand command = new TestDocumentCommand(currentOffset); command.text = "\t"; Document document = new Document(TEST_TEXT); converter.customizeDocumentCommand(document, command); String message = "Offset = "+currentOffset + "; tabWidth = "+spacesPerTab; assertEquals(message, " ".substring(0,expectedCountOfTabs), command.text); // assertEquals("Full indent (" + spacesPerTab + ")", " ".substring(0,spacesPerTab), expander.getFullIndent()); } } Index: TS_InternalUiRubyEditor.java =================================================================== RCS file: /cvsroot/rubyeclipse/org.rubypeople.rdt.ui.tests/src/org/rubypeople/rdt/internal/ui/rubyeditor/TS_InternalUiRubyEditor.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** TS_InternalUiRubyEditor.java 16 Oct 2005 23:52:40 -0000 1.1 --- TS_InternalUiRubyEditor.java 12 May 2006 21:56:12 -0000 1.2 *************** *** 7,11 **** public static TestSuite suite() { TestSuite suite = new TestSuite("org.rubypeople.rdt.internal.ui.rubyeditor"); ! suite.addTestSuite(TC_TabExpander.class); return suite; } --- 7,11 ---- public static TestSuite suite() { TestSuite suite = new TestSuite("org.rubypeople.rdt.internal.ui.rubyeditor"); ! suite.addTestSuite(TC_TabConverter.class); return suite; } --- TC_TabExpander.java DELETED --- |