From: Niki Roo Date: Fri, 23 Mar 2018 15:09:10 +0000 (+0100) Subject: Improve conversion tests X-Git-Url: https://git.nikiroo.be/?a=commitdiff_plain;h=c2f96f372ee98b3745ad0c7f1dbb1a81ad7c4a7d;p=fanfix-jexer.git Improve conversion tests --- diff --git a/src/be/nikiroo/fanfix/test/ConversionTest.java b/src/be/nikiroo/fanfix/test/ConversionTest.java index 92aca36..d932782 100644 --- a/src/be/nikiroo/fanfix/test/ConversionTest.java +++ b/src/be/nikiroo/fanfix/test/ConversionTest.java @@ -6,7 +6,10 @@ import java.io.FilenameFilter; import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; +import java.util.HashMap; import java.util.List; +import java.util.Map; +import java.util.Map.Entry; import java.util.zip.ZipEntry; import java.util.zip.ZipInputStream; @@ -25,6 +28,7 @@ class ConversionTest extends TestLauncher { private File expectedDir; private File resultDir; private List realTypes; + private Map> skipCompare; public ConversionTest(String[] args) { super("Conversion", args); @@ -69,6 +73,15 @@ class ConversionTest extends TestLauncher { resultDir = new File("test/result/"); tempFiles = new TempFiles("Fanfix-ConversionTest"); + + skipCompare = new HashMap>(); + skipCompare.put("epb.ncx", + Arrays.asList(" ", + " ")); + skipCompare.put(".info", + Arrays.asList("CREATION_DATE=", "SUBJECT=", "URL=", "UUID=")); + skipCompare.put("URL", Arrays.asList("file:/")); } @Override @@ -215,13 +228,14 @@ class ConversionTest extends TestLauncher { String resultLine = resultLines.get(j); boolean skip = false; - for (String skipStart : new String[] { "CREATION_DATE=", - "SUBJECT=", "URL=", "UUID=" }) { - if (name.endsWith(".info") - && expectedLine.startsWith(skipStart) - && resultLine.startsWith(skipStart)) { - // TODO: check the format? - skip = true; + for (Entry> skipThose : skipCompare + .entrySet()) { + for (String skipStart : skipThose.getValue()) { + if (name.endsWith(skipThose.getKey()) + && expectedLine.startsWith(skipStart) + && resultLine.startsWith(skipStart)) { + skip = true; + } } } diff --git a/test/expected/cbz.cbz b/test/expected/cbz.cbz index 30c6efc..3740e92 100644 Binary files a/test/expected/cbz.cbz and b/test/expected/cbz.cbz differ diff --git a/test/expected/epub.epub b/test/expected/epub.epub index ea932ba..1e3dd8c 100644 Binary files a/test/expected/epub.epub and b/test/expected/epub.epub differ diff --git a/test/expected/html/html.info b/test/expected/html/html.info index 6831683..b1d1cde 100644 --- a/test/expected/html/html.info +++ b/test/expected/html/html.info @@ -13,6 +13,6 @@ TYPE="text" COVER="" EPUBCREATOR="Fanfix (by Niki)" PUBLISHER="" -WORDCOUNT="59" -CREATION_DATE="2018-03-23 11:27:04" +WORDCOUNT="57" +CREATION_DATE="2018-03-23 16:01:39" FAKE_COVER="false" diff --git a/test/expected/html/html.txt b/test/expected/html/html.txt index 4ff9013..a3a3af3 100644 --- a/test/expected/html/html.txt +++ b/test/expected/html/html.txt @@ -4,7 +4,7 @@ by UnknownArtist366 (2018) Chapter 0: Description —————————————————————— -This `story‘ is nothing more than a test file to check +This ‘story’ is nothing more than a test file to check that the program can convert it into different formats correctly. @@ -12,8 +12,8 @@ Chapter 1: Quotes ————————————————— “Yes, quotes!”, I said. -`Thos can start with a single- or double quote sign‘, I continued. -“ They also supports other characters, and an optionnal leading dash. ” +‘Those can start with a single- or double quote sign’, I continued. +“They also supports other characters, and an optionnal leading dash.” “The optionnal leading dash is enough to signify “quote”.” Chapter 2: “Quote” test diff --git a/test/expected/html/index.html b/test/expected/html/index.html index 22b6eb0..aade9c3 100644 --- a/test/expected/html/index.html +++ b/test/expected/html/index.html @@ -17,7 +17,7 @@
UnknownArtist366


