/usr/share/gocode/src/gopkg.in/gcfg.v1/types/scan_test.go is in golang-gopkg-gcfg.v1-dev 0.0~git20150907.0.0ef1a85-1.
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 34 35 36 | package types
import (
"reflect"
"testing"
)
func TestScanFully(t *testing.T) {
for _, tt := range []struct {
val string
verb byte
res interface{}
ok bool
}{
{"a", 'v', int(0), false},
{"0x", 'v', int(0), true},
{"0x", 'd', int(0), false},
} {
d := reflect.New(reflect.TypeOf(tt.res)).Interface()
err := ScanFully(d, tt.val, tt.verb)
switch {
case tt.ok && err != nil:
t.Errorf("ScanFully(%T, %q, '%c'): want ok, got error %v",
d, tt.val, tt.verb, err)
case !tt.ok && err == nil:
t.Errorf("ScanFully(%T, %q, '%c'): want error, got %v",
d, tt.val, tt.verb, elem(d))
case tt.ok && err == nil && !reflect.DeepEqual(tt.res, elem(d)):
t.Errorf("ScanFully(%T, %q, '%c'): want %v, got %v",
d, tt.val, tt.verb, tt.res, elem(d))
default:
t.Logf("ScanFully(%T, %q, '%c') = %v; *ptr==%v",
d, tt.val, tt.verb, err, elem(d))
}
}
}
|