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

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

Issue 1945103002: Go bindings: Don't import 'fmt' unless it is needed. (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/go/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
index 7b8bf2079e801e6b3ecbc332c17e7fb143bd953d..04245d8b37b79025f69fb90a5127b433996af33f 100644
--- a/mojo/go/tests/enums_test.go
+++ b/mojo/go/tests/enums_test.go
@@ -5,10 +5,16 @@
package tests
import (
+ test_enums_no_type_info "mojo/go/tests/test_enums"
"mojo/public/interfaces/bindings/tests/test_enums"
"testing"
)
+// TestEnums just exercises the generated go code for enums. It tests that
+// the generated enum value constants are of the correct type. The difference
+// between test_enums and test_enums_no_type_info is that the former has been generated
+// using 'generate_type_info = true' and the latter has not. Our only goal
+// in including both is to minimally exercise both generation pathways.
func TestEnums(t *testing.T) {
if test_enums.TestEnum_Foo != IdentityEnum1(test_enums.TestEnum_Foo) {
t.Errorf("IdentityEnum1 failure.")
@@ -17,6 +23,14 @@ func TestEnums(t *testing.T) {
if test_enums.TestEnum2_Foo != IdentityEnum2(test_enums.TestEnum2_Foo) {
t.Errorf("IdentityEnum1 failure.")
}
+
+ if test_enums_no_type_info.TestEnum_Foo != IdentityEnumB1(test_enums_no_type_info.TestEnum_Foo) {
+ t.Errorf("IdentityEnum1 failure.")
+ }
+
+ if test_enums_no_type_info.TestEnum2_Foo != IdentityEnumB2(test_enums_no_type_info.TestEnum2_Foo) {
+ t.Errorf("IdentityEnum1 failure.")
+ }
}
func IdentityEnum1(x test_enums.TestEnum) test_enums.TestEnum {
@@ -26,3 +40,11 @@ func IdentityEnum1(x test_enums.TestEnum) test_enums.TestEnum {
func IdentityEnum2(x test_enums.TestEnum2) test_enums.TestEnum2 {
return x
}
+
+func IdentityEnumB1(x test_enums_no_type_info.TestEnum) test_enums_no_type_info.TestEnum {
+ return x
+}
+
+func IdentityEnumB2(x test_enums_no_type_info.TestEnum2) test_enums_no_type_info.TestEnum2 {
+ return x
+}
« no previous file with comments | « mojo/go/BUILD.gn ('k') | mojo/go/tests/test_enums.mojom » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698