This file is indexed.

/usr/share/gocode/src/github.com/emicklei/go-restful-swagger12/model_property_list_test.go is in golang-github-emicklei-go-restful-swagger12-dev 1.0.1-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
37
38
39
40
41
42
43
44
45
46
47
package swagger

import (
	"encoding/json"
	"testing"
)

func TestModelPropertyList(t *testing.T) {
	l := ModelPropertyList{}
	p := ModelProperty{Description: "d"}
	l.Put("p", p)
	q, ok := l.At("p")
	if !ok {
		t.Error("expected p")
	}
	if got, want := q.Description, "d"; got != want {
		t.Errorf("got %v want %v", got, want)
	}
}

func TestModelPropertyList_Marshal(t *testing.T) {
	l := ModelPropertyList{}
	p := ModelProperty{Description: "d"}
	l.Put("p", p)
	data, err := json.Marshal(l)
	if err != nil {
		t.Error(err)
	}
	if got, want := string(data), `{"p":{"description":"d"}}`; got != want {
		t.Errorf("got %v want %v", got, want)
	}
}

func TestModelPropertyList_Unmarshal(t *testing.T) {
	data := `{"p":{"description":"d"}}`
	l := ModelPropertyList{}
	if err := json.Unmarshal([]byte(data), &l); err != nil {
		t.Error(err)
	}
	m, ok := l.At("p")
	if !ok {
		t.Error("expected p")
	}
	if got, want := m.Description, "d"; got != want {
		t.Errorf("got %v want %v", got, want)
	}
}