Пример #1
0
func ctx(g *gt.GopathTest) *Context {
	c, err := NewContext(g.Current(), relVendorFile, "vendor", false)
	if err != nil {
		g.Fatal(err)
	}
	return c
}
Пример #2
0
func showVendorFile14(g *gt.GopathTest) {
	buf, err := ioutil.ReadFile(filepath.Join(g.Current(), "internal", "vendor.json"))
	if err != nil {
		g.Fatal(err)
	}
	g.Logf("%s", buf)
}
Пример #3
0
func ctx15(g *gt.GopathTest) *Context {
	c, err := NewContext(g.Current(), "vendor.json", "vendor", false)
	if err != nil {
		g.Fatal(err)
	}
	return c
}
Пример #4
0
func ctx14(g *gt.GopathTest) *Context {
	c, err := NewContext(g.Current(), filepath.Join("internal", "vendor.json"), "internal", true)
	if err != nil {
		g.Fatal(err)
	}
	return c
}
Пример #5
0
func vendorFile(g *gt.GopathTest, expected string) {
	buf, err := ioutil.ReadFile(filepath.Join(g.Current(), relVendorFile))
	if err != nil {
		g.Fatal(err)
	}
	if string(buf) != expected {
		g.Fatal("Got: ", string(buf))
	}
}
Пример #6
0
func vendorFile14(g *gt.GopathTest, expected string) {
	buf, err := ioutil.ReadFile(filepath.Join(g.Current(), "internal", "vendor.json"))
	if err != nil {
		g.Fatal(err)
	}
	if string(buf) != expected {
		g.Fatal("Got: ", string(buf))
	}
}
Пример #7
0
func tree(g *gt.GopathTest, c *Context, name, expected string) {
	tree := make([]string, 0, 6)
	filepath.Walk(g.Current(), func(path string, info os.FileInfo, err error) error {
		if info.IsDir() {
			return nil
		}
		tree = append(tree, strings.TrimPrefix(path, g.Current()))
		return nil
	})
	sort.Strings(tree)

	output := &bytes.Buffer{}
	for _, item := range tree {
		output.WriteString(item)
		output.WriteRune('\n')
	}
	if strings.TrimSpace(output.String()) != strings.TrimSpace(expected) {
		g.Fatalf("(%s) Got\n%s", name, output.String())
	}
}