Retain selected glossary instructions
This commit is contained in:
@@ -92,6 +92,29 @@ func TestResolveModuleRunSpecs(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestResolveGlossaryInstructions(t *testing.T) {
|
||||
cfg := &config.Config{
|
||||
GlossaryCollections: map[string]config.GlossaryCollection{
|
||||
"one": {Instruction: "First"}, "two": {Instruction: "Second"}, "protected": {Instruction: "Protection only"},
|
||||
},
|
||||
Pipeline: config.Pipeline{Stages: []config.Stage{
|
||||
{Module: "grammar", Glossaries: []string{"two", "one"}, ProtectedTerms: []string{"protected"}},
|
||||
{Module: "grammar", Glossaries: []string{"two", "one"}, ProtectedTerms: []string{"protected"}},
|
||||
{Module: "grammar", Glossaries: []string{"one"}, ProtectedTerms: []string{"protected"}},
|
||||
}},
|
||||
}
|
||||
specs := ResolveModuleRunSpecs(cfg)
|
||||
want := []GlossaryInstruction{{Collection: "two", Text: "Second"}, {Collection: "one", Text: "First"}}
|
||||
for _, spec := range specs[:2] {
|
||||
if !reflect.DeepEqual(spec.GlossaryInstructions, want) {
|
||||
t.Fatalf("instructions = %+v, want %+v", spec.GlossaryInstructions, want)
|
||||
}
|
||||
}
|
||||
if !reflect.DeepEqual(specs[2].GlossaryInstructions, want[1:]) {
|
||||
t.Fatalf("specific selection = %+v", specs[2].GlossaryInstructions)
|
||||
}
|
||||
}
|
||||
|
||||
func TestSectionMetadataFromSection(t *testing.T) {
|
||||
section := chunking.Section{
|
||||
Index: 3,
|
||||
|
||||
Reference in New Issue
Block a user