1package bindata
2
3import (
4	"testing"
5)
6
7func TestAsset(t *testing.T) {
8	tests := []struct {
9		desc   string
10		name   string
11		expErr string
12		exp    string
13	}{{
14		desc:   "With invalid asset",
15		name:   "in/split/test.1",
16		expErr: "open in/split/test.1: file does not exist",
17	}, {
18		desc:   "With invalid asset",
19		name:   "testdata/in/test.asset",
20		expErr: "open testdata/in/test.asset: file does not exist",
21	}, {
22		desc:   "With invalid asset",
23		name:   "in/",
24		expErr: "open in/: file does not exist",
25	}, {
26		desc:   "With invalid asset",
27		name:   "in",
28		expErr: "open in: file does not exist",
29	}, {
30		desc:   "With invalid asset",
31		name:   "in/test",
32		expErr: "open in/test: file does not exist",
33	}, {
34		desc: "With valid asset",
35		name: "in/test.asset",
36		exp:  "// sample file\n",
37	}}
38
39	for _, test := range tests {
40		t.Log(test.desc, ":", test.name)
41
42		got, err := Asset(test.name)
43		if err != nil {
44			assert(t, test.expErr, err.Error(), true)
45			continue
46		}
47
48		assert(t, test.exp, string(got), true)
49	}
50}
51