aboutsummaryrefslogtreecommitdiff
path: root/tests/legacy/build_constraints/build_constraints_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'tests/legacy/build_constraints/build_constraints_test.go')
-rw-r--r--tests/legacy/build_constraints/build_constraints_test.go55
1 files changed, 55 insertions, 0 deletions
diff --git a/tests/legacy/build_constraints/build_constraints_test.go b/tests/legacy/build_constraints/build_constraints_test.go
new file mode 100644
index 00000000..b2ac474e
--- /dev/null
+++ b/tests/legacy/build_constraints/build_constraints_test.go
@@ -0,0 +1,55 @@
+package build_constraints
+
+import (
+ "runtime"
+ "testing"
+)
+
+func check(value string, t *testing.T) {
+ var want string
+ if runtime.GOOS == "linux" {
+ want = "linux"
+ } else {
+ want = "unknown"
+ }
+ if value != want {
+ t.Errorf("got %s; want %s", value, want)
+ }
+}
+
+func TestSuffix(t *testing.T) {
+ check(suffix, t)
+}
+
+func TestTag(t *testing.T) {
+ check(tag, t)
+}
+
+func asm() int
+
+func TestAsm(t *testing.T) {
+ got := asm()
+ var want int
+ if runtime.GOOS == "linux" {
+ want = 12
+ } else if runtime.GOARCH == "arm64" {
+ want = 75
+ } else {
+ want = 34
+ }
+ if got != want {
+ t.Errorf("got %d; want %d", got, want)
+ }
+}
+
+func TestCgoGo(t *testing.T) {
+ check(cgoGo, t)
+}
+
+func TestCgoC(t *testing.T) {
+ check(cgoC, t)
+}
+
+func TestCgoCGroup(t *testing.T) {
+ check(cgoCGroup, t)
+}