|
|
|
@ -28,7 +28,7 @@ func TestParseDefaultConfig(t *testing.T) {
|
|
|
|
|
},
|
|
|
|
|
DefaultTitle: "Untitled",
|
|
|
|
|
Lang: "en",
|
|
|
|
|
Ignore: []string{},
|
|
|
|
|
Exclude: []string{},
|
|
|
|
|
},
|
|
|
|
|
Groups: make(map[string]GroupConfig),
|
|
|
|
|
Format: FormatConfig{
|
|
|
|
@ -81,7 +81,7 @@ func TestParseComplete(t *testing.T) {
|
|
|
|
|
id-charset = "alphanum"
|
|
|
|
|
id-length = 4
|
|
|
|
|
id-case = "lower"
|
|
|
|
|
ignore = ["ignored", ".git"]
|
|
|
|
|
exclude = ["ignored", ".git"]
|
|
|
|
|
|
|
|
|
|
[format.markdown]
|
|
|
|
|
hashtags = false
|
|
|
|
@ -124,7 +124,7 @@ func TestParseComplete(t *testing.T) {
|
|
|
|
|
id-charset = "letters"
|
|
|
|
|
id-length = 8
|
|
|
|
|
id-case = "mixed"
|
|
|
|
|
ignore = ["new-ignored"]
|
|
|
|
|
exclude = ["new-ignored"]
|
|
|
|
|
|
|
|
|
|
[group.log.extra]
|
|
|
|
|
log-ext = "value"
|
|
|
|
@ -162,7 +162,7 @@ func TestParseComplete(t *testing.T) {
|
|
|
|
|
},
|
|
|
|
|
Lang: "fr",
|
|
|
|
|
DefaultTitle: "Sans titre",
|
|
|
|
|
Ignore: []string{"ignored", ".git"},
|
|
|
|
|
Exclude: []string{"ignored", ".git"},
|
|
|
|
|
},
|
|
|
|
|
Groups: map[string]GroupConfig{
|
|
|
|
|
"log": {
|
|
|
|
@ -178,7 +178,7 @@ func TestParseComplete(t *testing.T) {
|
|
|
|
|
},
|
|
|
|
|
Lang: "de",
|
|
|
|
|
DefaultTitle: "Ohne Titel",
|
|
|
|
|
Ignore: []string{"ignored", ".git", "new-ignored"},
|
|
|
|
|
Exclude: []string{"ignored", ".git", "new-ignored"},
|
|
|
|
|
},
|
|
|
|
|
Extra: map[string]string{
|
|
|
|
|
"hello": "world",
|
|
|
|
@ -199,7 +199,7 @@ func TestParseComplete(t *testing.T) {
|
|
|
|
|
},
|
|
|
|
|
Lang: "fr",
|
|
|
|
|
DefaultTitle: "Sans titre",
|
|
|
|
|
Ignore: []string{"ignored", ".git"},
|
|
|
|
|
Exclude: []string{"ignored", ".git"},
|
|
|
|
|
},
|
|
|
|
|
Extra: map[string]string{
|
|
|
|
|
"hello": "world",
|
|
|
|
@ -219,7 +219,7 @@ func TestParseComplete(t *testing.T) {
|
|
|
|
|
},
|
|
|
|
|
Lang: "fr",
|
|
|
|
|
DefaultTitle: "Sans titre",
|
|
|
|
|
Ignore: []string{"ignored", ".git"},
|
|
|
|
|
Exclude: []string{"ignored", ".git"},
|
|
|
|
|
},
|
|
|
|
|
Extra: map[string]string{
|
|
|
|
|
"hello": "world",
|
|
|
|
@ -286,7 +286,7 @@ func TestParseMergesGroupConfig(t *testing.T) {
|
|
|
|
|
id-charset = "letters"
|
|
|
|
|
id-length = 42
|
|
|
|
|
id-case = "upper"
|
|
|
|
|
ignore = ["ignored", ".git"]
|
|
|
|
|
exclude = ["ignored", ".git"]
|
|
|
|
|
|
|
|
|
|
[extra]
|
|
|
|
|
hello = "world"
|
|
|
|
@ -319,7 +319,7 @@ func TestParseMergesGroupConfig(t *testing.T) {
|
|
|
|
|
},
|
|
|
|
|
Lang: "fr",
|
|
|
|
|
DefaultTitle: "Sans titre",
|
|
|
|
|
Ignore: []string{"ignored", ".git"},
|
|
|
|
|
Exclude: []string{"ignored", ".git"},
|
|
|
|
|
},
|
|
|
|
|
Groups: map[string]GroupConfig{
|
|
|
|
|
"log": {
|
|
|
|
@ -335,7 +335,7 @@ func TestParseMergesGroupConfig(t *testing.T) {
|
|
|
|
|
},
|
|
|
|
|
Lang: "fr",
|
|
|
|
|
DefaultTitle: "Sans titre",
|
|
|
|
|
Ignore: []string{"ignored", ".git"},
|
|
|
|
|
Exclude: []string{"ignored", ".git"},
|
|
|
|
|
},
|
|
|
|
|
Extra: map[string]string{
|
|
|
|
|
"hello": "override",
|
|
|
|
@ -356,7 +356,7 @@ func TestParseMergesGroupConfig(t *testing.T) {
|
|
|
|
|
},
|
|
|
|
|
Lang: "fr",
|
|
|
|
|
DefaultTitle: "Sans titre",
|
|
|
|
|
Ignore: []string{"ignored", ".git"},
|
|
|
|
|
Exclude: []string{"ignored", ".git"},
|
|
|
|
|
},
|
|
|
|
|
Extra: map[string]string{
|
|
|
|
|
"hello": "world",
|
|
|
|
@ -515,31 +515,31 @@ func TestParseLSPDiagnosticsSeverity(t *testing.T) {
|
|
|
|
|
assert.Err(t, err, "foobar: unknown LSP diagnostic severity - may be none, hint, info, warning or error")
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestGroupConfigIgnoreGlobs(t *testing.T) {
|
|
|
|
|
func TestGroupConfigExcludeGlobs(t *testing.T) {
|
|
|
|
|
// empty globs
|
|
|
|
|
config := GroupConfig{
|
|
|
|
|
Paths: []string{"path"},
|
|
|
|
|
Note: NoteConfig{Ignore: []string{}},
|
|
|
|
|
Note: NoteConfig{Exclude: []string{}},
|
|
|
|
|
}
|
|
|
|
|
assert.Equal(t, config.IgnoreGlobs(), []string{})
|
|
|
|
|
assert.Equal(t, config.ExcludeGlobs(), []string{})
|
|
|
|
|
|
|
|
|
|
// empty paths
|
|
|
|
|
config = GroupConfig{
|
|
|
|
|
Paths: []string{},
|
|
|
|
|
Note: NoteConfig{
|
|
|
|
|
Ignore: []string{"ignored", ".git"},
|
|
|
|
|
Exclude: []string{"ignored", ".git"},
|
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
assert.Equal(t, config.IgnoreGlobs(), []string{"ignored", ".git"})
|
|
|
|
|
assert.Equal(t, config.ExcludeGlobs(), []string{"ignored", ".git"})
|
|
|
|
|
|
|
|
|
|
// several paths
|
|
|
|
|
config = GroupConfig{
|
|
|
|
|
Paths: []string{"log", "drafts"},
|
|
|
|
|
Note: NoteConfig{
|
|
|
|
|
Ignore: []string{"ignored", "*.git"},
|
|
|
|
|
Exclude: []string{"ignored", "*.git"},
|
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
assert.Equal(t, config.IgnoreGlobs(), []string{"log/ignored", "log/*.git", "drafts/ignored", "drafts/*.git"})
|
|
|
|
|
assert.Equal(t, config.ExcludeGlobs(), []string{"log/ignored", "log/*.git", "drafts/ignored", "drafts/*.git"})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestGroupConfigClone(t *testing.T) {
|
|
|
|
@ -556,7 +556,7 @@ func TestGroupConfigClone(t *testing.T) {
|
|
|
|
|
},
|
|
|
|
|
Lang: "fr",
|
|
|
|
|
DefaultTitle: "Sans titre",
|
|
|
|
|
Ignore: []string{"ignored", ".git"},
|
|
|
|
|
Exclude: []string{"ignored", ".git"},
|
|
|
|
|
},
|
|
|
|
|
Extra: map[string]string{
|
|
|
|
|
"hello": "world",
|
|
|
|
@ -576,7 +576,7 @@ func TestGroupConfigClone(t *testing.T) {
|
|
|
|
|
clone.Note.IDOptions.Case = CaseUpper
|
|
|
|
|
clone.Note.Lang = "de"
|
|
|
|
|
clone.Note.DefaultTitle = "Ohne Titel"
|
|
|
|
|
clone.Note.Ignore = []string{"other-ignored"}
|
|
|
|
|
clone.Note.Exclude = []string{"other-ignored"}
|
|
|
|
|
clone.Extra["test"] = "modified"
|
|
|
|
|
|
|
|
|
|
// Check that we didn't modify the original
|
|
|
|
@ -593,7 +593,7 @@ func TestGroupConfigClone(t *testing.T) {
|
|
|
|
|
},
|
|
|
|
|
Lang: "fr",
|
|
|
|
|
DefaultTitle: "Sans titre",
|
|
|
|
|
Ignore: []string{"ignored", ".git"},
|
|
|
|
|
Exclude: []string{"ignored", ".git"},
|
|
|
|
|
},
|
|
|
|
|
Extra: map[string]string{
|
|
|
|
|
"hello": "world",
|
|
|
|
|