X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=input%2Fregression%2Fautomatic-polyphony-context-id.ly;fp=input%2Fregression%2Fautomatic-polyphony-context-id.ly;h=a825222600af6f05eff90558de556b2e73de96a8;hb=941dff9d2a67080e0dd8474f1e70f0c72ace6424;hp=0000000000000000000000000000000000000000;hpb=5a22d6233a39d3164e1ca043244794c268be4ad0;p=lilypond.git diff --git a/input/regression/automatic-polyphony-context-id.ly b/input/regression/automatic-polyphony-context-id.ly new file mode 100644 index 0000000000..a825222600 --- /dev/null +++ b/input/regression/automatic-polyphony-context-id.ly @@ -0,0 +1,36 @@ +\version "2.14.0" + +\header { + texidoc = "The bottom-level contexts in polyphony shorthand are +allocated a context id in order of creation, starting with +@code{\"1\"}. +This snippet will fail to compile if either voice has an invalid +@code{context-id} string. +" +} + +assertContextId = +#(define-music-function (parser location id) (string?) + (let ((music (make-music 'ApplyContext + 'procedure + (lambda (ctx) + (and + (not (string=? (ly:context-id ctx) id)) + (ly:error "context-id mismatch found: expecting ~s, got ~s" + id + (ly:context-id ctx))))))) + music)) + +\relative c'' { + << + { + \assertContextId "1" + c4 d e2 + } + \\ + { + \assertContextId "2" + a,4 b c2 + } + >> +}