2
* Created on 16/07/2005
4
package org.python.pydev.parser.visitors;
6
import org.python.pydev.core.docutils.ParsingUtils;
8
import junit.framework.TestCase;
10
public class ParsingUtilsTest extends TestCase {
12
public static void main(String[] args) {
13
junit.textui.TestRunner.run(ParsingUtilsTest.class);
16
protected void setUp() throws Exception {
20
protected void tearDown() throws Exception {
24
public void testRemoveCommentsAndWhitespaces() {
25
String s = "a , b = 0,#ignore\n*args, **kwargs";
26
StringBuffer buf = new StringBuffer(s);
27
ParsingUtils.removeCommentsAndWhitespaces(buf);
28
assertEquals("a,b=0,*args,**kwargs", buf.toString());
31
public void testRemoveCommentsWhitespacesAndLiterals() {
33
"a , b = 0,#ignore\n" +
36
StringBuffer buf = new StringBuffer(s);
37
ParsingUtils.removeCommentsWhitespacesAndLiterals(buf);
38
assertEquals("a,b=0,*args,**kwargs", buf.toString());
41
"a , b = 0,#ignore\n" +
44
buf = new StringBuffer(s);
45
ParsingUtils.removeCommentsWhitespacesAndLiterals(buf);
46
assertEquals("a,b=0,*args,**kwargs", buf.toString());
49
"a , b = 0,#ignore\n" +
52
buf = new StringBuffer(s);
53
ParsingUtils.removeCommentsWhitespacesAndLiterals(buf);
54
assertEquals("a,b=0,*args,**kwargskeep", buf.toString());