Index roster names with Unicode case folding
This commit is contained in:
@@ -2,12 +2,34 @@ package config
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"go.maximumdirect.net/configkit"
|
||||
)
|
||||
|
||||
func TestPartyAmbiguityUsesUnicodeSimpleFold(t *testing.T) {
|
||||
for _, pair := range [][2]string{{"Σ", "ς"}, {"K", "K"}, {"Arannis", "ARANNIS"}} {
|
||||
for _, location := range []string{"alias", "character", "class"} {
|
||||
details := fmt.Sprintf("name: %q, classes: [{name: wizard}]", pair[0])
|
||||
extra := ""
|
||||
switch location {
|
||||
case "alias":
|
||||
details += fmt.Sprintf(", aliases: [%q]", pair[1])
|
||||
case "character":
|
||||
extra = fmt.Sprintf(" second:\n player: {name: Player}\n character: {name: %q, classes: [{name: wizard}]}\n", pair[1])
|
||||
case "class":
|
||||
details = fmt.Sprintf("name: First, classes: [{name: %q}, {name: %q}]", pair[0], pair[1])
|
||||
}
|
||||
data := fmt.Sprintf("schema_version: maximumdirect.rpg.party.v1\ncharacters:\n first:\n player: {name: Player}\n character: {%s}\n%s", details, extra)
|
||||
if _, err := ParseParty([]byte(data)); err == nil {
|
||||
t.Fatalf("accepted %s ambiguity for %q", location, pair)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestPartyPreservesSharedExtensionsAndAliasPresence(t *testing.T) {
|
||||
input := []byte(`schema_version: maximumdirect.rpg.party.v1
|
||||
custom: {setting: synthetic}
|
||||
|
||||
Reference in New Issue
Block a user