-
Notifications
You must be signed in to change notification settings - Fork 651
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add lost
x_defs
on test execution regression test
- Loading branch information
Showing
7 changed files
with
146 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test") | ||
|
||
test_suite( | ||
name = "x_defs", | ||
) | ||
|
||
go_test( | ||
name = "foo_test", | ||
srcs = ["foo_test.go"], | ||
embed = [":foo"], | ||
importpath = "github.com/bazelbuild/rules_go/tests/core/go_test/x_defs/foo", | ||
pure = "on", | ||
deps = [":bar"], | ||
) | ||
|
||
go_library( | ||
name = "bar", | ||
srcs = ["bar.go"], | ||
importpath = "github.com/bazelbuild/rules_go/tests/core/go_test/x_defs/bar", | ||
visibility = ["//visibility:public"], | ||
x_defs = {"Bar": "Bar"}, | ||
deps = [ | ||
":baz", | ||
":foo", | ||
], | ||
) | ||
|
||
go_library( | ||
name = "baz", | ||
srcs = ["baz.go"], | ||
importpath = "github.com/bazelbuild/rules_go/tests/core/go_test/x_defs/baz", | ||
visibility = ["//visibility:public"], | ||
x_defs = {"Baz": "Baz"}, | ||
deps = [":qux"], | ||
) | ||
|
||
go_library( | ||
name = "foo", | ||
srcs = ["foo.go"], | ||
importpath = "github.com/bazelbuild/rules_go/tests/core/go_test/x_defs/foo", | ||
visibility = ["//visibility:public"], | ||
) | ||
|
||
go_library( | ||
name = "qux", | ||
srcs = ["qux.go"], | ||
importpath = "github.com/bazelbuild/rules_go/tests/core/go_test/x_defs/qux", | ||
visibility = ["//visibility:public"], | ||
x_defs = {"Qux": "Qux"}, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package bar | ||
|
||
import ( | ||
"github.com/bazelbuild/rules_go/tests/core/go_test/x_defs/baz" | ||
_ "github.com/bazelbuild/rules_go/tests/core/go_test/x_defs/foo" | ||
) | ||
|
||
var Bar string | ||
var Qux = baz.Qux | ||
var Baz = baz.Baz |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package baz | ||
|
||
import "github.com/bazelbuild/rules_go/tests/core/go_test/x_defs/qux" | ||
|
||
var Baz string | ||
var Qux = qux.Qux |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
package foo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package foo_test | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/bazelbuild/rules_go/tests/core/go_test/x_defs/bar" | ||
) | ||
|
||
func TestBar(t *testing.T) { | ||
Equal(t, "Bar", bar.Bar) | ||
} | ||
|
||
func TestBaz(t *testing.T) { | ||
Equal(t, "Baz", bar.Baz) | ||
} | ||
|
||
func TestQux(t *testing.T) { | ||
Equal(t, "Qux", bar.Qux) | ||
} | ||
|
||
func Equal(t *testing.T, expected string, actual string) bool { | ||
if expected != actual { | ||
t.Errorf("Not equal: \n"+ | ||
"expected: %s\n"+ | ||
"actual : %s", expected, actual) | ||
} | ||
return true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
package qux | ||
|
||
var Qux string |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
load("@io_bazel_rules_go//go:def.bzl", "go_library") | ||
|
||
go_library( | ||
name = "bar", | ||
srcs = ["bar.go"], | ||
importpath = "github.com/bozaro/rules_go_xdefs/bar", | ||
visibility = ["//visibility:public"], | ||
x_defs = {"Bar": "Bar"}, | ||
deps = [ | ||
"//baz", | ||
"//foo", | ||
], | ||
) | ||
|
||
go_library( | ||
name = "baz", | ||
srcs = ["baz.go"], | ||
importpath = "github.com/bozaro/rules_go_xdefs/baz", | ||
visibility = ["//visibility:public"], | ||
x_defs = {"Baz": "Baz"}, | ||
deps = ["//qux"], | ||
) | ||
load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test") | ||
|
||
go_library( | ||
name = "foo", | ||
srcs = ["foo.go"], | ||
importpath = "github.com/bozaro/rules_go_xdefs/foo", | ||
visibility = ["//visibility:public"], | ||
) | ||
|
||
go_test( | ||
name = "foo_test", | ||
srcs = ["foo_test.go"], | ||
embed = [":foo"], | ||
importpath = "github.com/bozaro/rules_go_xdefs/foo", | ||
pure = "on", | ||
deps = ["//bar"], | ||
) | ||
load("@io_bazel_rules_go//go:def.bzl", "go_library") | ||
|
||
go_library( | ||
name = "qux", | ||
srcs = ["qux.go"], | ||
importpath = "github.com/bozaro/rules_go_xdefs/qux", | ||
visibility = ["//visibility:public"], | ||
x_defs = {"Qux": "Qux"}, | ||
) |