Browse Source

[test] Refine tests. Untested draft of fix.

pull/213/head
Louis 9 years ago
parent
commit
443e8509a1
  1. 8
      patacrep/songs/chordpro/lexer.py
  2. 0
      test/test_song/latex.csg
  3. 9
      test/test_song/latex.csg.source
  4. 0
      test/test_song/latex.tsg
  5. 8
      test/test_songbook/latex_special_datadir/songs/special.csg

8
patacrep/songs/chordpro/lexer.py

@ -30,6 +30,8 @@ tokens = (
'EE',
)
literals = [ '{', '}', "\\", ' ' ]
class ChordProLexer:
"""ChordPro Lexer class"""
# pylint: disable=too-many-public-methods
@ -150,6 +152,12 @@ class ChordProLexer:
self.lexer.push_state('directiveargument')
return token
@staticmethod
def t_literal(token):
r'\[{} \]'
t.type = t.type[1]
return t
def error(self, token, more=""):
"""Display error message, and skip illegal token."""
message = "Illegal character '{char}'{more}.".format(

0
test/test_song/latex.csg

9
test/test_song/latex.csg.source

@ -0,0 +1,9 @@
{title: & $ % # _ \} \{ ~ ^ \\}
{artist: & $ % # _ \} \{ ~ ^ \\}
{album: & $ % # _ \} \{ ~ ^ \\}
& $ % # _ \} \{ ~ ^ \\
{start_of_chorus}
& $ % # _ \} \{ ~ ^ \\
{end_of_chorus}

0
test/test_song/latex.tsg

8
test/test_songbook/latex_special_datadir/songs/special.csg

@ -1,8 +1,8 @@
{title : & % $ # _ } { ~ ^ \ }
{by: & % $ # _ } { ~ ^ \ }
{title : & % $ # _ \} \{ ~ ^ \\ }
{by: & % $ # _ }\ \{ ~ ^ \\ }
& % $ # _ } { ~ ^ \
& % $ # _ }\ \{ ~ ^ \\
{soc}
& % $ # _ } { ~ ^ \
& % $ # _ }\ \{ ~ ^ \\
{eoc}

Loading…
Cancel
Save