r630 - in trunk/jrst/src/test: java/org/nuiton/jrst java/org/nuiton/jrst/bugs resources/bugs
Author: sletellier Date: 2011-11-29 18:40:40 +0100 (Tue, 29 Nov 2011) New Revision: 630 Url: http://nuiton.org/repositories/revision/jrst/630 Log: Clean and refactor all tests Added: trunk/jrst/src/test/java/org/nuiton/jrst/JRSTAbstractTest.java Modified: trunk/jrst/src/test/java/org/nuiton/jrst/AdvancedReaderTest.java trunk/jrst/src/test/java/org/nuiton/jrst/JRSTCompareDocutils.java trunk/jrst/src/test/java/org/nuiton/jrst/JRSTGeneratorTest.java trunk/jrst/src/test/java/org/nuiton/jrst/JRSTReaderTest.java trunk/jrst/src/test/java/org/nuiton/jrst/JRSTTest.java trunk/jrst/src/test/java/org/nuiton/jrst/bugs/AdmonitionTest.java trunk/jrst/src/test/java/org/nuiton/jrst/bugs/DirectiveTest.java trunk/jrst/src/test/java/org/nuiton/jrst/bugs/InfiniteLoopTest.java trunk/jrst/src/test/java/org/nuiton/jrst/bugs/OptionTest.java trunk/jrst/src/test/java/org/nuiton/jrst/bugs/TableTest.java trunk/jrst/src/test/java/org/nuiton/jrst/bugs/TextTest.java trunk/jrst/src/test/java/org/nuiton/jrst/bugs/TitlesTest.java trunk/jrst/src/test/resources/bugs/testAdminitionInList1787.rst trunk/jrst/src/test/resources/bugs/testOptionArgumentSize1788.rst Modified: trunk/jrst/src/test/java/org/nuiton/jrst/AdvancedReaderTest.java =================================================================== --- trunk/jrst/src/test/java/org/nuiton/jrst/AdvancedReaderTest.java 2011-11-29 17:40:02 UTC (rev 629) +++ trunk/jrst/src/test/java/org/nuiton/jrst/AdvancedReaderTest.java 2011-11-29 17:40:40 UTC (rev 630) @@ -33,7 +33,6 @@ import java.io.StringReader; import java.io.Writer; -import org.junit.Assert; import org.junit.Before; import org.junit.BeforeClass; import org.junit.Test; @@ -49,7 +48,7 @@ * Last update: $Date$ * by : $Author$ */ -public class AdvancedReaderTest { +public class AdvancedReaderTest extends JRSTAbstractTest { protected String text = "\t\t\n" + "1 toto tata tutu\n" + "2 toto tata tutu\n" + "3 toto tata tutu\n" + "4 toto tata tutu\n" @@ -74,9 +73,8 @@ */ @Before public void setUp() throws IOException { - file = File.createTempFile("test-AdvancedReader", ".txt"); - file.deleteOnExit(); - + file = getOutputTestFile("test-AdvancedReader.txt"); + Writer out = new BufferedWriter(new FileWriter(file)); out.write(text); out.close(); @@ -89,14 +87,14 @@ @Test public void testEof() throws IOException { AdvancedReader in = new AdvancedReader(new FileReader(file)); - Assert.assertFalse(in.eof()); + assertFalse(in.eof()); in.readAll(); - Assert.assertTrue(in.eof()); + assertTrue(in.eof()); in = new AdvancedReader(new StringReader(text)); - Assert.assertFalse(in.eof()); + assertFalse(in.eof()); in.readAll(); - Assert.assertTrue(in.eof()); + assertTrue(in.eof()); } /** @@ -110,14 +108,14 @@ AdvancedReader in = new AdvancedReader(new FileReader(file)); in.skipBlankLines(); String line = in.readLine(); - Assert.assertEquals("1 toto tata tutu", line); + assertEquals("1 toto tata tutu", line); } { AdvancedReader in = new AdvancedReader(new StringReader(text)); in.skipBlankLines(); String line = in.readLine(); - Assert.assertEquals("1 toto tata tutu", line); + assertEquals("1 toto tata tutu", line); } } @@ -130,19 +128,19 @@ { AdvancedReader in = new AdvancedReader(new FileReader(file)); String[] lines = in.readAll(); - Assert.assertEquals(10, lines.length); - Assert.assertEquals("\t\t", lines[0]); - Assert.assertEquals("1 toto tata tutu", lines[1]); - Assert.assertEquals("9 toto tata tutu", lines[9]); + assertEquals(10, lines.length); + assertEquals("\t\t", lines[0]); + assertEquals("1 toto tata tutu", lines[1]); + assertEquals("9 toto tata tutu", lines[9]); } { AdvancedReader in = new AdvancedReader(new StringReader(text)); String[] lines = in.readAll(); - Assert.assertEquals(10, lines.length); - Assert.assertEquals("\t\t", lines[0]); - Assert.assertEquals("1 toto tata tutu", lines[1]); - Assert.assertEquals("9 toto tata tutu", lines[9]); + assertEquals(10, lines.length); + assertEquals("\t\t", lines[0]); + assertEquals("1 toto tata tutu", lines[1]); + assertEquals("9 toto tata tutu", lines[9]); } } @@ -155,19 +153,19 @@ { AdvancedReader in = new AdvancedReader(new FileReader(file)); String[] lines = in.readLines(3); - Assert.assertEquals(3, lines.length); - Assert.assertEquals("\t\t", lines[0]); - Assert.assertEquals("1 toto tata tutu", lines[1]); - Assert.assertEquals("2 toto tata tutu", lines[2]); + assertEquals(3, lines.length); + assertEquals("\t\t", lines[0]); + assertEquals("1 toto tata tutu", lines[1]); + assertEquals("2 toto tata tutu", lines[2]); } { AdvancedReader in = new AdvancedReader(new StringReader(text)); String[] lines = in.readLines(3); - Assert.assertEquals(3, lines.length); - Assert.assertEquals("\t\t", lines[0]); - Assert.assertEquals("1 toto tata tutu", lines[1]); - Assert.assertEquals("2 toto tata tutu", lines[2]); + assertEquals(3, lines.length); + assertEquals("\t\t", lines[0]); + assertEquals("1 toto tata tutu", lines[1]); + assertEquals("2 toto tata tutu", lines[2]); } } @@ -181,25 +179,25 @@ { AdvancedReader in = new AdvancedReader(new FileReader(file)); String[] lines = in.readUntil("^3.*$"); - Assert.assertEquals(3, lines.length); - Assert.assertEquals("\t\t", lines[0]); - Assert.assertEquals("1 toto tata tutu", lines[1]); - Assert.assertEquals("2 toto tata tutu", lines[2]); + assertEquals(3, lines.length); + assertEquals("\t\t", lines[0]); + assertEquals("1 toto tata tutu", lines[1]); + assertEquals("2 toto tata tutu", lines[2]); String line = in.readLine(); - Assert.assertEquals("3 toto tata tutu", line); + assertEquals("3 toto tata tutu", line); } { AdvancedReader in = new AdvancedReader(new StringReader(text)); String[] lines = in.readUntil("^3.*$"); - Assert.assertEquals(3, lines.length); - Assert.assertEquals("\t\t", lines[0]); - Assert.assertEquals("1 toto tata tutu", lines[1]); - Assert.assertEquals("2 toto tata tutu", lines[2]); + assertEquals(3, lines.length); + assertEquals("\t\t", lines[0]); + assertEquals("1 toto tata tutu", lines[1]); + assertEquals("2 toto tata tutu", lines[2]); String line = in.readLine(); - Assert.assertEquals("3 toto tata tutu", line); + assertEquals("3 toto tata tutu", line); } } @@ -214,26 +212,26 @@ AdvancedReader in = new AdvancedReader(new FileReader(file)); in.skipBlankLines(); String[] lines = in.readWhile("^[123].*$"); - Assert.assertEquals(3, lines.length); - Assert.assertEquals("1 toto tata tutu", lines[0]); - Assert.assertEquals("2 toto tata tutu", lines[1]); - Assert.assertEquals("3 toto tata tutu", lines[2]); + assertEquals(3, lines.length); + assertEquals("1 toto tata tutu", lines[0]); + assertEquals("2 toto tata tutu", lines[1]); + assertEquals("3 toto tata tutu", lines[2]); String line = in.readLine(); - Assert.assertEquals("4 toto tata tutu", line); + assertEquals("4 toto tata tutu", line); } { AdvancedReader in = new AdvancedReader(new StringReader(text)); in.skipBlankLines(); String[] lines = in.readWhile("^[123].*$"); - Assert.assertEquals(3, lines.length); - Assert.assertEquals("1 toto tata tutu", lines[0]); - Assert.assertEquals("2 toto tata tutu", lines[1]); - Assert.assertEquals("3 toto tata tutu", lines[2]); + assertEquals(3, lines.length); + assertEquals("1 toto tata tutu", lines[0]); + assertEquals("2 toto tata tutu", lines[1]); + assertEquals("3 toto tata tutu", lines[2]); String line = in.readLine(); - Assert.assertEquals("4 toto tata tutu", line); + assertEquals("4 toto tata tutu", line); } } @@ -246,21 +244,21 @@ { AdvancedReader in = new AdvancedReader(new FileReader(file)); String line = in.readLine(); - Assert.assertEquals("\t\t", line); + assertEquals("\t\t", line); line = in.readLine(); - Assert.assertEquals("1 toto tata tutu", line); + assertEquals("1 toto tata tutu", line); line = in.readLine(); - Assert.assertEquals("2 toto tata tutu", line); + assertEquals("2 toto tata tutu", line); } { AdvancedReader in = new AdvancedReader(new StringReader(text)); String line = in.readLine(); - Assert.assertEquals("\t\t", line); + assertEquals("\t\t", line); line = in.readLine(); - Assert.assertEquals("1 toto tata tutu", line); + assertEquals("1 toto tata tutu", line); line = in.readLine(); - Assert.assertEquals("2 toto tata tutu", line); + assertEquals("2 toto tata tutu", line); } } @@ -270,31 +268,31 @@ String line = in.readLine(); in.mark(); line = in.readLine(); - Assert.assertEquals("1 toto tata tutu", line); + assertEquals("1 toto tata tutu", line); in.reset(); line = in.readLine(); - Assert.assertEquals("1 toto tata tutu", line); + assertEquals("1 toto tata tutu", line); } @Test public void testUnread() throws IOException { AdvancedReader in = new AdvancedReader(new StringReader(text)); - Assert.assertEquals(0, in.getCharNumber()); - Assert.assertEquals(0, in.getLineNumber()); + assertEquals(0, in.getCharNumber()); + assertEquals(0, in.getLineNumber()); String line = in.readLine(); - Assert.assertEquals(3, in.getCharNumber()); - Assert.assertEquals(1, in.getLineNumber()); + assertEquals(3, in.getCharNumber()); + assertEquals(1, in.getLineNumber()); line = in.readLine(); - Assert.assertEquals(4 + "1 toto tata tutu".length(), in.getCharNumber()); - Assert.assertEquals(2, in.getLineNumber()); - Assert.assertEquals("1 toto tata tutu", line); + assertEquals(4 + "1 toto tata tutu".length(), in.getCharNumber()); + assertEquals(2, in.getLineNumber()); + assertEquals("1 toto tata tutu", line); in.unread(line.length() + 1); - Assert.assertEquals(3, in.getCharNumber()); - Assert.assertEquals(1, in.getLineNumber()); + assertEquals(3, in.getCharNumber()); + assertEquals(1, in.getLineNumber()); line = in.readLine(); - Assert.assertEquals(4 + "1 toto tata tutu".length(), in.getCharNumber()); - Assert.assertEquals(2, in.getLineNumber()); - Assert.assertEquals("1 toto tata tutu", line); + assertEquals(4 + "1 toto tata tutu".length(), in.getCharNumber()); + assertEquals(2, in.getLineNumber()); + assertEquals("1 toto tata tutu", line); } @Test @@ -302,10 +300,10 @@ AdvancedReader in = new AdvancedReader(new StringReader(text)); in.skip(3); String line = in.readLine(); - Assert.assertEquals("1 toto tata tutu", line); + assertEquals("1 toto tata tutu", line); in.skip(text.length()); line = in.readLine(); - Assert.assertNull(line); + assertNull(line); } /** @@ -324,7 +322,7 @@ tmp = tmp.replaceAll("\r", "\r\n"); in = new AdvancedReader(new StringReader(tmp)); String[] linesRN = in.readAll(); - Assert.assertArrayEquals(linesN, linesR); - Assert.assertArrayEquals(linesN, linesRN); + assertArrayEquals(linesN, linesR); + assertArrayEquals(linesN, linesRN); } } Added: trunk/jrst/src/test/java/org/nuiton/jrst/JRSTAbstractTest.java =================================================================== --- trunk/jrst/src/test/java/org/nuiton/jrst/JRSTAbstractTest.java (rev 0) +++ trunk/jrst/src/test/java/org/nuiton/jrst/JRSTAbstractTest.java 2011-11-29 17:40:40 UTC (rev 630) @@ -0,0 +1,67 @@ +package org.nuiton.jrst; + +import org.junit.Assert; +import org.junit.BeforeClass; + +import java.io.File; +import java.io.IOException; +import java.io.InputStream; + +/** + * @author sletellier <letellier@codelutin.com> + */ +public class JRSTAbstractTest extends Assert { + + protected static File testWorkDir; + protected static File testResourcesDir; + + @BeforeClass + public static void initTest() throws IOException { + // get maven env basedir + String basedir = System.getenv("basedir"); + if (basedir == null) { + + // says basedir is where we start tests. + basedir = new File("").getAbsolutePath(); + } + File basedirFile = new File(basedir); + testWorkDir = new File(basedirFile, + "target" + File.separator + + "surefire-workdir"); + + boolean b = testWorkDir.exists() || testWorkDir.mkdirs(); + if (!b) { + throw new IOException( + "Could not create workdir directory " + testWorkDir); + } + + testResourcesDir = new File(basedirFile, + "src" + File.separator + + "test" + File.separator + + "resources" + File.separator); + } + + public static File getOutputTestFile(String fileName) throws IOException { + File file = new File(testWorkDir, fileName); + file.createNewFile(); + file.deleteOnExit(); + return file; + } + + public static String getOutputTestPath(String fileName) throws IOException { + File file = getOutputTestFile(fileName); + return file.getPath(); + } + + public static File getTestFile(String testName) { + return new File(testResourcesDir, testName); + } + + public static File getBugTestFile(String testName) { + return new File(testResourcesDir, File.separator + "bugs" + File.separator + testName); + } + + public static InputStream getTestStream(String testName) { + return JRSTAbstractTest.class.getResourceAsStream("/" + testName); + } +} Modified: trunk/jrst/src/test/java/org/nuiton/jrst/JRSTCompareDocutils.java =================================================================== --- trunk/jrst/src/test/java/org/nuiton/jrst/JRSTCompareDocutils.java 2011-11-29 17:40:02 UTC (rev 629) +++ trunk/jrst/src/test/java/org/nuiton/jrst/JRSTCompareDocutils.java 2011-11-29 17:40:40 UTC (rev 630) @@ -53,10 +53,6 @@ import java.util.List; import java.util.Locale; - - - - public class JRSTCompareDocutils { /** to use log facility, just put in your code: log.info(\"...\"); */ Modified: trunk/jrst/src/test/java/org/nuiton/jrst/JRSTGeneratorTest.java =================================================================== --- trunk/jrst/src/test/java/org/nuiton/jrst/JRSTGeneratorTest.java 2011-11-29 17:40:02 UTC (rev 629) +++ trunk/jrst/src/test/java/org/nuiton/jrst/JRSTGeneratorTest.java 2011-11-29 17:40:40 UTC (rev 630) @@ -25,14 +25,13 @@ package org.nuiton.jrst; -import java.io.File; - import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.junit.Assert; import org.junit.Ignore; import org.junit.Test; +import java.io.File; + /** * JRSTGeneratorTest. * @@ -44,21 +43,27 @@ * Last update: $Date$ * by : $Author$ */ -public class JRSTGeneratorTest { +public class JRSTGeneratorTest extends JRSTAbstractTest { /** to use log facility, just put in your code: log.info("..."); */ protected static Log log = LogFactory.getLog(JRSTGeneratorTest.class); - + + public static String getResourcesTestPath() { + File file = getTestFile("test.rst"); + return file.getPath(); + } + + // Not implemented + @Ignore @Test public void testRstToRst() throws Exception { -// if (log.isInfoEnabled()) { -// log.info("Testing RST to RST (test.rst)..."); -// } -// -// File test1 = File.createTempFile("jrst-RstToRst", ".rst"); -// JRST.main(new String[] { "-t", "rst", "--force", "-o", test1.getAbsolutePath(), "src/test/resources/test.rst", }); -// test1.delete(); + if (log.isInfoEnabled()) { + log.info("Testing RST to RST (test.rst)..."); + } + + String test1 = getOutputTestPath("jrst-RstToRst.rst"); + JRST.main(new String[]{"-t", "rst", "--force", "-o", test1, getResourcesTestPath()}); } @Test @@ -67,11 +72,9 @@ if (log.isInfoEnabled()) { log.info("Testing RST to HTML (test.rst)..."); } - - File test1 = File.createTempFile("jrst-RstToHtml2", ".html"); - JRST.main(new String[] { "-t", "html", "--force", "-o", test1.getAbsolutePath(), "src/test/resources/text.rst" }); - Assert.assertTrue(test1.length() > 0); - test1.delete(); + + String test1 = getOutputTestPath("jrst-RstToHtml2.html"); + JRST.main(new String[]{"-t", "html", "--force", "-o", test1, getResourcesTestPath()}); } @Test @@ -80,12 +83,9 @@ if (log.isInfoEnabled()) { log.info("Testing RST to Docbook (test.rst)..."); } - - File test1 = File.createTempFile("jrst-RstToDocbook", ".dbk"); - JRST.main(new String[]{"-t", "docbook", "--force","-o", test1.getAbsolutePath(), - "src/test/resources/test.rst"}); - Assert.assertTrue(test1.length() > 0); - test1.delete(); + + String test1 = getOutputTestPath("jrst-RstToDocbook.dbk"); + JRST.main(new String[]{"-t", "docbook", "--force", "-o", test1, getResourcesTestPath()}); } @Test @@ -95,11 +95,8 @@ log.info("Testing RST to Xdoc (test.rst)..."); } - File test1 = File.createTempFile("jrst-RstToXdoc", ".xdoc"); - JRST.main(new String[] { "-t", "xdoc", "--force","-o", test1.getAbsolutePath(), - "src/test/resources/test.rst" }); - Assert.assertTrue(test1.length() > 0); - test1.delete(); + String test1 = getOutputTestPath("jrst-RstToXdoc.xdoc"); + JRST.main(new String[]{"-t", "xdoc", "--force", "-o", test1, getResourcesTestPath()}); } /** @@ -114,11 +111,8 @@ log.info("Testing RST to Xdoc (test2.rst)..."); } - File test1 = File.createTempFile("jrst-RstToXdoc2", ".xdoc"); - JRST.main(new String[] { "-t", "xdoc", "--force","-o", test1.getAbsolutePath(), - "src/test/resources/test2.rst" }); - Assert.assertTrue(test1.length() > 0); - test1.delete(); + String test1 = getOutputTestPath("jrst-RstToXdoc2.xdoc"); + JRST.main(new String[]{"-t", "xdoc", "--force", "-o", test1, getResourcesTestPath()}); } @Test @@ -128,11 +122,8 @@ log.info("Testing RST to Xdoc (test3.rst) ..."); } - File test1 = File.createTempFile("jrst-RstToXdoc3", ".xdoc"); - JRST.main(new String[] { "-t", "xdoc", "--force","-o", test1.getAbsolutePath(), - "src/test/resources/test3.rst" }); - Assert.assertTrue(test1.length() > 0); - test1.delete(); + String test1 = getOutputTestPath("jrst-RstToXdoc3.xdoc"); + JRST.main(new String[]{"-t", "xdoc", "--force", "-o", test1, getResourcesTestPath()}); } @Test @@ -142,11 +133,8 @@ log.info("Testing RST to Xdoc (test4.rst) ..."); } - File test1 = File.createTempFile("jrst-RstToXdoc4", ".xdoc"); - JRST.main(new String[] { "-t", "xdoc", "--force","-o", test1.getAbsolutePath(), - "src/test/resources/test4.rst" }); - Assert.assertTrue(test1.length() > 0); - test1.delete(); + String test1 = getOutputTestPath("jrst-RstToXdoc4.xdoc"); + JRST.main(new String[]{"-t", "xdoc", "--force", "-o", test1, getResourcesTestPath()}); } @Test @@ -156,11 +144,8 @@ log.info("Testing RST to Xdoc (frEntier.rst) ..."); } - File test1 = File.createTempFile("jrst-RstToXdocJrstSite", ".xdoc"); - JRST.main(new String[] { "-t", "xdoc", "--force","-o", test1.getAbsolutePath(), - "src/test/resources/frEntier.rst" }); - Assert.assertTrue(test1.length() > 0); - test1.delete(); + String test1 = getOutputTestPath("jrst-RstToXdocJrstSite.xdoc"); + JRST.main(new String[]{"-t", "xdoc", "--force", "-o", test1, getResourcesTestPath()}); } @Test @@ -170,10 +155,7 @@ log.info("Testing RST to PDF (frEntier.rst) ..."); } - File test1 = File.createTempFile("jrst-RstToPDF", ".pdf"); - JRST.main(new String[] { "-t", "pdf", "--force","-o", test1.getAbsolutePath(), - "src/test/resources/test.rst" }); - Assert.assertTrue(test1.length() > 0); - test1.delete(); + String test1 = getOutputTestPath("jrst-RstToPDF.pdf"); + JRST.main(new String[]{"-t", "pdf", "--force", "-o", test1, getResourcesTestPath()}); } } Modified: trunk/jrst/src/test/java/org/nuiton/jrst/JRSTReaderTest.java =================================================================== --- trunk/jrst/src/test/java/org/nuiton/jrst/JRSTReaderTest.java 2011-11-29 17:40:02 UTC (rev 629) +++ trunk/jrst/src/test/java/org/nuiton/jrst/JRSTReaderTest.java 2011-11-29 17:40:40 UTC (rev 630) @@ -28,12 +28,11 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.dom4j.Document; -import org.dom4j.io.XMLWriter; import java.io.BufferedReader; +import java.io.InputStream; import java.io.InputStreamReader; import java.io.Reader; -import java.io.StringWriter; import java.net.URL; import java.util.Locale; @@ -54,7 +53,7 @@ * Last update: $Date$ * by : $Author$ */ -public class JRSTReaderTest { +public class JRSTReaderTest extends JRSTAbstractTest { /** to use log facility, just put in your code: log.info("..."); */ protected static Log log = LogFactory.getLog(JRSTReaderTest.class); @@ -73,8 +72,9 @@ @Test public void testEmptyTableContents() throws Exception { - URL url = JRSTReaderTest.class.getResource("/testEmptyTableContents.rst"); - Reader in = new InputStreamReader(url.openStream()); + String fileName = "testEmptyTableContents.rst"; + InputStream testStream = getTestStream(fileName); + Reader in = new InputStreamReader(testStream); JRSTReader jrst = new JRSTReader(); Document doc = jrst.read(in); String xmlexpected = "<topic class=\"contents\" ids=\"table des matières\" names=\"table des matières\">" + @@ -83,17 +83,15 @@ "<paragraph>Texte</paragraph>" + "</document>"; String actualXml = doc.asXML(); - log.info("Test file : " + url); - log.info("Result :\n" + actualXml); - log.info("Expected :\n" + xmlexpected); - Assert.assertTrue(actualXml.contains(xmlexpected)); + assertXmlContain(fileName, actualXml, xmlexpected); } @Test public void testExternalLink() throws Exception { - URL url = JRSTReaderTest.class.getResource("/testExternalLink.rst"); - Reader in = new InputStreamReader(url.openStream()); + String fileName = "testExternalLink.rst"; + InputStream testStream = getTestStream(fileName); + Reader in = new InputStreamReader(testStream); JRSTReader jrst = new JRSTReader(); Document doc = jrst.read(in); String xmlexpected = "<paragraph>External hyperlinks, like <reference name=\"Python\" refuri=\"http://www.python.org/\">Python</reference></paragraph>" + @@ -101,17 +99,15 @@ "</document>"; String actualXml = doc.asXML(); - log.info("Test file : " + url); - log.info("Result :\n" + actualXml); - log.info("Expected :\n" + xmlexpected); - Assert.assertTrue(actualXml.contains(xmlexpected)); + assertXmlContain(fileName, actualXml, xmlexpected); } @Test public void testHyperlinkTarget() throws Exception { - URL url = JRSTReaderTest.class.getResource("/testHyperlinkTarget.rst"); - Reader in = new InputStreamReader(url.openStream()); + String fileName = "testHyperlinkTarget.rst"; + InputStream testStream = getTestStream(fileName); + Reader in = new InputStreamReader(testStream); JRSTReader jrst = new JRSTReader(); Document doc = jrst.read(in); String actualXml = doc.asXML(); @@ -130,80 +126,88 @@ String xmlexpected = buffer.toString(); index = xmlexpected.indexOf("<paragraph"); xmlexpected = xmlexpected.substring(index).trim(); - log.info("Test file : " + url); - log.info("Result :\n" + actualXml); - log.info("Expected :\n" + xmlexpected); - Assert.assertEquals(xmlexpected, actualXml); + assertXmlEqual(fileName, actualXml, xmlexpected); } - - + @Test public void testAnonymous() throws Exception { - URL url = JRSTReaderTest.class.getResource("/testAnonymous.rst"); - Reader in = new InputStreamReader(url.openStream()); + String fileName = "testAnonymous.rst"; + InputStream testStream = getTestStream(fileName); + Reader in = new InputStreamReader(testStream); I18n.init(new ClassPathI18nInitializer(), Locale.UK); - + JRSTReader jrst = new JRSTReader(); Document doc = jrst.read(in); - - + + String xmlexpected ="<target anonymous=\"1\" ids=\"id1\" refuri=\"http://www.python.org\"/>" +"<target anonymous=\"1\" ids=\"id2\" refuri=\"http://www.python.org\"/>"; - + String actualXml = doc.asXML(); - log.info("Result :\n" + actualXml); - log.info("Expected :\n" + xmlexpected); - Assert.assertTrue(actualXml.contains(xmlexpected)); + assertXmlContain(fileName, actualXml, xmlexpected); } - + @Test public void testLiteral() throws Exception { - URL url = JRSTReaderTest.class.getResource("/testLiteral.rst"); - Reader in = new InputStreamReader(url.openStream()); + String fileName = "testLiteral.rst"; + InputStream testStream = getTestStream(fileName); + Reader in = new InputStreamReader(testStream); I18n.init(new ClassPathI18nInitializer(), Locale.UK); - + JRSTReader jrst = new JRSTReader(); Document doc = jrst.read(in); - - + + String xmlexpected = "<literal_block> refcomp.admin.email=l'email des administrateurs. Example : admin@refcomp.com\n" + "\n" + "</literal_block></list_item></enumerated_list><paragraph>Paragraphe test</paragraph></document>"; - String actualXml = doc.asXML(); - log.warn("Result :\n" + actualXml); - log.warn("Expected :\n" + xmlexpected); - Assert.assertTrue(actualXml.contains(xmlexpected)); + assertXmlContain(fileName, actualXml, xmlexpected); } - - + @Test public void testFootnote() throws Exception { - URL url = JRSTReaderTest.class.getResource("/testFootnote.rst"); - Reader in = new InputStreamReader(url.openStream()); + String fileName = "testFootnote.rst"; + Reader in = new InputStreamReader(getTestStream(fileName)); I18n.init(new ClassPathI18nInitializer(), Locale.UK); - + JRSTReader jrst = new JRSTReader(); Document doc = jrst.read(in); - - + + String xmlexpected = "<footnote_reference ids=\"id1\" refid=\"id2\">1</footnote_reference>" + "</paragraph><footnote backrefs=\"id1\" ids=\"id2\" name=\"1\"><label>1</label>"; - String actualXml = doc.asXML(); - log.warn("Result :\n" + actualXml); - log.warn("Expected :\n" + xmlexpected); + assertXmlContain(fileName, actualXml, xmlexpected); + } + + protected void assertXmlEqual(String fileName, String actualXml, String xmlexpected) { + log(fileName, actualXml, xmlexpected); + + Assert.assertEquals(xmlexpected, actualXml); + } + + protected void assertXmlContain(String fileName, String actualXml, String xmlexpected) { + log(fileName, actualXml, xmlexpected); + Assert.assertTrue(actualXml.contains(xmlexpected)); } - + protected void log(String fileName, String actualXml, String xmlexpected) { + + if (log.isDebugEnabled()) { + log.debug("Test file : " + fileName); + log.debug("Result :\n" + actualXml); + log.debug("Expected :\n" + xmlexpected); + } + } } Modified: trunk/jrst/src/test/java/org/nuiton/jrst/JRSTTest.java =================================================================== --- trunk/jrst/src/test/java/org/nuiton/jrst/JRSTTest.java 2011-11-29 17:40:02 UTC (rev 629) +++ trunk/jrst/src/test/java/org/nuiton/jrst/JRSTTest.java 2011-11-29 17:40:40 UTC (rev 630) @@ -41,31 +41,11 @@ * * @author chemit */ -public class JRSTTest { +public class JRSTTest extends JRSTGeneratorTest { /** to use log facility, just put in your code: log.info("..."); */ protected static Log log = LogFactory.getLog(JRSTTest.class); - static File basedir; - - static File testBasedir; - - @BeforeClass - public static void beforeClass() { - String tmp = System.getProperty("basedir"); - if (tmp == null || tmp.isEmpty()) { - tmp = new File("").getAbsolutePath(); - } - basedir = new File(tmp); - testBasedir = new File(basedir, - "target" + File.separator + - "tests" + File.separator + - // "tests-" + System.nanoTime() + File.separator + - JRSTTest.class.getName()); - testBasedir.mkdirs(); - log.info("test basedir : " + testBasedir); - } - /** * Test que les ressources sont bien dans le classpath. * @@ -86,7 +66,7 @@ @Test public void generateRst() throws Exception { - File in = new File(testBasedir, "toRst1-in.rst"); + File in = new File(testWorkDir, "toRst1-in.rst"); List<String> IN_LINES = Arrays.asList(new String[]{ "=====", @@ -120,7 +100,7 @@ FileUtils.writeLines(in, IN_LINES); - File out = new File(testBasedir, "toRst1-out.rst"); + File out = new File(testWorkDir, "toRst1-out.rst"); JRST.generate(JRST.TYPE_RST, in, out, JRST.Overwrite.ALLTIME); @@ -139,9 +119,9 @@ @Test public void generateHtml() throws Exception { - File in = new File(basedir, "src/test/resources/text.rst"); + File in = getTestFile("text.rst"); - File out = new File(testBasedir, "jrst-RstToHtml2.html"); + File out = getOutputTestFile("jrst-RstToHtml2.html"); JRST.generate(JRST.TYPE_HTML, in, out, JRST.Overwrite.ALLTIME); Modified: trunk/jrst/src/test/java/org/nuiton/jrst/bugs/AdmonitionTest.java =================================================================== --- trunk/jrst/src/test/java/org/nuiton/jrst/bugs/AdmonitionTest.java 2011-11-29 17:40:02 UTC (rev 629) +++ trunk/jrst/src/test/java/org/nuiton/jrst/bugs/AdmonitionTest.java 2011-11-29 17:40:40 UTC (rev 630) @@ -1,3 +1,27 @@ +/* + * #%L + * JRst :: Api + * + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2004 - 2011 CodeLutin + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * #L% + */ package org.nuiton.jrst.bugs; import org.apache.commons.io.FileUtils; @@ -7,7 +31,9 @@ import org.junit.BeforeClass; import org.junit.Test; import org.nuiton.jrst.JRST; +import org.nuiton.jrst.JRSTAbstractTest; import org.nuiton.jrst.JRSTCompareDocutils; +import org.nuiton.util.Resource; import java.io.File; import java.io.IOException; @@ -17,16 +43,11 @@ * * @author sletellier */ -public class AdmonitionTest { +public class AdmonitionTest extends JRSTAbstractTest { /** to use log facility, just put in your code: log.info(\"...\"); */ private static Log log = LogFactory.getLog(AdmonitionTest.class); - @BeforeClass - public static void beforeClass () throws IOException { - JRSTCompareDocutils.prepareTmpDir(); - } - /** * Test que les options des admonitions dans des listes sont bien parsée * parsées. @@ -35,15 +56,15 @@ */ @Test public void testAdmonitionInList() throws Exception { - File in = new File("src/test/resources/bugs/testAdminitionInList1787.rst"); - File out = File.createTempFile("jrst-testAdminitionInList1787", ".html"); + File in = getBugTestFile("testAdminitionInList1787.rst"); + File out = getOutputTestFile("jrst-testAdminitionInList1787.html"); // out.deleteOnExit(); JRST.generate(JRST.TYPE_HTML, in, out, JRST.Overwrite.ALLTIME); String content = FileUtils.readFileToString(out); // Must contains <div class="note"> - Assert.assertTrue(content.contains("<div class=\"note\">")); + assertTrue(content.contains("<div class=\"note\">")); } } Modified: trunk/jrst/src/test/java/org/nuiton/jrst/bugs/DirectiveTest.java =================================================================== --- trunk/jrst/src/test/java/org/nuiton/jrst/bugs/DirectiveTest.java 2011-11-29 17:40:02 UTC (rev 629) +++ trunk/jrst/src/test/java/org/nuiton/jrst/bugs/DirectiveTest.java 2011-11-29 17:40:40 UTC (rev 630) @@ -26,14 +26,11 @@ package org.nuiton.jrst.bugs; import org.apache.commons.io.FileUtils; -import org.junit.Assert; -import org.junit.BeforeClass; import org.junit.Test; import org.nuiton.jrst.JRST; -import org.nuiton.jrst.JRSTCompareDocutils; +import org.nuiton.jrst.JRSTAbstractTest; import java.io.File; -import java.io.IOException; /** * Test concernant les directives. @@ -44,13 +41,8 @@ * Last update : $Date$ * By : $Author$ */ -public class DirectiveTest { +public class DirectiveTest extends JRSTAbstractTest { - @BeforeClass - public static void beforeClass () throws IOException { - JRSTCompareDocutils.prepareTmpDir(); - } - /** * Test que les options des directives images sont correctement * parsées. @@ -59,19 +51,19 @@ */ @Test public void testImageDirectiveOption() throws Exception { - File in = new File("src/test/resources/bugs/testImages21.rst"); - File out = File.createTempFile("jrst-testImages", ".html"); + File in = getBugTestFile("testImages21.rst"); + File out = getOutputTestFile("jrst-testImages.html"); // out.deleteOnExit(); JRST.generate(JRST.TYPE_HTML, in, out, JRST.Overwrite.ALLTIME); String content = FileUtils.readFileToString(out); - Assert.assertTrue(content.indexOf("alt=\"alternate text\"") > 0); - Assert.assertTrue(content.indexOf("width=\"200 px\"") > 0); - Assert.assertTrue(content.indexOf("align=\"center\"") > 0); - Assert.assertTrue(content.indexOf("alt=\"tab alternate text\"") > 0); + assertTrue(content.indexOf("alt=\"alternate text\"") > 0); + assertTrue(content.indexOf("width=\"200 px\"") > 0); + assertTrue(content.indexOf("align=\"center\"") > 0); + assertTrue(content.indexOf("alt=\"tab alternate text\"") > 0); // scale - Assert.assertTrue(content.indexOf("alt=\"tab alternate text\"") > 0); - Assert.assertTrue(content.indexOf("width=\"49%\" height=\"49%\"") > 0); + assertTrue(content.indexOf("alt=\"tab alternate text\"") > 0); + assertTrue(content.indexOf("width=\"49%\" height=\"49%\"") > 0); } /** @@ -81,12 +73,12 @@ */ @Test public void testContentDirective() throws Exception { - File in = new File("src/test/resources/bugs/testContent877.rst"); - File out = File.createTempFile("jrst-testContent", ".html"); + File in = getBugTestFile("testContent877.rst"); + File out = getOutputTestFile("jrst-testContent.html"); // out.deleteOnExit(); JRST.generate(JRST.TYPE_HTML, in, out, JRST.Overwrite.ALLTIME); String content = FileUtils.readFileToString(out); - Assert.assertTrue(content.indexOf("Table des matières") > 0); + assertTrue(content.indexOf("Table des matières") > 0); } } Modified: trunk/jrst/src/test/java/org/nuiton/jrst/bugs/InfiniteLoopTest.java =================================================================== --- trunk/jrst/src/test/java/org/nuiton/jrst/bugs/InfiniteLoopTest.java 2011-11-29 17:40:02 UTC (rev 629) +++ trunk/jrst/src/test/java/org/nuiton/jrst/bugs/InfiniteLoopTest.java 2011-11-29 17:40:40 UTC (rev 630) @@ -29,6 +29,7 @@ import org.junit.Assert; import org.junit.BeforeClass; import org.junit.Test; +import org.nuiton.jrst.JRSTAbstractTest; import org.nuiton.jrst.JRSTCompareDocutils; import org.nuiton.jrst.JRSTReader; import org.nuiton.jrst.JRSTReaderTest; @@ -47,7 +48,7 @@ * Last update : $Date$ * By : $Author$ */ -public class InfiniteLoopTest { +public class InfiniteLoopTest extends JRSTAbstractTest { @BeforeClass public static void beforeClass () throws IOException { Modified: trunk/jrst/src/test/java/org/nuiton/jrst/bugs/OptionTest.java =================================================================== --- trunk/jrst/src/test/java/org/nuiton/jrst/bugs/OptionTest.java 2011-11-29 17:40:02 UTC (rev 629) +++ trunk/jrst/src/test/java/org/nuiton/jrst/bugs/OptionTest.java 2011-11-29 17:40:40 UTC (rev 630) @@ -1,3 +1,27 @@ +/* + * #%L + * JRst :: Api + * + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2004 - 2011 CodeLutin + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * #L% + */ package org.nuiton.jrst.bugs; import org.apache.commons.io.FileUtils; @@ -7,6 +31,7 @@ import org.junit.BeforeClass; import org.junit.Test; import org.nuiton.jrst.JRST; +import org.nuiton.jrst.JRSTAbstractTest; import org.nuiton.jrst.JRSTCompareDocutils; import java.io.File; @@ -17,16 +42,11 @@ * * @author sletellier */ -public class OptionTest { +public class OptionTest extends JRSTAbstractTest { /** to use log facility, just put in your code: log.info(\"...\"); */ private static Log log = LogFactory.getLog(AdmonitionTest.class); - @BeforeClass - public static void beforeClass () throws IOException { - JRSTCompareDocutils.prepareTmpDir(); - } - /** * Test que les options des options dans des listes sont bien parsée * parsées. @@ -35,8 +55,8 @@ */ @Test public void testOptionArgumentSizeInList() throws Exception { - File in = new File("src/test/resources/bugs/testOptionArgumentSize1788.rst"); - File out = File.createTempFile("jrst-testOptionArgumentSize1788", ".html"); + File in = getBugTestFile("testOptionArgumentSize1788.rst"); + File out = getOutputTestFile("jrst-testOptionArgumentSize1788.html"); JRST.generate(JRST.TYPE_HTML, in, out, JRST.Overwrite.ALLTIME); } Modified: trunk/jrst/src/test/java/org/nuiton/jrst/bugs/TableTest.java =================================================================== --- trunk/jrst/src/test/java/org/nuiton/jrst/bugs/TableTest.java 2011-11-29 17:40:02 UTC (rev 629) +++ trunk/jrst/src/test/java/org/nuiton/jrst/bugs/TableTest.java 2011-11-29 17:40:40 UTC (rev 630) @@ -30,6 +30,7 @@ import org.junit.BeforeClass; import org.junit.Test; import org.nuiton.jrst.JRST; +import org.nuiton.jrst.JRSTAbstractTest; import org.nuiton.jrst.JRSTCompareDocutils; import java.io.File; @@ -44,12 +45,7 @@ * Last update : $Date$ * By : $Author$ */ -public class TableTest { - - @BeforeClass - public static void beforeClass () throws IOException { - JRSTCompareDocutils.prepareTmpDir(); - } +public class TableTest extends JRSTAbstractTest { /** * Test que la présence d'un caractères | ne fait pas planter @@ -59,14 +55,14 @@ */ @Test public void testTableSpecialChar() throws Exception { - File in = new File("src/test/resources/bugs/testTable1290.rst"); - File out = File.createTempFile("jrst-tables", ".html"); + File in = getBugTestFile("testTable1290.rst"); + File out = getOutputTestFile("jrst-tables.html"); // out.deleteOnExit(); JRST.generate(JRST.TYPE_HTML, in, out, JRST.Overwrite.ALLTIME); String content = FileUtils.readFileToString(out); - Assert.assertTrue(content.indexOf("Annee|Trait|Espece") > 0); - Assert.assertTrue(content.indexOf("<p>Fatal</p>") > 0); + assertTrue(content.indexOf("Annee|Trait|Espece") > 0); + assertTrue(content.indexOf("<p>Fatal</p>") > 0); } /** @@ -76,12 +72,12 @@ */ @Test public void testTableIndentation() throws Exception { - File in = new File("src/test/resources/bugs/testTable1375.rst"); - File out = File.createTempFile("jrst-tables", ".html"); + File in = getBugTestFile("testTable1375.rst"); + File out = getOutputTestFile("jrst-tables.html"); // out.deleteOnExit(); JRST.generate(JRST.TYPE_HTML, in, out, JRST.Overwrite.ALLTIME); String content = FileUtils.readFileToString(out); - Assert.assertTrue(content.indexOf("<em>légérs</em>") > 0); + assertTrue(content.indexOf("<em>légérs</em>") > 0); } } Modified: trunk/jrst/src/test/java/org/nuiton/jrst/bugs/TextTest.java =================================================================== --- trunk/jrst/src/test/java/org/nuiton/jrst/bugs/TextTest.java 2011-11-29 17:40:02 UTC (rev 629) +++ trunk/jrst/src/test/java/org/nuiton/jrst/bugs/TextTest.java 2011-11-29 17:40:40 UTC (rev 630) @@ -25,16 +25,13 @@ package org.nuiton.jrst.bugs; -import junit.framework.Assert; import org.apache.commons.io.FileUtils; -import org.junit.BeforeClass; import org.junit.Ignore; import org.junit.Test; import org.nuiton.jrst.JRST; -import org.nuiton.jrst.JRSTCompareDocutils; +import org.nuiton.jrst.JRSTAbstractTest; import java.io.File; -import java.io.IOException; import java.util.regex.Matcher; import java.util.regex.Pattern; @@ -47,13 +44,8 @@ * Last update : $Date$ * By : $Author$ */ -public class TextTest { +public class TextTest extends JRSTAbstractTest { - @BeforeClass - public static void beforeClass () throws IOException { - JRSTCompareDocutils.prepareTmpDir(); - } - /** * Test que les liens avec parametres sont correctement parsés. * @@ -61,15 +53,15 @@ */ @Test public void testLinksParameters() throws Exception { - File in = new File("src/test/resources/bugs/testLinks.rst"); - File out = File.createTempFile("jrst-testLinks", ".html"); -// out.deleteOnExit(); + File in = getBugTestFile("testLinks.rst"); + File out = getOutputTestFile("jrst-testLinks.html"); + JRST.generate(JRST.TYPE_HTML, in, out, JRST.Overwrite.ALLTIME); String content = FileUtils.readFileToString(out); - Assert.assertTrue(content.indexOf("href=\"http://labs.libre-entreprise.org/tracker/?atid=113&group_id=8&func=browse\"") > 0); - Assert.assertTrue(content.indexOf("href=\"http://www.docbook.org/\"") > 0); - Assert.assertTrue(content.indexOf("href=\"http://www.docbook2.org/\"") > 0); + assertTrue(content.indexOf("href=\"http://labs.libre-entreprise.org/tracker/?atid=113&group_id=8&func=browse\"") > 0); + assertTrue(content.indexOf("href=\"http://www.docbook.org/\"") > 0); + assertTrue(content.indexOf("href=\"http://www.docbook2.org/\"") > 0); } /** @@ -80,14 +72,14 @@ */ @Test public void testLinksSpecialCharacters() throws Exception { - File in = new File("src/test/resources/bugs/testLinks1380.rst"); - File out = File.createTempFile("jrst-testLinks", ".html"); -// out.deleteOnExit(); + File in = getBugTestFile("testLinks1380.rst"); + File out = getOutputTestFile("jrst-testLinks.html"); + JRST.generate(JRST.TYPE_HTML, in, out, JRST.Overwrite.ALLTIME); String content = FileUtils.readFileToString(out); - Assert.assertTrue(content.indexOf("nuiton's forge") > 0); - Assert.assertTrue(content.indexOf("build.xml") > 0); + assertTrue(content.indexOf("nuiton's forge") > 0); + assertTrue(content.indexOf("build.xml") > 0); } /** @@ -98,15 +90,15 @@ */ @Test public void testTabCharacter() throws Exception { - File in = new File("src/test/resources/bugs/testTab1378.rst"); - File out = File.createTempFile("jrst-testTab1378", ".html"); -// out.deleteOnExit(); + File in = getBugTestFile("testTab1378.rst"); + File out = getOutputTestFile("jrst-testTab1378.html"); + JRST.generate(JRST.TYPE_HTML, in, out, JRST.Overwrite.ALLTIME); String content = FileUtils.readFileToString(out); Pattern pattern = Pattern.compile(".*<blockquote>.*du bla bla \u00E9l\u00E9mentaire.*</blockquote>.*", Pattern.DOTALL); Matcher matcher = pattern.matcher(content); - Assert.assertTrue(matcher.find()); + assertTrue(matcher.find()); } /** @@ -116,18 +108,18 @@ */ @Test public void testOptionLists() throws Exception { - File in = new File("src/test/resources/bugs/testOptionsList644.rst"); - File out = File.createTempFile("jrst-testOptionList644", ".html"); -// out.deleteOnExit(); + File in = getBugTestFile("testOptionsList644.rst"); + File out = getOutputTestFile("jrst-testOptionList644.html"); + JRST.generate(JRST.TYPE_HTML, in, out, JRST.Overwrite.ALLTIME); String content = FileUtils.readFileToString(out); - Assert.assertTrue(content.indexOf("<span class=\"option\">-a</span>") > 0); - Assert.assertTrue(content.indexOf("<p>options can have arguments and long descriptions</p>") > 0); - Assert.assertTrue(content.indexOf("<v3region.zip|v2region.xml|v2region.xml.gz>") > 0); - Assert.assertTrue(content.indexOf("<span class=\"option\">--importRegion") > 0); - Assert.assertTrue(content.indexOf("<span class=\"option\">/V</span>") > 0); - Assert.assertTrue(content.indexOf("<p>DOS/VMS-style options too</p>") > 0); + assertTrue(content.indexOf("<span class=\"option\">-a</span>") > 0); + assertTrue(content.indexOf("<p>options can have arguments and long descriptions</p>") > 0); + assertTrue(content.indexOf("<v3region.zip|v2region.xml|v2region.xml.gz>") > 0); + assertTrue(content.indexOf("<span class=\"option\">--importRegion") > 0); + assertTrue(content.indexOf("<span class=\"option\">/V</span>") > 0); + assertTrue(content.indexOf("<p>DOS/VMS-style options too</p>") > 0); } /** @@ -140,13 +132,13 @@ @Test @Ignore public void testLinkEscape() throws Exception { - File in = new File("src/test/resources/bugs/testLinks.rst"); - File out = File.createTempFile("jrst-testLinks", ".html"); -// out.deleteOnExit(); + File in = getBugTestFile("testLinks.rst"); + File out = getOutputTestFile("jrst-testLinks.html"); + JRST.generate(JRST.TYPE_HTML, in, out, JRST.Overwrite.ALLTIME); String content = FileUtils.readFileToString(out); - Assert.assertTrue(content.indexOf("echapement de lien1_") > 0); - Assert.assertTrue(content.indexOf("echapement de *.txt") > 0); + assertTrue(content.indexOf("echapement de lien1_") > 0); + assertTrue(content.indexOf("echapement de *.txt") > 0); } } Modified: trunk/jrst/src/test/java/org/nuiton/jrst/bugs/TitlesTest.java =================================================================== --- trunk/jrst/src/test/java/org/nuiton/jrst/bugs/TitlesTest.java 2011-11-29 17:40:02 UTC (rev 629) +++ trunk/jrst/src/test/java/org/nuiton/jrst/bugs/TitlesTest.java 2011-11-29 17:40:40 UTC (rev 630) @@ -30,6 +30,7 @@ import org.junit.BeforeClass; import org.junit.Test; import org.nuiton.jrst.JRST; +import org.nuiton.jrst.JRSTAbstractTest; import org.nuiton.jrst.JRSTCompareDocutils; import java.io.File; @@ -44,7 +45,7 @@ * Last update : $Date$ * By : $Author$ */ -public class TitlesTest { +public class TitlesTest extends JRSTAbstractTest { @BeforeClass public static void beforeClass () throws IOException { Modified: trunk/jrst/src/test/resources/bugs/testAdminitionInList1787.rst =================================================================== --- trunk/jrst/src/test/resources/bugs/testAdminitionInList1787.rst 2011-11-29 17:40:02 UTC (rev 629) +++ trunk/jrst/src/test/resources/bugs/testAdminitionInList1787.rst 2011-11-29 17:40:40 UTC (rev 630) @@ -1,3 +1,27 @@ +.. - +.. * #%L +.. * JRst :: Api +.. * +.. * $Id$ +.. * $HeadURL$ +.. * %% +.. * Copyright (C) 2004 - 2011 CodeLutin +.. * %% +.. * This program is free software: you can redistribute it and/or modify +.. * it under the terms of the GNU Lesser General Public License as +.. * published by the Free Software Foundation, either version 3 of the +.. * License, or (at your option) any later version. +.. * +.. * This program is distributed in the hope that it will be useful, +.. * but WITHOUT ANY WARRANTY; without even the implied warranty of +.. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +.. * GNU General Lesser Public License for more details. +.. * +.. * You should have received a copy of the GNU General Lesser Public +.. * License along with this program. If not, see +.. * <http://www.gnu.org/licenses/lgpl-3.0.html>. +.. * #L% +.. - * item .. Note:: note Modified: trunk/jrst/src/test/resources/bugs/testOptionArgumentSize1788.rst =================================================================== --- trunk/jrst/src/test/resources/bugs/testOptionArgumentSize1788.rst 2011-11-29 17:40:02 UTC (rev 629) +++ trunk/jrst/src/test/resources/bugs/testOptionArgumentSize1788.rst 2011-11-29 17:40:40 UTC (rev 630) @@ -1,2 +1,26 @@ +.. - +.. * #%L +.. * JRst :: Api +.. * +.. * $Id$ +.. * $HeadURL$ +.. * %% +.. * Copyright (C) 2004 - 2011 CodeLutin +.. * %% +.. * This program is free software: you can redistribute it and/or modify +.. * it under the terms of the GNU Lesser General Public License as +.. * published by the Free Software Foundation, either version 3 of the +.. * License, or (at your option) any later version. +.. * +.. * This program is distributed in the hope that it will be useful, +.. * but WITHOUT ANY WARRANTY; without even the implied warranty of +.. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +.. * GNU General Lesser Public License for more details. +.. * +.. * You should have received a copy of the GNU General Lesser Public +.. * License along with this program. If not, see +.. * <http://www.gnu.org/licenses/lgpl-3.0.html>. +.. * #L% +.. - --import <file.zip>
participants (1)
-
sletellier@users.nuiton.org