Keep = signs in opcode values
An opcode's value now ends at whitespace followed by the next opcode, so sample=A=440.wav is one value. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -285,3 +285,27 @@ func TestBuildVariablesWithAbsoluteSamples(t *testing.T) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// TestEqualsInValue checks that a value may hold =, and that the next opcode
|
||||
// starts only after whitespace.
|
||||
func TestEqualsInValue(t *testing.T) {
|
||||
for text, want := range map[string][]string{
|
||||
"<region> sample=A=440.wav lokey=1": {"sample=A=440.wav", "lokey=1"},
|
||||
"<region> sample=a b=c.wav": {"sample=a", "b=c.wav"},
|
||||
"<region>sample=x.wav\n lokey=1\thikey=2": {"sample=x.wav", "lokey=1", "hikey=2"},
|
||||
"label_cc1=Volume=Loud // note": {"label_cc1=Volume=Loud"},
|
||||
// Without whitespace, what follows is part of the value.
|
||||
"lokey=1hikey=2": {"lokey=1hikey=2"},
|
||||
} {
|
||||
doc := mustParse(t, text, nil)
|
||||
var got []string
|
||||
for _, n := range doc.Root.Nodes {
|
||||
if n.Kind == KindOpcode {
|
||||
got = append(got, n.Name+"="+n.Value)
|
||||
}
|
||||
}
|
||||
if !reflect.DeepEqual(got, want) || doc.String() != text {
|
||||
t.Errorf("%q: opcodes %q, want %q", text, got, want)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user