3 #(use-modules (srfi srfi-13)
10 #(define (parse-lily-and-compute-lily-string chr port)
11 (let ((lily-string (call-with-output-string
13 (do ((c (read-char port) (read-char port)))
15 (char=? (peek-char port) #\]))
18 `(let* ((parser-clone (ly:parser-clone parser))
19 (input-str (string-trim-both ,lily-string))
20 (music (car (ly:music-property (parse-string-result input-str
23 (result-str (string-trim-both (music->lily-string music parser-clone))))
24 (cons input-str result-str))))
26 #(read-hash-extend #\[ parse-lily-and-compute-lily-string) %{ ] %}
28 #(define (lily-string->markup str)
29 (make-column-markup (string-split str #\NewLine)))
31 #(define test-function
32 (let ((test-number 0))
33 (lambda (parser location result-info strings)
34 (let ((input (car strings))
35 (output (cdr strings)))
36 (set! test-number (1+ test-number))
37 (if (not (equal? input output))
38 (ly:progress "Test ~a unequal: ~a. \nin = ~a\nout = ~a\n"
45 (make-music 'SequentialMusic 'void #t)
50 #(define-music-function (parser location result-info strings) (string? pair?)
51 (test-function parser location result-info strings))
57 texidoc = "This is a test of the display-lily-music unit. Problems are reported on the
66 \override StaffSymbol #'line-count = #1
67 \remove "Time_signature_engraver"
68 \remove "Clef_engraver"
72 \remove "Bar_number_engraver"
77 \test "" ##[ { { a b } { c d } } #] % SequentialMusic
78 \test "" ##[ << { a b } { c d } >> #] % SimultaneousMusic
79 \test "" ##[ << { a b } \\ { c d } >> #] % VoiceSeparator
82 \test "" ##[ { ceses ces c cis cisis } #] % NoteEvent
83 \test "" ##[ { deses des d dis disis } #]
84 \test "" ##[ { eeses ees e eis eisis } #]
85 \test "" ##[ { feses fes f fis fisis } #]
86 \test "" ##[ { geses ges g gis gisis } #]
87 \test "" ##[ { aeses aes a ais aisis } #]
88 \test "" ##[ { beses bes b bis bisis } #]
89 \test "" ##[ { c,, d' } #]
90 \test "" ##[ { c' d'=' } #]
91 \test "" ##[ { c! c? } #]
92 \test "" ##[ r1.*4/3 #] % RestEvent
93 \test "" ##[ c1\rest #] % RestEvent
94 \test "" ##[ s2..*3/4 #] % SkipEvent
95 \test "" ##[ R1.*2/3 #] % MultiMeasureRestMusicGroup, MultiMeasureRestEvent
96 \test "" ##[ \skip 2.*3/4 #] % SkipMusic
97 \test "" ##[ < c\1 e\3 >4.*3/4-. #] % EventChord, NoteEvent, StringNumberEvent, ArticulationEvent
100 \test "" ##[ { \tag #'foo { c4 d } } #]
101 \test "" ##[ c-\tag #'foo -\tag #'baz -^ -. #]
104 \test "" ##[ { \grace c8 d2 } #] % GraceMusic
105 \test "" ##[ { \appoggiatura c8 d2 } #]
106 \test "" ##[ { \acciaccatura c8 d2 } #]
107 \test "" ##[ { c1 \afterGrace { b,16 c } d2 } #]
110 \test "" ##[ { \makeClusters { c4 g } } #] % ClusterNoteEvent
113 \test "" ##[ \figures { < 6 > } #] % BassFigureEvent
114 \test "" ##[ \figuremode { < 1-- 3- > < 2+ 4++ > < _! 7! > } #]
115 \test "" ##[ \figuremode { < [6 > < 5] > } #]
118 \test "" ##[ \lyrics { a b } #]
119 \test "" ##[ \lyricmode { a -- b } #] % HyphenEvent
120 \test "" ##[ \lyricmode { a __ b } #] % ExtenderEvent
121 \test "" ##[ \lyricmode { "a " } #] % LyricEvent
122 \test "" ##[ \lyricsto "foo" { bla bla } #] % LyricCombineMusic
123 \test "" ##[ { { c d }
124 \addlyrics { bla bla } } #]
127 \test "" ##[ \drums { hihat } #]
128 \test "" ##[ \drummode { hihat4.*3/4 } #]
131 \test "" ##[ c4 ~ #] % TieEvent
132 \test "" ##[ c\noBeam #] % BeamForbidEvent
133 \test "" ##[ c\1 #] % StringNumberEvent
134 \test "" ##[ { c: c:1 } #] % TremoloEvent
135 \test "" ##[ { c-^ c^^ c_^ } #] % ArticulationEvent
136 \test "" ##[ { c-+ c^+ c_+ } #]
137 \test "" ##[ { c-- c^- c_- } #]
138 \test "" ##[ { c-| c^| c_| } #]
139 \test "" ##[ { c-> c^> c_> } #]
140 \test "" ##[ { c-. c^. c_. } #]
141 \test "" ##[ { c-_ c^_ c__ } #]
142 \test "" ##[ { c-\trill c^\trill c_\trill } #]
143 \test "" ##[ { c-1 c^2 c_3 } #] % FingerEvent
144 \test "" ##[ { c-"foo" c^"foo" c_"foo" } #] % TextScriptEvent
145 \test "" ##[ { R1*4-"foo" R^"foo" R_"foo" } #] % MultiMeasureTextEvent
146 \test "" ##[ { c4-\harmonic c^\harmonic c_\harmonic } #] % HarmonicEvent
147 \test "" ##[ { c-\glissando c^\glissando c_\glissando } #] % GlissandoEvent
148 \test "" ##[ { c-\arpeggio c^\arpeggio c_\arpeggio } #] % ArpeggioEvent
149 \test "" ##[ { c\p c^\ff c_\sfz } #] % AbsoluteDynamicEvent
150 \test "" ##[ { c[ c] c^[ c^] c_[ c_] } #] % BeamEvent
151 \test "" ##[ { c( c) c^( c^) c_( c_) } #] % SlurEvent
152 \test "" ##[ { c\< c\! c^\< c^\! c_\< c_\! } #] % CrescendoEvent
153 \test "" ##[ { c\> c\! c^\> c^\! c_\> c_\! } #] % DecrescendoEvent
154 \test "" ##[ { c\( c\) c^\( c^\) c_\( c_\) } #] % PhrasingSlurEvent
155 \test "" ##[ { c\sustainDown c\sustainUp } #] % SustainEvent
156 \test "" ##[ { c\sostenutoDown c\sostenutoUp } #] % SostenutoEvent
157 \test "" ##[ \melisma #]
158 \test "" ##[ \melismaEnd #]
159 \test "" ##[ { c\startTextSpan c\stopTextSpan } #] % TextSpanEvent
160 \test "" ##[ { c\startTrillSpan c\stopTrillSpan } #] % TrillSpanEvent
161 \test "" ##[ { c \startStaff c \stopStaff } #] % StaffSpanEvent
162 \test "" ##[ { c\startGroup c\stopGroup c^\startGroup c^\stopGroup c_\startGroup c_\stopGroup } #] % NoteGroupingEvent
163 \test "" ##[ { c\unaCorda c\treCorde } #] % UnaCordaEvent
164 \test "" ##[ \breathe #]
165 \test "" ##[ { c \[ c \] } #] % LigatureEvent
166 \test "" ##[ \~ #] % PesOrFlexaEvent
168 \test "" ##[ \break #]
169 \test "" ##[ \noBreak #]
170 \test "" ##[ \pageBreak #]
171 \test "" ##[ \noPageBreak #]
172 \test "" ##[ \pageTurn #]
173 \test "" ##[ \noPageTurn #]
176 \test "" ##[ \octave a' #] % RelativeOctaveCheck
177 \test "" ##[ | #] % BarCheck
180 \test "" ##[ \mark \default #] % MarkEvent
181 \test "" ##[ \mark "Allegro" #]
182 \test "" ##[ \tempo 4 = 120 #] % MetronomeChangeEvent
184 %% key, time, clef, bar
185 \test "" ##[ \key \default #] % KeyChangeEvent
186 \test "" ##[ \key e \minor #]
187 \test "" ##[ \clef "bass" #]
188 \test "" ##[ \clef "french^2" #]
189 \test "" ##[ \clef "alto_3" #]
190 \test "" ##[ \time 2/4 #]
191 \test "" ##[ #(set-time-signature 5 8 '(3 2)) #]
192 \test "" ##[ \bar "|." #]
195 \test "" ##[ \autochange { c d } #] % AutoChangeMusic
196 \test "" ##[ { \change Staff = "up" { c d } } #] % ContextChange
199 \test "" ##[ \times 2/3 { c8 d e } #] % TimeScaledMusic
200 \test "" ##[ \times 4/6 { c16 d e f g a } #]
202 %% \relative and \tranpose
203 \test #"NOT A BUG" ##[ \relative c' { c b } #] % RelativeOctaveMusic
204 \test #"NOT A BUG" ##[ \transpose c d { c d } #] % TransposedMusic
207 \test "" ##[ \repeat volta 2 { c d } #] % VoltaRepeatedMusic
208 \test "" ##[ \repeat unfold 2 { c d } #] % UnfoldedRepeatedMusic
209 \test "" ##[ \repeat fold 2 { c d } #] % FoldedRepeatedMusic
210 \test "" ##[ \repeat percent 2 { c d } #] % PercentRepeatedMusic
211 \test "" ##[ \repeat tremolo 4 { c16 d } #] % TremoloRepeatedMusic
212 \test "" ##[ \repeat volta 2 { c4 d } \alternative { { c d } { e f } } #] %
215 \test "" ##[ \new Staff { c d } #] % ContextSpeccedMusic
216 \test "" ##[ \new Staff = "up" { c d } #] % ContextSpeccedMusic
217 \test "" ##[ \context Staff { c d } #]
218 \test "" ##[ \context Staff = "up" { c d } #]
221 \consists "Timing_engraver"
222 \remove "Clef_engraver"
224 %% Context properties
225 \test "" ##[ \once \set Score . skipBars = ##t #] % PropertySet
226 \test "" ##[ \set autoBeaming = ##f #]
227 \test "" ##[ \unset Score . skipBars #] % PropertyUnset
228 \test "" ##[ \unset autoBeaming #]
230 \test "" ##[ \override Staff . Stem #'thickness = #4.0 #] % OverrideProperty
231 \test "" ##[ \once \override Beam #'thickness = #0.6 #]
232 \test "" ##[ \revert Staff . Stem #'thickness #] % RevertProperty
233 \test "" ##[ \revert Beam #'thickness #]
236 \test "" ##[ \applyOutput #'Foo #(lambda (arg) (list)) #]
238 \test "" ##[ \applyContext #(lambda (arg) (list)) #]
241 \test "" ##[ \partial 2 #]
242 \test "" ##[ \partial 8. #]
243 \test #"TODO? exotic durations in \\partial" ##[ \partial 4*2/3 #]
246 \test "" ##[ \partcombine { c e }
247 { d f } #] % PartCombineMusic UnrelativableMusic
250 \test "" ##[ \cueDuring #"foo" #1 { c d } #]
251 \test "" ##[ \quoteDuring #"foo" { c d } #]
256 #(read-hash-extend #\[ #f) %{ ] %}