/usr/share/gocode/src/github.com/streadway/amqp/delivery_test.go is in golang-github-streadway-amqp-dev 0.0~git20150820.0.f4879ba-6.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | package amqp
import "testing"
func shouldNotPanic(t *testing.T) {
if err := recover(); err != nil {
t.Fatalf("should not panic, got: %s", err)
}
}
// A closed delivery chan could produce zero value. Ack/Nack/Reject on these
// deliveries can produce a nil pointer panic. Instead return an error when
// the method can never be successful.
func TestAckZeroValueAcknowledgerDoesNotPanic(t *testing.T) {
defer shouldNotPanic(t)
if err := (Delivery{}).Ack(false); err == nil {
t.Errorf("expected Delivery{}.Ack to error")
}
}
func TestNackZeroValueAcknowledgerDoesNotPanic(t *testing.T) {
defer shouldNotPanic(t)
if err := (Delivery{}).Nack(false, false); err == nil {
t.Errorf("expected Delivery{}.Ack to error")
}
}
func TestRejectZeroValueAcknowledgerDoesNotPanic(t *testing.T) {
defer shouldNotPanic(t)
if err := (Delivery{}).Reject(false); err == nil {
t.Errorf("expected Delivery{}.Ack to error")
}
}
|