github.com/qri-io/qri@v0.10.1-0.20220104210721-c771715036cb/config/logging_test.go (about) 1 package config 2 3 import ( 4 "reflect" 5 "testing" 6 ) 7 8 func TestLoggingValidate(t *testing.T) { 9 err := DefaultLogging().Validate() 10 if err != nil { 11 t.Errorf("error validating default logging: %s", err) 12 } 13 } 14 15 func TestLoggingCopy(t *testing.T) { 16 cases := []struct { 17 logging *Logging 18 }{ 19 {DefaultLogging()}, 20 } 21 for i, c := range cases { 22 cpy := c.logging.Copy() 23 if !reflect.DeepEqual(cpy, c.logging) { 24 t.Errorf("Logging Copy test case %v, logging structs are not equal: \ncopy: %v, \noriginal: %v", i, cpy, c.logging) 25 continue 26 } 27 cpy.Levels["qriapi"] = "error" 28 if reflect.DeepEqual(cpy, c.logging) { 29 t.Errorf("Logging Copy test case %v, editing one logging struct should not affect the other: \ncopy: %v, \noriginal: %v", i, cpy, c.logging) 30 continue 31 } 32 } 33 }