/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package org.codehaus.mojo.scmchangelog.changelog.log.grammar;

import junit.framework.TestCase;
import org.codehaus.mojo.scmchangelog.changelog.log.Message;
import org.codehaus.mojo.scmchangelog.changelog.log.ScmGrammar;

/**
 *
 * @author ehsavoie
 */
public class RemoveCommentsTest extends TestCase {
    private ScmGrammar grammar = new AbstractScmGrammar()
    {
        public Message extractMessage( String content )
        {
            throw new UnsupportedOperationException( "Not supported yet." );
        }

        public boolean hasMessage( String content )
        {
            throw new UnsupportedOperationException( "Not supported yet." );
        }

        public String getIssueSeparator()
        {
            throw new UnsupportedOperationException( "Not supported yet." );
        }
    };

    public void testRemoveSimpleComment()
    {
        String content = "Hello World /* Bonjour le Monde */ my friend";
        String result = grammar.removeComments( content );
        assertEquals( "Hello World  my friend", result );
    }

     public void testRemoveMultistarsComment()
    {
        String content = "Hello World /*** Bonjour le Monde ***/ my friend";
        String result = grammar.removeComments( content );
        assertEquals( "Hello World  my friend", result );
    }


    public void testRemoveMultipleComment()
    {
        String content = "Hello World /* Bonjour le Monde */ my friend /*mon ami*/";
        String result = grammar.removeComments( content );
        assertEquals( "Hello World  my friend ", result );
    }

    public void testRemoveNoComment()
    {
        String content = "Hello World my friend";
        String result = grammar.removeComments( content );
        assertEquals( "Hello World my friend", result );
    }

    public void testRemoveIncludedComments()
    {
        String content = "Hello World /* Bonjour le Monde /*mon ami*/   */my friend";
        String result = grammar.removeComments( content );
        assertEquals( "Hello World    */my friend", result );
    }
}

@@ -1084,32 +1084,33 @@
 ents( content );
+%0D
 %0A        assertE
@@ -1143,32 +1143,200 @@
 iend%22, result );
+%0D%0A      %0D%0A        content = %22Hello World /**/ my friend%22;%0A        result = grammar.removeComments( content );%0A        assertEquals( %22Hello World  my friend%22, result );%0A
 %0A    %7D%0A%0A     pub
@@ -1623,32 +1623,33 @@
 eComment()%0A    %7B
+%0D
 %0A        String 
@@ -1768,32 +1768,33 @@
 ents( content );
+%0D
 %0A        assertE
@@ -1828,32 +1828,33 @@
 end %22, result );
+%0D
 %0A    %7D%0A%0A    publ
@@ -2046,32 +2046,353 @@
 iend%22, result );
+%0D%0A      %0A        content = %22Hello World my friend*/%22;%0A        result = grammar.removeComments( content );%0A        assertEquals( %22Hello World my friend*/%22, result );%0A%0A        content = %22/*Hello World my friend%22;%0A        result = grammar.removeComments( content );%0A        assertEquals( %22/*Hello World my friend%22, result );
 %0A    %7D%0A%0A    publ

add some more nominal unit tests