| 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
|
| +}
|
|
|