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

Side by Side Diff: mojom/generators/go/templates/interfaces_test.go

Issue 2077113002: Handle interfaces with a ServiceName in the go bindings generator. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Fix names issue. Created 4 years, 6 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 unified diff | Download patch
« no previous file with comments | « mojom/generators/go/templates/interfaces.go ('k') | mojom/generators/go/templates/templates.go » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 package templates 5 package templates
6 6
7 import ( 7 import (
8 "testing" 8 "testing"
9 9
10 "mojom/generators/go/translator" 10 "mojom/generators/go/translator"
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 57
58 func TestMethodOrdinals(t *testing.T) { 58 func TestMethodOrdinals(t *testing.T) {
59 expected := `const someInterface_FirstMethod_Ordinal uint32 = 10 59 expected := `const someInterface_FirstMethod_Ordinal uint32 = 10
60 const someInterface_SecondMethod_Ordinal uint32 = 21 60 const someInterface_SecondMethod_Ordinal uint32 = 21
61 ` 61 `
62 62
63 i := testInterfaceTemplate() 63 i := testInterfaceTemplate()
64 64
65 check(t, expected, "MethodOrdinals", i) 65 check(t, expected, "MethodOrdinals", i)
66 } 66 }
67
68 func TestServiceName(t *testing.T) {
69 expected := `const someInterface_Name string = "SomeService"
70
71 func (r *SomeInterface_Request) Name() string {
72 return someInterface_Name
73 }
74
75 func (p *SomeInterface_Pointer) Name() string {
76 return someInterface_Name
77 }
78
79 func (f *SomeInterface_ServiceFactory) Name() string {
80 return someInterface_Name
81 }`
82
83 serviceName := "SomeService"
84 i := translator.InterfaceTemplate{
85 Name: "SomeInterface",
86 PrivateName: "someInterface",
87 ServiceName: &serviceName,
88 }
89
90 check(t, expected, "ServiceDecl", i)
91 }
OLDNEW
« no previous file with comments | « mojom/generators/go/templates/interfaces.go ('k') | mojom/generators/go/templates/templates.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698