Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found
Select Git revision

Target

Select target project
  • oss/libraries/go/application/configuration
1 result
Select Git revision
Show changes
Commits on Source (2)
......@@ -38,7 +38,7 @@ func (s *setting[C]) SetMnemonic(mnemonic string) *setting[C] {
}
// Check if the setting contains errors
func (s *setting[C]) HasError() bool {
func (s *setting[C]) HasErrors() bool {
return len(s.errors) > 0
}
......
......@@ -69,7 +69,7 @@ func TestCangeOnChange(t *testing.T) {
s.Import()
if s.HasError() {
if s.HasErrors() {
t.Error("Expected not error", s.Errors())
}
......
......@@ -50,7 +50,7 @@ func newUnsupportedTypeError(t reflect.Type) UnsupportedTypeError {
}
// ResetError is used to reset the error to nil
// After calling this function, the call HasError() will return false
// After calling this function, the call HasErrors() will return false
func (s *setting[C]) ResetErrors() *setting[C] {
s.errors = []error{}
return s
......
......@@ -14,11 +14,11 @@ func TestResetErrors(t *testing.T) {
c := New(defaults)
assert.False(t, c.HasError())
assert.False(t, c.HasErrors())
c.SetDefaultDirectories()
assert.True(t, c.HasError())
assert.True(t, c.HasErrors())
c.ResetErrors()
assert.False(t, c.HasError())
assert.False(t, c.HasErrors())
}
func TestNewFlagDoesNotExistError(t *testing.T) {
......
......@@ -21,7 +21,7 @@ func TestWrite(t *testing.T) {
s.Write(x, f)
if s.HasError() {
if s.HasErrors() {
t.Error(s.Errors())
s.ResetErrors()
continue
......
......@@ -167,7 +167,7 @@ func TestAddDirectoryMissingMnemonic(t *testing.T) {
c := New(cfg)
c.AddEtcDirectory()
if !c.HasError() {
if !c.HasErrors() {
t.Error("Expected error")
}
......@@ -260,7 +260,7 @@ func TestSetFileFormat(t *testing.T) {
c := New(cfg)
c.SetFileFormat(Yaml)
if c.HasError() {
if c.HasErrors() {
t.Error("Expected not error")
}
......@@ -273,7 +273,7 @@ func TestSetFileFormatError(t *testing.T) {
c := New(cfg)
c.SetFileFormat(Format(9999))
if !c.HasError() {
if !c.HasErrors() {
t.Error("Expected error")
}
......@@ -302,7 +302,7 @@ func TestImport(t *testing.T) {
c.SetDefaultDirectories().ResetErrors()
c.Import()
if c.HasError() {
if c.HasErrors() {
t.Error("Expected not error", c.Errors())
}
......@@ -413,7 +413,7 @@ func TestImport2(t *testing.T) {
c.SetDefaultDirectories().ResetErrors() // errors not important here
c.Import()
if c.HasError() {
if c.HasErrors() {
t.Error("Expected not error", c.Errors())
}
......@@ -461,7 +461,7 @@ func TestImport3(t *testing.T) {
c.SetDefaultDirectories().ResetErrors() // errors not important here
c.Import()
if c.HasError() {
if c.HasErrors() {
t.Error("Expected not error", c.Errors())
}
......@@ -514,7 +514,7 @@ func TestSetConfigName(t *testing.T) {
c := New(cfg)
c.SetFileName("test")
if c.HasError() {
if c.HasErrors() {
t.Error("Expected not error")
}
......@@ -527,13 +527,13 @@ func TestConfigSetFileName(t *testing.T) {
c := New(cfg)
c.SetFileName("test")
if c.HasError() {
if c.HasErrors() {
t.Error("Expected not error")
}
c.SetFileName("")
if !c.HasError() {
if !c.HasErrors() {
t.Error("Expected error")
}
......@@ -546,7 +546,7 @@ func TestConfigSetFileFormat(t *testing.T) {
c := New(cfg)
c.SetFileFormat(99)
if !c.HasError() {
if !c.HasErrors() {
t.Error("Expected not error")
}
......@@ -559,7 +559,7 @@ func TestConfigSetDirectories(t *testing.T) {
c := New(cfg)
c.SetDirectories([]string{"a", "b"})
if !c.HasError() {
if !c.HasErrors() {
t.Error("Expected not error")
}
......@@ -572,7 +572,7 @@ func TestConfigDirectories(t *testing.T) {
c := New(cfg)
c.SetDirectories([]string{"a", "b"})
if !c.HasError() {
if !c.HasErrors() {
t.Error("Expected not error")
}
......@@ -591,7 +591,7 @@ func TestConfigAddDirectory(t *testing.T) {
c := New(cfg)
c.AddDirectory("a")
if !c.HasError() {
if !c.HasErrors() {
t.Error("Expected not error")
}
......
......@@ -47,7 +47,7 @@ func (s *setting[C]) serveGet(w http.ResponseWriter, r *http.Request) {
}
if s.HasError() {
if s.HasErrors() {
w.WriteHeader(http.StatusInternalServerError)
return
}
......
......@@ -37,7 +37,7 @@ func FuzzTest(f *testing.F) {
}
s.Write(os.Stdout, Yaml)
if s.HasError() {
if s.HasErrors() {
t.Error(s.Errors())
s.ResetErrors()
}
......
{"version":"1.0.1"}
{"version":"1.1.0"}
......@@ -83,7 +83,7 @@ func TestAddReader(t *testing.T) {
//
// s.Import()
//
// if s.HasError() {
// if s.HasErrors() {
// t.Error("Expected no errors but got ", s.Errors())
// }
//
......
......@@ -82,7 +82,7 @@ func TestSettingStopWatching(t *testing.T) {
c.Watch()
c.StopWatching()
if c.HasError() {
if c.HasErrors() {
t.Error(c.Errors())
}
......@@ -99,7 +99,7 @@ func TestSettingStopWatchingNotOnWatch(t *testing.T) {
c := New(config)
c.StopWatching()
if !c.HasError() {
if !c.HasErrors() {
t.Error("Expected to have an error")
}
......