name string
text string
}{
- {"unknown field", `{"endpont": "api"}`},
- {"unknown nested field", `{"compactor": {"modle": "x"}}`},
- {"endpoint URL", `{"endpoint": "https://example.com/v1/responses"}`},
- {"empty model", `{"compactor": {"model": ""}}`},
- {"second object", `{} {}`},
- {"broken JSON", `{"endpoint": `},
+ {
+ name: "unknown field",
+ text: `{"endpont": "api"}`,
+ },
+ {
+ name: "unknown nested field",
+ text: `{"compactor": {"modle": "x"}}`,
+ },
+ {
+ name: "endpoint URL",
+ text: `{"endpoint": "https://example.com/v1/responses"}`,
+ },
+ {
+ name: "empty model",
+ text: `{"compactor": {"model": ""}}`,
+ },
+ {
+ name: "second object",
+ text: `{} {}`,
+ },
+ {
+ name: "broken JSON",
+ text: `{"endpoint": `,
+ },
}
for _, tc := range testCases {
home string
want string
}{
- {"ONECHAT_DIR first", filepath.Join(root, "a"), filepath.Join(root, "xdg"), root, filepath.Join(root, "a")},
- {"absolute XDG_DATA_HOME", "", filepath.Join(root, "xdg"), root, filepath.Join(root, "xdg", "onechat")},
- {"relative XDG_DATA_HOME ignored", "", "xdg", root, filepath.Join(root, ".local", "share", "onechat")},
- {"home directory last", "", "", root, filepath.Join(root, ".local", "share", "onechat")},
+ {
+ name: "ONECHAT_DIR first",
+ dir: filepath.Join(root, "a"),
+ xdg: filepath.Join(root, "xdg"),
+ home: root,
+ want: filepath.Join(root, "a"),
+ },
+ {
+ name: "absolute XDG_DATA_HOME",
+ dir: "",
+ xdg: filepath.Join(root, "xdg"),
+ home: root,
+ want: filepath.Join(root, "xdg", "onechat"),
+ },
+ {
+ name: "relative XDG_DATA_HOME ignored",
+ dir: "",
+ xdg: "xdg",
+ home: root,
+ want: filepath.Join(root, ".local", "share", "onechat"),
+ },
+ {
+ name: "home directory last",
+ dir: "",
+ xdg: "",
+ home: root,
+ want: filepath.Join(root, ".local", "share", "onechat"),
+ },
}
for _, tc := range testCases {