This file is indexed.

/usr/share/gocode/src/github.com/constabulary/gb/gb_test.go is in golang-github-constabulary-gb-dev 0.4.4-2.

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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
package gb

import "testing"

func TestStripext(t *testing.T) {
	tests := []struct {
		path, want string
	}{
		{"a.txt", "a"},
		{"a.a.txt", "a.a"},
		{"Makefile", "Makefile"},
		{"", ""},
		{"/", "/"},
	}

	for _, tt := range tests {
		got := stripext(tt.path)
		if got != tt.want {
			t.Errorf("stripext(%q): want: %v, got: %v", tt.path, tt.want, got)
		}
	}
}

func TestRelImportPath(t *testing.T) {
	tests := []struct {
		root, path, want string
	}{
		{"/project/src", "a", "a"},
		// { "/project/src", "./a", "a"}, // TODO(dfc) this is relative
		// { "/project/src", "a/../b", "a"}, // TODO(dfc) so is this
	}

	for _, tt := range tests {

		got, _ := relImportPath(tt.root, tt.path)
		if got != tt.want {
			t.Errorf("relImportPath(%q, %q): want: %v, got: %v", tt.root, tt.path, tt.want, got)
		}
	}
}

func TestIsRel(t *testing.T) {
	tests := []struct {
		path string
		want bool
	}{
		{".", true},
		{"..", false},     // TODO(dfc) this is relative
		{"a/../b", false}, // TODO(dfc) this too
	}

	for _, tt := range tests {
		got := isRel(tt.path)
		if got != tt.want {
			t.Errorf("isRel(%q): want: %v, got: %v", tt.path, tt.want, got)
		}
	}
}