cleanup(netx): another batch of small/simple cleanups (#789)

See https://github.com/ooni/probe/issues/2121
This commit is contained in:
Simone Basso 2022-06-02 13:50:34 +02:00 committed by GitHub
commit ae24ba644c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 42 additions and 149 deletions

View file

@ -31,3 +31,19 @@ func TestErrorToStringOrOK(t *testing.T) {
}
})
}
func TestValidLoggerOrDefault(t *testing.T) {
t.Run("with nil argument", func(t *testing.T) {
out := ValidLoggerOrDefault(nil)
if out != DiscardLogger {
t.Fatal("unexpected result")
}
})
t.Run("with non-nil argument", func(t *testing.T) {
in := &logDiscarder{}
if ValidLoggerOrDefault(in) != in {
t.Fatal("unexpected result")
}
})
}