Package br.com.caelum.tubaina.parser.latex

Source Code of br.com.caelum.tubaina.parser.latex.CodeHighlightTagTest

package br.com.caelum.tubaina.parser.latex;

import java.util.Arrays;
import java.util.Collections;

import junit.framework.Assert;

import org.junit.Test;

import br.com.caelum.tubaina.parser.CodeHighlightTag;


public class CodeHighlightTagTest {

  @Test
  public void testHighlight() throws Exception {
    String string = "Primeira linha\n" +
      "Segunda linha\n" +
      "Terceira linha\n" +
      "Quarta linha";
    String output = new CodeHighlightTag().parseLatex(string, Arrays.asList(1, 3));
    System.out.println(output);
    Assert.assertEquals("\\colorbox{yellow}{\\renewcommand{\\verb}[1]{#1}Primeira linha}\\\\\n" +
        "Segunda linha\n" +
        "\\colorbox{yellow}{\\renewcommand{\\verb}[1]{#1}Terceira linha}\\\\\n" +
        "Quarta linha", output);
  }
 
  @Test
  public void testHighlightWithNullParams() throws Exception {
    String output = new CodeHighlightTag().parseLatex("", null);
    Assert.assertEquals("", output);
  }
 
  @Test
  public void testInvalidLineNumbers() throws Exception {
    String input = "Só uma linha";
    String output = new CodeHighlightTag().parseLatex(input, Collections.singletonList(23));
    Assert.assertEquals(input, output);
  }
}
TOP

Related Classes of br.com.caelum.tubaina.parser.latex.CodeHighlightTagTest

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.