mirror of
https://github.com/alda-lang/alda.git
synced 2026-02-27 18:24:13 +01:00
46 lines
1.1 KiB
Go
46 lines
1.1 KiB
Go
package parser
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"alda.io/client/model"
|
|
_ "alda.io/client/testing"
|
|
)
|
|
|
|
func TestComments(t *testing.T) {
|
|
executeParseTestCases(
|
|
t,
|
|
parseTestCase{
|
|
label: "simple comment",
|
|
given: `piano: c
|
|
# d
|
|
e`,
|
|
expectUpdates: []model.ScoreUpdate{
|
|
model.PartDeclaration{Names: []string{"piano"}},
|
|
model.Note{Pitch: model.LetterAndAccidentals{NoteLetter: model.C}},
|
|
model.Note{Pitch: model.LetterAndAccidentals{NoteLetter: model.E}},
|
|
},
|
|
},
|
|
parseTestCase{
|
|
label: "comment at the end of a line",
|
|
given: `piano: c # d
|
|
e`,
|
|
expectUpdates: []model.ScoreUpdate{
|
|
model.PartDeclaration{Names: []string{"piano"}},
|
|
model.Note{Pitch: model.LetterAndAccidentals{NoteLetter: model.C}},
|
|
model.Note{Pitch: model.LetterAndAccidentals{NoteLetter: model.E}},
|
|
},
|
|
},
|
|
parseTestCase{
|
|
label: "comment without a leading space",
|
|
given: `piano: c #d
|
|
e`,
|
|
expectUpdates: []model.ScoreUpdate{
|
|
model.PartDeclaration{Names: []string{"piano"}},
|
|
model.Note{Pitch: model.LetterAndAccidentals{NoteLetter: model.C}},
|
|
model.Note{Pitch: model.LetterAndAccidentals{NoteLetter: model.E}},
|
|
},
|
|
},
|
|
)
|
|
}
|