package bind import "testing" func TestResultClassification(t *testing.T) { // named-checkconf exited 0: everything it printed is a warning. ok := newResult(`both "recursion no;" and "allow-recursion" active for view external zone example.com/IN/internal: loaded serial 1 `, 0) if !ok.OK || len(ok.Messages) != 2 || ok.Messages[0].Error || ok.Messages[1].Error { t.Errorf("exit 0: %+v", ok) } // Non-zero exit: real problems stay errors. bad := newResult(`/etc/bind/jarl/named.conf:12: unknown option 'recursoin' `, 1) if bad.OK || len(bad.Messages) != 1 || !bad.Messages[0].Error || bad.Messages[0].Line != 12 { t.Errorf("exit 1: %+v", bad) } }