- This `story‘ is nothing more than a test file to check + This ‘story’ is nothing more than a test file to check that the program can convert it into different formats correctly.
@@ -31,8 +31,8 @@
— “Yes, quotes!”, I said.
-
— `Thos can start with a single- or double quote sign‘, I continued.
-
— “ They also supports other characters, and an optionnal leading dash. ”
+
— ‘Those can start with a single- or double quote sign’, I continued.
+
— “They also supports other characters, and an optionnal leading dash.”
— “The optionnal leading dash is enough to signify “quote”.”
diff --git a/test/expected/info_text b/test/expected/info_text index e6c90d2..768b3cc 100644 --- a/test/expected/info_text +++ b/test/expected/info_text @@ -10,8 +10,8 @@ formats correctly. Chapter 1: Quotes "Yes, quotes!", I said. -'Thos can start with a single- or double quote sign', I continued. -" They also supports other characters, and an optionnal leading dash. " +'Those can start with a single- or double quote sign', I continued. +"They also supports other characters, and an optionnal leading dash." "The optionnal leading dash is enough to signify "quote"." Chapter 2: “Quote” test diff --git a/test/expected/info_text.info b/test/expected/info_text.info index 5e97cce..38ae4b5 100644 --- a/test/expected/info_text.info +++ b/test/expected/info_text.info @@ -13,6 +13,6 @@ TYPE="info_text" COVER="" EPUBCREATOR="Fanfix (by Niki)" PUBLISHER="" -WORDCOUNT="59" -CREATION_DATE="2018-03-23 11:27:04" +WORDCOUNT="57" +CREATION_DATE="2018-03-23 16:01:39" FAKE_COVER="false" diff --git a/test/expected/latex.tex b/test/expected/latex.tex index 81909dd..d4dd68f 100644 --- a/test/expected/latex.tex +++ b/test/expected/latex.tex @@ -23,10 +23,10 @@ \say{``Yes, quotes!'', I said.} -\say{`Thos can start with a single- or double quote sign', I continued.} +\say{`Those can start with a single- or double quote sign', I continued.} \noindent{} -\say{`` They also supports other characters, and an optionnal leading dash. ''} +\say{``They also supports other characters, and an optionnal leading dash.''} \noindent{} \say{``The optionnal leading dash is enough to signify ``quote''.''} diff --git a/test/expected/text.txt b/test/expected/text.txt index 4ff9013..a3a3af3 100644 --- a/test/expected/text.txt +++ b/test/expected/text.txt @@ -4,7 +4,7 @@ by UnknownArtist366 (2018) Chapter 0: Description —————————————————————— -This `story‘ is nothing more than a test file to check +This ‘story’ is nothing more than a test file to check that the program can convert it into different formats correctly. @@ -12,8 +12,8 @@ Chapter 1: Quotes ————————————————— “Yes, quotes!”, I said. -`Thos can start with a single- or double quote sign‘, I continued. -“ They also supports other characters, and an optionnal leading dash. ” +‘Those can start with a single- or double quote sign’, I continued. +“They also supports other characters, and an optionnal leading dash.” “The optionnal leading dash is enough to signify “quote”.” Chapter 2: “Quote” test diff --git a/test/test.story b/test/test.story index c3136a3..7365b60 100644 --- a/test/test.story +++ b/test/test.story @@ -9,8 +9,8 @@ formats correctly. Chapter 1: Quotes - "Yes, quotes!", I said. -'Thos can start with a single- or double quote sign', I continued. -- « They also supports other characters, and an optionnal leading dash. » +'Those can start with a single- or double quote sign', I continued. +- «They also supports other characters, and an optionnal leading dash.» - The optionnal leading dash is enough to signify "quote". Chapter 2: "Quote" test