diff --git a/patacrep/latex/lexer.py b/patacrep/latex/lexer.py index f76500f8..81679255 100644 --- a/patacrep/latex/lexer.py +++ b/patacrep/latex/lexer.py @@ -60,7 +60,7 @@ class SimpleLexer: # Define a rule so we can track line numbers @staticmethod def t_endofline(token): - r'\n+' + r'(\r?\n)+' token.lexer.lineno += len(token.value) @staticmethod diff --git a/patacrep/latex/syntax.py b/patacrep/latex/syntax.py index 8915816b..330f9eee 100644 --- a/patacrep/latex/syntax.py +++ b/patacrep/latex/syntax.py @@ -130,8 +130,11 @@ class LatexParser(Parser): def p_dictionary(symbols): """dictionary : identifier EQUAL braces dictionary_next | identifier EQUAL error dictionary_next + | empty """ - if isinstance(symbols[3], ast.Expression): + if len(symbols) == 2: + symbols[0] = {} + elif isinstance(symbols[3], ast.Expression): symbols[0] = {} symbols[0][symbols[1]] = symbols[3] symbols[0].update(symbols[4]) diff --git a/test/test_chordpro/00.csg b/test/test_song/00.csg similarity index 100% rename from test/test_chordpro/00.csg rename to test/test_song/00.csg diff --git a/test/test_chordpro/00.csg.source b/test/test_song/00.csg.source similarity index 100% rename from test/test_chordpro/00.csg.source rename to test/test_song/00.csg.source diff --git a/test/test_chordpro/00.tsg b/test/test_song/00.tsg similarity index 100% rename from test/test_chordpro/00.tsg rename to test/test_song/00.tsg diff --git a/test/test_chordpro/01.csg b/test/test_song/01.csg similarity index 100% rename from test/test_chordpro/01.csg rename to test/test_song/01.csg diff --git a/test/test_chordpro/01.csg.source b/test/test_song/01.csg.source similarity index 100% rename from test/test_chordpro/01.csg.source rename to test/test_song/01.csg.source diff --git a/test/test_chordpro/01.tsg b/test/test_song/01.tsg similarity index 100% rename from test/test_chordpro/01.tsg rename to test/test_song/01.tsg diff --git a/test/test_chordpro/02.csg b/test/test_song/02.csg similarity index 100% rename from test/test_chordpro/02.csg rename to test/test_song/02.csg diff --git a/test/test_chordpro/02.csg.source b/test/test_song/02.csg.source similarity index 100% rename from test/test_chordpro/02.csg.source rename to test/test_song/02.csg.source diff --git a/test/test_chordpro/02.tsg b/test/test_song/02.tsg similarity index 100% rename from test/test_chordpro/02.tsg rename to test/test_song/02.tsg diff --git a/test/test_chordpro/03.csg b/test/test_song/03.csg similarity index 100% rename from test/test_chordpro/03.csg rename to test/test_song/03.csg diff --git a/test/test_chordpro/03.csg.source b/test/test_song/03.csg.source similarity index 100% rename from test/test_chordpro/03.csg.source rename to test/test_song/03.csg.source diff --git a/test/test_chordpro/03.tsg b/test/test_song/03.tsg similarity index 100% rename from test/test_chordpro/03.tsg rename to test/test_song/03.tsg diff --git a/test/test_chordpro/04.csg b/test/test_song/04.csg similarity index 100% rename from test/test_chordpro/04.csg rename to test/test_song/04.csg diff --git a/test/test_chordpro/04.csg.source b/test/test_song/04.csg.source similarity index 100% rename from test/test_chordpro/04.csg.source rename to test/test_song/04.csg.source diff --git a/test/test_chordpro/04.tsg b/test/test_song/04.tsg similarity index 100% rename from test/test_chordpro/04.tsg rename to test/test_song/04.tsg diff --git a/test/test_chordpro/05.csg b/test/test_song/05.csg similarity index 100% rename from test/test_chordpro/05.csg rename to test/test_song/05.csg diff --git a/test/test_chordpro/05.csg.source b/test/test_song/05.csg.source similarity index 100% rename from test/test_chordpro/05.csg.source rename to test/test_song/05.csg.source diff --git a/test/test_chordpro/05.tsg b/test/test_song/05.tsg similarity index 100% rename from test/test_chordpro/05.tsg rename to test/test_song/05.tsg diff --git a/test/test_chordpro/06.csg b/test/test_song/06.csg similarity index 100% rename from test/test_chordpro/06.csg rename to test/test_song/06.csg diff --git a/test/test_chordpro/06.csg.source b/test/test_song/06.csg.source similarity index 100% rename from test/test_chordpro/06.csg.source rename to test/test_song/06.csg.source diff --git a/test/test_chordpro/06.tsg b/test/test_song/06.tsg similarity index 100% rename from test/test_chordpro/06.tsg rename to test/test_song/06.tsg diff --git a/test/test_chordpro/07.csg b/test/test_song/07.csg similarity index 100% rename from test/test_chordpro/07.csg rename to test/test_song/07.csg diff --git a/test/test_chordpro/07.csg.source b/test/test_song/07.csg.source similarity index 100% rename from test/test_chordpro/07.csg.source rename to test/test_song/07.csg.source diff --git a/test/test_chordpro/07.tsg b/test/test_song/07.tsg similarity index 100% rename from test/test_chordpro/07.tsg rename to test/test_song/07.tsg diff --git a/test/test_chordpro/08.csg b/test/test_song/08.csg similarity index 100% rename from test/test_chordpro/08.csg rename to test/test_song/08.csg diff --git a/test/test_chordpro/08.csg.source b/test/test_song/08.csg.source similarity index 100% rename from test/test_chordpro/08.csg.source rename to test/test_song/08.csg.source diff --git a/test/test_chordpro/08.tsg b/test/test_song/08.tsg similarity index 100% rename from test/test_chordpro/08.tsg rename to test/test_song/08.tsg diff --git a/test/test_chordpro/09.csg b/test/test_song/09.csg similarity index 100% rename from test/test_chordpro/09.csg rename to test/test_song/09.csg diff --git a/test/test_chordpro/09.csg.source b/test/test_song/09.csg.source similarity index 100% rename from test/test_chordpro/09.csg.source rename to test/test_song/09.csg.source diff --git a/test/test_chordpro/09.tsg b/test/test_song/09.tsg similarity index 100% rename from test/test_chordpro/09.tsg rename to test/test_song/09.tsg diff --git a/test/test_chordpro/10.csg b/test/test_song/10.csg similarity index 100% rename from test/test_chordpro/10.csg rename to test/test_song/10.csg diff --git a/test/test_chordpro/10.csg.source b/test/test_song/10.csg.source similarity index 100% rename from test/test_chordpro/10.csg.source rename to test/test_song/10.csg.source diff --git a/test/test_chordpro/10.tsg b/test/test_song/10.tsg similarity index 100% rename from test/test_chordpro/10.tsg rename to test/test_song/10.tsg diff --git a/test/test_chordpro/11.csg b/test/test_song/11.csg similarity index 100% rename from test/test_chordpro/11.csg rename to test/test_song/11.csg diff --git a/test/test_chordpro/11.csg.source b/test/test_song/11.csg.source similarity index 100% rename from test/test_chordpro/11.csg.source rename to test/test_song/11.csg.source diff --git a/test/test_chordpro/11.tsg b/test/test_song/11.tsg similarity index 100% rename from test/test_chordpro/11.tsg rename to test/test_song/11.tsg diff --git a/test/test_chordpro/12.csg b/test/test_song/12.csg similarity index 100% rename from test/test_chordpro/12.csg rename to test/test_song/12.csg diff --git a/test/test_chordpro/12.csg.source b/test/test_song/12.csg.source similarity index 100% rename from test/test_chordpro/12.csg.source rename to test/test_song/12.csg.source diff --git a/test/test_chordpro/12.tsg b/test/test_song/12.tsg similarity index 100% rename from test/test_chordpro/12.tsg rename to test/test_song/12.tsg diff --git a/test/test_chordpro/13.csg b/test/test_song/13.csg similarity index 100% rename from test/test_chordpro/13.csg rename to test/test_song/13.csg diff --git a/test/test_chordpro/13.csg.source b/test/test_song/13.csg.source similarity index 100% rename from test/test_chordpro/13.csg.source rename to test/test_song/13.csg.source diff --git a/test/test_chordpro/13.tsg b/test/test_song/13.tsg similarity index 100% rename from test/test_chordpro/13.tsg rename to test/test_song/13.tsg diff --git a/test/test_chordpro/21.csg b/test/test_song/21.csg similarity index 100% rename from test/test_chordpro/21.csg rename to test/test_song/21.csg diff --git a/test/test_chordpro/21.csg.source b/test/test_song/21.csg.source similarity index 100% rename from test/test_chordpro/21.csg.source rename to test/test_song/21.csg.source diff --git a/test/test_chordpro/21.tsg b/test/test_song/21.tsg similarity index 100% rename from test/test_chordpro/21.tsg rename to test/test_song/21.tsg diff --git a/test/test_chordpro/22.csg b/test/test_song/22.csg similarity index 100% rename from test/test_chordpro/22.csg rename to test/test_song/22.csg diff --git a/test/test_chordpro/22.csg.source b/test/test_song/22.csg.source similarity index 100% rename from test/test_chordpro/22.csg.source rename to test/test_song/22.csg.source diff --git a/test/test_chordpro/22.tsg b/test/test_song/22.tsg similarity index 100% rename from test/test_chordpro/22.tsg rename to test/test_song/22.tsg diff --git a/test/test_chordpro/23.csg b/test/test_song/23.csg similarity index 100% rename from test/test_chordpro/23.csg rename to test/test_song/23.csg diff --git a/test/test_chordpro/23.csg.source b/test/test_song/23.csg.source similarity index 100% rename from test/test_chordpro/23.csg.source rename to test/test_song/23.csg.source diff --git a/test/test_chordpro/23.tsg b/test/test_song/23.tsg similarity index 100% rename from test/test_chordpro/23.tsg rename to test/test_song/23.tsg diff --git a/test/test_chordpro/24.csg b/test/test_song/24.csg similarity index 100% rename from test/test_chordpro/24.csg rename to test/test_song/24.csg diff --git a/test/test_chordpro/24.csg.source b/test/test_song/24.csg.source similarity index 100% rename from test/test_chordpro/24.csg.source rename to test/test_song/24.csg.source diff --git a/test/test_chordpro/24.tsg b/test/test_song/24.tsg similarity index 100% rename from test/test_chordpro/24.tsg rename to test/test_song/24.tsg diff --git a/test/test_chordpro/25.csg b/test/test_song/25.csg similarity index 100% rename from test/test_chordpro/25.csg rename to test/test_song/25.csg diff --git a/test/test_chordpro/25.csg.source b/test/test_song/25.csg.source similarity index 100% rename from test/test_chordpro/25.csg.source rename to test/test_song/25.csg.source diff --git a/test/test_chordpro/25.tsg b/test/test_song/25.tsg similarity index 100% rename from test/test_chordpro/25.tsg rename to test/test_song/25.tsg diff --git a/test/test_chordpro/26.csg b/test/test_song/26.csg similarity index 100% rename from test/test_chordpro/26.csg rename to test/test_song/26.csg diff --git a/test/test_chordpro/26.csg.source b/test/test_song/26.csg.source similarity index 100% rename from test/test_chordpro/26.csg.source rename to test/test_song/26.csg.source diff --git a/test/test_chordpro/26.tsg b/test/test_song/26.tsg similarity index 100% rename from test/test_chordpro/26.tsg rename to test/test_song/26.tsg diff --git a/test/test_chordpro/27.csg b/test/test_song/27.csg similarity index 100% rename from test/test_chordpro/27.csg rename to test/test_song/27.csg diff --git a/test/test_chordpro/27.csg.source b/test/test_song/27.csg.source similarity index 100% rename from test/test_chordpro/27.csg.source rename to test/test_song/27.csg.source diff --git a/test/test_chordpro/27.tsg b/test/test_song/27.tsg similarity index 100% rename from test/test_chordpro/27.tsg rename to test/test_song/27.tsg diff --git a/test/test_chordpro/28.csg b/test/test_song/28.csg similarity index 100% rename from test/test_chordpro/28.csg rename to test/test_song/28.csg diff --git a/test/test_chordpro/28.csg.source b/test/test_song/28.csg.source similarity index 100% rename from test/test_chordpro/28.csg.source rename to test/test_song/28.csg.source diff --git a/test/test_chordpro/28.tsg b/test/test_song/28.tsg similarity index 100% rename from test/test_chordpro/28.tsg rename to test/test_song/28.tsg diff --git a/test/test_chordpro/29.csg b/test/test_song/29.csg similarity index 100% rename from test/test_chordpro/29.csg rename to test/test_song/29.csg diff --git a/test/test_chordpro/29.csg.source b/test/test_song/29.csg.source similarity index 100% rename from test/test_chordpro/29.csg.source rename to test/test_song/29.csg.source diff --git a/test/test_chordpro/29.tsg b/test/test_song/29.tsg similarity index 100% rename from test/test_chordpro/29.tsg rename to test/test_song/29.tsg diff --git a/test/test_chordpro/__init__.py b/test/test_song/__init__.py similarity index 100% rename from test/test_chordpro/__init__.py rename to test/test_song/__init__.py diff --git a/test/test_chordpro/author_names.csg b/test/test_song/author_names.csg similarity index 100% rename from test/test_chordpro/author_names.csg rename to test/test_song/author_names.csg diff --git a/test/test_chordpro/author_names.csg.source b/test/test_song/author_names.csg.source similarity index 100% rename from test/test_chordpro/author_names.csg.source rename to test/test_song/author_names.csg.source diff --git a/test/test_chordpro/author_names.tsg b/test/test_song/author_names.tsg similarity index 100% rename from test/test_chordpro/author_names.tsg rename to test/test_song/author_names.tsg diff --git a/test/test_chordpro/chords.csg b/test/test_song/chords.csg similarity index 100% rename from test/test_chordpro/chords.csg rename to test/test_song/chords.csg diff --git a/test/test_chordpro/chords.csg.source b/test/test_song/chords.csg.source similarity index 100% rename from test/test_chordpro/chords.csg.source rename to test/test_song/chords.csg.source diff --git a/test/test_chordpro/chords.tsg b/test/test_song/chords.tsg similarity index 100% rename from test/test_chordpro/chords.tsg rename to test/test_song/chords.tsg diff --git a/test/test_chordpro/customchords.csg b/test/test_song/customchords.csg similarity index 100% rename from test/test_chordpro/customchords.csg rename to test/test_song/customchords.csg diff --git a/test/test_chordpro/customchords.csg.source b/test/test_song/customchords.csg.source similarity index 100% rename from test/test_chordpro/customchords.csg.source rename to test/test_song/customchords.csg.source diff --git a/test/test_chordpro/customchords.tsg b/test/test_song/customchords.tsg similarity index 100% rename from test/test_chordpro/customchords.tsg rename to test/test_song/customchords.tsg diff --git a/test/test_chordpro/datadir/img/traditionnel.png b/test/test_song/datadir/img/traditionnel.png similarity index 100% rename from test/test_chordpro/datadir/img/traditionnel.png rename to test/test_song/datadir/img/traditionnel.png diff --git a/test/test_chordpro/datadir/scores/greensleeves.ly b/test/test_song/datadir/scores/greensleeves.ly similarity index 100% rename from test/test_chordpro/datadir/scores/greensleeves.ly rename to test/test_song/datadir/scores/greensleeves.ly diff --git a/test/test_chordpro/errors/invalid_content.csg.source b/test/test_song/errors/invalid_content.csg.source similarity index 100% rename from test/test_chordpro/errors/invalid_content.csg.source rename to test/test_song/errors/invalid_content.csg.source diff --git a/test/test_chordpro/greensleeves.csg b/test/test_song/greensleeves.csg similarity index 100% rename from test/test_chordpro/greensleeves.csg rename to test/test_song/greensleeves.csg diff --git a/test/test_chordpro/greensleeves.csg.source b/test/test_song/greensleeves.csg.source similarity index 100% rename from test/test_chordpro/greensleeves.csg.source rename to test/test_song/greensleeves.csg.source diff --git a/test/test_chordpro/greensleeves.tsg b/test/test_song/greensleeves.tsg similarity index 100% rename from test/test_chordpro/greensleeves.tsg rename to test/test_song/greensleeves.tsg diff --git a/test/test_song/greensleeves_latex.crlf.tsg b/test/test_song/greensleeves_latex.crlf.tsg new file mode 100644 index 00000000..5c2c33e3 --- /dev/null +++ b/test/test_song/greensleeves_latex.crlf.tsg @@ -0,0 +1 @@ +\import{@TEST_FOLDER@/}{greensleeves_latex.crlf.tsg.source} \ No newline at end of file diff --git a/test/test_song/greensleeves_latex.crlf.tsg.source b/test/test_song/greensleeves_latex.crlf.tsg.source new file mode 100644 index 00000000..ff805290 --- /dev/null +++ b/test/test_song/greensleeves_latex.crlf.tsg.source @@ -0,0 +1,2 @@ +# This content will be overwritten with `greensleeves_latex.tsg.source` content +# with windows line endings (CRLF) - for testing purposes diff --git a/test/test_song/greensleeves_latex.tsg b/test/test_song/greensleeves_latex.tsg new file mode 100644 index 00000000..0edd8826 --- /dev/null +++ b/test/test_song/greensleeves_latex.tsg @@ -0,0 +1 @@ +\import{@TEST_FOLDER@/}{greensleeves_latex.tsg.source} \ No newline at end of file diff --git a/test/test_song/greensleeves_latex.tsg.source b/test/test_song/greensleeves_latex.tsg.source new file mode 100644 index 00000000..c4bc461d --- /dev/null +++ b/test/test_song/greensleeves_latex.tsg.source @@ -0,0 +1,68 @@ +\selectlanguage{english} +\songcolumns{2} + +\beginsong{Greensleeves\\ +Un autre sous-titre\\ +Un sous titre}[ + by={ + Traditionnel }, + album={Angleterre}, + cover={img/traditionnel}, +] + +\cover + + + +\lilypond{scores/greensleeves.ly} + + + +\begin{verse} + A\[Am]las, my love, ye \[G]do me wrong + To \[Am]cast me oft dis\[E]curteously + And \[Am]I have loved \[G]you so long + De\[Am]lighting \[E]in your \[Am]companie +\end{verse} + + +\begin{chorus} + \[C]Green\[B]sleeves was \[G]all my joy + \[Am]Greensleeves was \[E]my delight + \[C]Greensleeves was my \[G]heart of gold + And \[Am]who but \[E]Ladie \[Am]Greensleeves +\end{chorus} + + +\begin{verse} + I \[Am]have been ready \[G]at your hand + To \[Am]grant what ever \[E]you would crave + I \[Am]have both waged \[G]life and land + Your \[Am]love and \[E]good will \[Am]for to have +\end{verse} + + +\begin{verse} + I \[Am]bought thee kerchers \[G]to thy head + That \[Am]were wrought fine and \[E]gallantly + I \[Am]kept thee both at \[G]boord and bed + Which \[Am]cost my \[E]purse well \[Am]favouredly +\end{verse} + + +\begin{verse} + I \[Am]bought thee peticotes \[G]of the best + The \[Am]cloth so fine as \[E]fine might be + I \[Am]gave thee jewels \[G]for thy chest + And \[Am]all this \[E]cost I \[Am]spent on thee +\end{verse} + + +\begin{verse} + Thy \[Am]smock of silke, both \[G]faire and white + With \[Am]gold embrodered \[E]gorgeously + Thy \[Am]peticote of \[G]sendall right + And \[Am]this I \[E]bought thee \[Am]gladly +\end{verse} + +\endsong diff --git a/test/test_chordpro/invalid_chord.csg b/test/test_song/invalid_chord.csg similarity index 100% rename from test/test_chordpro/invalid_chord.csg rename to test/test_song/invalid_chord.csg diff --git a/test/test_chordpro/invalid_chord.csg.source b/test/test_song/invalid_chord.csg.source similarity index 100% rename from test/test_chordpro/invalid_chord.csg.source rename to test/test_song/invalid_chord.csg.source diff --git a/test/test_chordpro/invalid_chord.tsg b/test/test_song/invalid_chord.tsg similarity index 100% rename from test/test_chordpro/invalid_chord.tsg rename to test/test_song/invalid_chord.tsg diff --git a/test/test_chordpro/invalid_customchord.csg b/test/test_song/invalid_customchord.csg similarity index 100% rename from test/test_chordpro/invalid_customchord.csg rename to test/test_song/invalid_customchord.csg diff --git a/test/test_chordpro/invalid_customchord.csg.source b/test/test_song/invalid_customchord.csg.source similarity index 100% rename from test/test_chordpro/invalid_customchord.csg.source rename to test/test_song/invalid_customchord.csg.source diff --git a/test/test_chordpro/invalid_customchord.tsg b/test/test_song/invalid_customchord.tsg similarity index 100% rename from test/test_chordpro/invalid_customchord.tsg rename to test/test_song/invalid_customchord.tsg diff --git a/test/test_chordpro/invalid_directive.csg b/test/test_song/invalid_directive.csg similarity index 100% rename from test/test_chordpro/invalid_directive.csg rename to test/test_song/invalid_directive.csg diff --git a/test/test_chordpro/invalid_directive.csg.source b/test/test_song/invalid_directive.csg.source similarity index 100% rename from test/test_chordpro/invalid_directive.csg.source rename to test/test_song/invalid_directive.csg.source diff --git a/test/test_chordpro/invalid_directive.tsg b/test/test_song/invalid_directive.tsg similarity index 100% rename from test/test_chordpro/invalid_directive.tsg rename to test/test_song/invalid_directive.tsg diff --git a/test/test_chordpro/lang.csg b/test/test_song/lang.csg similarity index 100% rename from test/test_chordpro/lang.csg rename to test/test_song/lang.csg diff --git a/test/test_chordpro/lang.csg.source b/test/test_song/lang.csg.source similarity index 100% rename from test/test_chordpro/lang.csg.source rename to test/test_song/lang.csg.source diff --git a/test/test_chordpro/metadata.csg b/test/test_song/metadata.csg similarity index 100% rename from test/test_chordpro/metadata.csg rename to test/test_song/metadata.csg diff --git a/test/test_chordpro/metadata.csg.source b/test/test_song/metadata.csg.source similarity index 100% rename from test/test_chordpro/metadata.csg.source rename to test/test_song/metadata.csg.source diff --git a/test/test_chordpro/metadata.tsg b/test/test_song/metadata.tsg similarity index 100% rename from test/test_chordpro/metadata.tsg rename to test/test_song/metadata.tsg diff --git a/test/test_chordpro/metadata_cover.png b/test/test_song/metadata_cover.png similarity index 100% rename from test/test_chordpro/metadata_cover.png rename to test/test_song/metadata_cover.png diff --git a/test/test_chordpro/metadata_image.png b/test/test_song/metadata_image.png similarity index 100% rename from test/test_chordpro/metadata_image.png rename to test/test_song/metadata_image.png diff --git a/test/test_chordpro/metadata_lilypond.ly b/test/test_song/metadata_lilypond.ly similarity index 100% rename from test/test_chordpro/metadata_lilypond.ly rename to test/test_song/metadata_lilypond.ly diff --git a/test/test_chordpro/newline.crlf.csg b/test/test_song/newline.crlf.csg similarity index 100% rename from test/test_chordpro/newline.crlf.csg rename to test/test_song/newline.crlf.csg diff --git a/test/test_chordpro/newline.crlf.csg.source b/test/test_song/newline.crlf.csg.source similarity index 100% rename from test/test_chordpro/newline.crlf.csg.source rename to test/test_song/newline.crlf.csg.source diff --git a/test/test_chordpro/newline.crlf.html b/test/test_song/newline.crlf.html similarity index 100% rename from test/test_chordpro/newline.crlf.html rename to test/test_song/newline.crlf.html diff --git a/test/test_chordpro/newline.crlf.tsg b/test/test_song/newline.crlf.tsg similarity index 100% rename from test/test_chordpro/newline.crlf.tsg rename to test/test_song/newline.crlf.tsg diff --git a/test/test_chordpro/newline.csg b/test/test_song/newline.csg similarity index 100% rename from test/test_chordpro/newline.csg rename to test/test_song/newline.csg diff --git a/test/test_chordpro/newline.csg.source b/test/test_song/newline.csg.source similarity index 100% rename from test/test_chordpro/newline.csg.source rename to test/test_song/newline.csg.source diff --git a/test/test_chordpro/newline.html b/test/test_song/newline.html similarity index 100% rename from test/test_chordpro/newline.html rename to test/test_song/newline.html diff --git a/test/test_chordpro/newline.tsg b/test/test_song/newline.tsg similarity index 100% rename from test/test_chordpro/newline.tsg rename to test/test_song/newline.tsg diff --git a/test/test_chordpro/nolyrics.csg b/test/test_song/nolyrics.csg similarity index 100% rename from test/test_chordpro/nolyrics.csg rename to test/test_song/nolyrics.csg diff --git a/test/test_chordpro/nolyrics.csg.source b/test/test_song/nolyrics.csg.source similarity index 100% rename from test/test_chordpro/nolyrics.csg.source rename to test/test_song/nolyrics.csg.source diff --git a/test/test_chordpro/nolyrics.tsg b/test/test_song/nolyrics.tsg similarity index 100% rename from test/test_chordpro/nolyrics.tsg rename to test/test_song/nolyrics.tsg diff --git a/test/test_chordpro/tags.csg b/test/test_song/tags.csg similarity index 100% rename from test/test_chordpro/tags.csg rename to test/test_song/tags.csg diff --git a/test/test_chordpro/tags.csg.source b/test/test_song/tags.csg.source similarity index 100% rename from test/test_chordpro/tags.csg.source rename to test/test_song/tags.csg.source diff --git a/test/test_chordpro/tags.tsg b/test/test_song/tags.tsg similarity index 100% rename from test/test_chordpro/tags.tsg rename to test/test_song/tags.tsg diff --git a/test/test_chordpro/test_parser.py b/test/test_song/test_parser.py similarity index 94% rename from test/test_chordpro/test_parser.py rename to test/test_song/test_parser.py index a0b5a288..ae122bdd 100644 --- a/test/test_chordpro/test_parser.py +++ b/test/test_song/test_parser.py @@ -15,7 +15,10 @@ from patacrep.encoding import open_read from .. import disable_logging from .. import dynamic # pylint: disable=unused-import -OUTPUTS = ['csg', 'tsg', 'html'] +OUTPUTS = { + 'csg': ['csg', 'tsg', 'html'], + 'tsg': ['tsg'], +} class FileTest(unittest.TestCase, metaclass=dynamic.DynamicTest): """Test of chorpro parser, and several renderers. @@ -58,9 +61,13 @@ class FileTest(unittest.TestCase, metaclass=dynamic.DynamicTest): with open_read(destname) as expectfile: with disable_logging(): song = self.song_plugins[out_format][in_format](sourcename, self.config) + expected = expectfile.read().strip().replace( + "@TEST_FOLDER@", + files.path2posix(resource_filename(__name__, "")), + ) self.assertMultiLineEqual( song.render().strip(), - expectfile.read().strip(), + expected, ) @classmethod @@ -81,7 +88,7 @@ class FileTest(unittest.TestCase, metaclass=dynamic.DynamicTest): for source in sorted(glob.glob('*.*.source')): [*base, in_format, _] = source.split('.') base = '.'.join(base) - for out_format in OUTPUTS: + for out_format in OUTPUTS[in_format]: outname = "{}.{}".format(base, out_format) if not os.path.exists(outname): continue diff --git a/test/test_chordpro/ukulelechords.csg b/test/test_song/ukulelechords.csg similarity index 100% rename from test/test_chordpro/ukulelechords.csg rename to test/test_song/ukulelechords.csg diff --git a/test/test_chordpro/ukulelechords.csg.source b/test/test_song/ukulelechords.csg.source similarity index 100% rename from test/test_chordpro/ukulelechords.csg.source rename to test/test_song/ukulelechords.csg.source diff --git a/test/test_chordpro/ukulelechords.tsg b/test/test_song/ukulelechords.tsg similarity index 100% rename from test/test_chordpro/ukulelechords.tsg rename to test/test_song/ukulelechords.tsg diff --git a/test/test_compilation/.gitignore b/test/test_songbook/.gitignore similarity index 100% rename from test/test_compilation/.gitignore rename to test/test_songbook/.gitignore diff --git a/test/test_compilation/__init__.py b/test/test_songbook/__init__.py similarity index 100% rename from test/test_compilation/__init__.py rename to test/test_songbook/__init__.py diff --git a/test/test_compilation/datadir.sb b/test/test_songbook/datadir.sb similarity index 100% rename from test/test_compilation/datadir.sb rename to test/test_songbook/datadir.sb diff --git a/test/test_compilation/datadir.tex.control b/test/test_songbook/datadir.tex.control similarity index 100% rename from test/test_compilation/datadir.tex.control rename to test/test_songbook/datadir.tex.control diff --git a/test/test_compilation/datadir_datadir/img/datadir.png b/test/test_songbook/datadir_datadir/img/datadir.png similarity index 100% rename from test/test_compilation/datadir_datadir/img/datadir.png rename to test/test_songbook/datadir_datadir/img/datadir.png diff --git a/test/test_compilation/datadir_datadir/scores/datadir.ly b/test/test_songbook/datadir_datadir/scores/datadir.ly similarity index 100% rename from test/test_compilation/datadir_datadir/scores/datadir.ly rename to test/test_songbook/datadir_datadir/scores/datadir.ly diff --git a/test/test_compilation/datadir_datadir/songs/datadir.csg b/test/test_songbook/datadir_datadir/songs/datadir.csg similarity index 100% rename from test/test_compilation/datadir_datadir/songs/datadir.csg rename to test/test_songbook/datadir_datadir/songs/datadir.csg diff --git a/test/test_compilation/datadir_datadir/songs/datadir.tsg b/test/test_songbook/datadir_datadir/songs/datadir.tsg similarity index 100% rename from test/test_compilation/datadir_datadir/songs/datadir.tsg rename to test/test_songbook/datadir_datadir/songs/datadir.tsg diff --git a/test/test_compilation/datadir_datadir/songs/datadir2.csg b/test/test_songbook/datadir_datadir/songs/datadir2.csg similarity index 100% rename from test/test_compilation/datadir_datadir/songs/datadir2.csg rename to test/test_songbook/datadir_datadir/songs/datadir2.csg diff --git a/test/test_compilation/datadir_datadir/songs/datadir2.sg b/test/test_songbook/datadir_datadir/songs/datadir2.sg similarity index 100% rename from test/test_compilation/datadir_datadir/songs/datadir2.sg rename to test/test_songbook/datadir_datadir/songs/datadir2.sg diff --git a/test/test_compilation/datadir_datadir/songs/relative.csg b/test/test_songbook/datadir_datadir/songs/relative.csg similarity index 100% rename from test/test_compilation/datadir_datadir/songs/relative.csg rename to test/test_songbook/datadir_datadir/songs/relative.csg diff --git a/test/test_compilation/datadir_datadir/songs/relative.ly b/test/test_songbook/datadir_datadir/songs/relative.ly similarity index 100% rename from test/test_compilation/datadir_datadir/songs/relative.ly rename to test/test_songbook/datadir_datadir/songs/relative.ly diff --git a/test/test_compilation/datadir_datadir/songs/relative.png b/test/test_songbook/datadir_datadir/songs/relative.png similarity index 100% rename from test/test_compilation/datadir_datadir/songs/relative.png rename to test/test_songbook/datadir_datadir/songs/relative.png diff --git a/test/test_compilation/datadir_datadir/songs/relative.tsg b/test/test_songbook/datadir_datadir/songs/relative.tsg similarity index 100% rename from test/test_compilation/datadir_datadir/songs/relative.tsg rename to test/test_songbook/datadir_datadir/songs/relative.tsg diff --git a/test/test_compilation/datadir_datadir/songs/subdir/subdir.csg b/test/test_songbook/datadir_datadir/songs/subdir/subdir.csg similarity index 100% rename from test/test_compilation/datadir_datadir/songs/subdir/subdir.csg rename to test/test_songbook/datadir_datadir/songs/subdir/subdir.csg diff --git a/test/test_compilation/datadir_datadir/songs/subdir/subdir.ly b/test/test_songbook/datadir_datadir/songs/subdir/subdir.ly similarity index 100% rename from test/test_compilation/datadir_datadir/songs/subdir/subdir.ly rename to test/test_songbook/datadir_datadir/songs/subdir/subdir.ly diff --git a/test/test_compilation/datadir_datadir/songs/subdir/subdir.png b/test/test_songbook/datadir_datadir/songs/subdir/subdir.png similarity index 100% rename from test/test_compilation/datadir_datadir/songs/subdir/subdir.png rename to test/test_songbook/datadir_datadir/songs/subdir/subdir.png diff --git a/test/test_compilation/datadir_datadir/songs/subdir/subdir.tsg b/test/test_songbook/datadir_datadir/songs/subdir/subdir.tsg similarity index 100% rename from test/test_compilation/datadir_datadir/songs/subdir/subdir.tsg rename to test/test_songbook/datadir_datadir/songs/subdir/subdir.tsg diff --git a/test/test_compilation/datadir_datadir2/img/datadir2.png b/test/test_songbook/datadir_datadir2/img/datadir2.png similarity index 100% rename from test/test_compilation/datadir_datadir2/img/datadir2.png rename to test/test_songbook/datadir_datadir2/img/datadir2.png diff --git a/test/test_compilation/datadir_datadir2/scores/datadir2.ly b/test/test_songbook/datadir_datadir2/scores/datadir2.ly similarity index 100% rename from test/test_compilation/datadir_datadir2/scores/datadir2.ly rename to test/test_songbook/datadir_datadir2/scores/datadir2.ly diff --git a/test/test_compilation/languages.sb b/test/test_songbook/languages.sb similarity index 100% rename from test/test_compilation/languages.sb rename to test/test_songbook/languages.sb diff --git a/test/test_compilation/languages.tex.control b/test/test_songbook/languages.tex.control similarity index 100% rename from test/test_compilation/languages.tex.control rename to test/test_songbook/languages.tex.control diff --git a/test/test_compilation/languages_datadir/songs/language.csg b/test/test_songbook/languages_datadir/songs/language.csg similarity index 100% rename from test/test_compilation/languages_datadir/songs/language.csg rename to test/test_songbook/languages_datadir/songs/language.csg diff --git a/test/test_compilation/languages_datadir/songs/language_location.csg b/test/test_songbook/languages_datadir/songs/language_location.csg similarity index 100% rename from test/test_compilation/languages_datadir/songs/language_location.csg rename to test/test_songbook/languages_datadir/songs/language_location.csg diff --git a/test/test_compilation/languages_datadir/songs/no_language.csg b/test/test_songbook/languages_datadir/songs/no_language.csg similarity index 100% rename from test/test_compilation/languages_datadir/songs/no_language.csg rename to test/test_songbook/languages_datadir/songs/no_language.csg diff --git a/test/test_compilation/languages_datadir/songs/wrong_language.csg b/test/test_songbook/languages_datadir/songs/wrong_language.csg similarity index 100% rename from test/test_compilation/languages_datadir/songs/wrong_language.csg rename to test/test_songbook/languages_datadir/songs/wrong_language.csg diff --git a/test/test_compilation/languages_datadir/songs/wrong_location.csg b/test/test_songbook/languages_datadir/songs/wrong_location.csg similarity index 100% rename from test/test_compilation/languages_datadir/songs/wrong_location.csg rename to test/test_songbook/languages_datadir/songs/wrong_location.csg diff --git a/test/test_compilation/syntax.sb b/test/test_songbook/syntax.sb similarity index 100% rename from test/test_compilation/syntax.sb rename to test/test_songbook/syntax.sb diff --git a/test/test_compilation/syntax.tex.control b/test/test_songbook/syntax.tex.control similarity index 100% rename from test/test_compilation/syntax.tex.control rename to test/test_songbook/syntax.tex.control diff --git a/test/test_compilation/syntax_datadir/songs/musicnote.csg b/test/test_songbook/syntax_datadir/songs/musicnote.csg similarity index 100% rename from test/test_compilation/syntax_datadir/songs/musicnote.csg rename to test/test_songbook/syntax_datadir/songs/musicnote.csg diff --git a/test/test_compilation/test_compilation.py b/test/test_songbook/test_compilation.py similarity index 100% rename from test/test_compilation/test_compilation.py rename to test/test_songbook/test_compilation.py diff --git a/test/test_compilation/unicode.sb b/test/test_songbook/unicode.sb similarity index 100% rename from test/test_compilation/unicode.sb rename to test/test_songbook/unicode.sb diff --git a/test/test_compilation/unicode.tex.control b/test/test_songbook/unicode.tex.control similarity index 100% rename from test/test_compilation/unicode.tex.control rename to test/test_songbook/unicode.tex.control diff --git a/test/test_compilation/unicode_datadir/songs/nonbreak.csg b/test/test_songbook/unicode_datadir/songs/nonbreak.csg similarity index 100% rename from test/test_compilation/unicode_datadir/songs/nonbreak.csg rename to test/test_songbook/unicode_datadir/songs/nonbreak.csg