Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(221)

Unified Diff: mojo/go/tests/enums_test.go

Issue 1943643002: Go bindings: Change generated enum value constants to be typed as the enum type. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « mojo/go/BUILD.gn ('k') | mojo/public/interfaces/bindings/tests/test_enums.mojom » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/go/tests/enums_test.go
diff --git a/mojo/go/tests/enums_test.go b/mojo/go/tests/enums_test.go
new file mode 100644
index 0000000000000000000000000000000000000000..7b8bf2079e801e6b3ecbc332c17e7fb143bd953d
--- /dev/null
+++ b/mojo/go/tests/enums_test.go
@@ -0,0 +1,28 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+package tests
+
+import (
+ "mojo/public/interfaces/bindings/tests/test_enums"
+ "testing"
+)
+
+func TestEnums(t *testing.T) {
+ if test_enums.TestEnum_Foo != IdentityEnum1(test_enums.TestEnum_Foo) {
+ t.Errorf("IdentityEnum1 failure.")
+ }
+
+ if test_enums.TestEnum2_Foo != IdentityEnum2(test_enums.TestEnum2_Foo) {
+ t.Errorf("IdentityEnum1 failure.")
+ }
+}
+
+func IdentityEnum1(x test_enums.TestEnum) test_enums.TestEnum {
+ return x
+}
+
+func IdentityEnum2(x test_enums.TestEnum2) test_enums.TestEnum2 {
+ return x
+}
« no previous file with comments | « mojo/go/BUILD.gn ('k') | mojo/public/interfaces/bindings/tests/test_enums.mojom » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698