Skip to content

Commit d4f142d

Browse files
committed
Update readme and function naming
1 parent bf0f47d commit d4f142d

4 files changed

Lines changed: 6 additions & 6 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ func (code *Code) Assignment(a *AssignmentArgs) *Code
7373
func (code *Code) CompositeLit(LiteralType string) *Code
7474
func (code *Code) ShortVarDecl(a *ShortVarDeclArgs) *Code
7575
func (code *Code) KeyedElement(a *KeyedElementArgs) *Code
76-
func (code *Code) Testvariables(t *Testvars) *Code
76+
func (code *Code) TestVarDecl(t *Testvars) *Code
7777
func (code *Code) Format() error
7878
func (code *Code) String() string
7979
```

syntax_nil_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ func TestTestVariablesNil(t *testing.T) {
1717
// Declare c as type *Code and assign nil
1818
var c *lpcode.Code = nil
1919
// The test fails if Testvariables does not return nil.
20-
if n := c.TestvarDecl([]lpcode.Testvar{}); n != nil {
20+
if n := c.TestVarDecl([]lpcode.Testvar{}); n != nil {
2121
t.Error(tserr.NilExpected("Testvariables"))
2222
}
2323
}
@@ -202,7 +202,7 @@ func TestSelMethodNil(t *testing.T) {
202202
// t is nil. The test fails if Testvariables does not return nil.
203203
func TestTestVariablesNil2(t *testing.T) {
204204
// The test fails if Testvariables does not return nil.
205-
if n := lpcode.NewCode().TestvarDecl(nil); n != nil {
205+
if n := lpcode.NewCode().TestVarDecl(nil); n != nil {
206206
t.Error(tserr.NilExpected("Testvariables"))
207207
}
208208
}

syntax_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ func TestTestVariables(t *testing.T) {
4646
{T: "float64", N: "floatFoo", V: "5678"},
4747
}
4848
// Retrieve test variables with Testvariables
49-
c := lpcode.NewCode().TestvarDecl(vars)
49+
c := lpcode.NewCode().TestVarDecl(vars)
5050
// Evaluate the retrieved source code
5151
if e := evalCode(c, "testvariables"); e != nil {
5252
// The test fails if the retrieved code does not match the contents of the golden file
@@ -211,7 +211,7 @@ func TestTestVariablesEmpty(t *testing.T) {
211211
// // Configure Testvars to generate no test variables
212212
vars := []lpcode.Testvar{}
213213
// Retrieve test variables with Testvariables
214-
c := lpcode.NewCode().TestvarDecl(vars)
214+
c := lpcode.NewCode().TestVarDecl(vars)
215215
// The test fails in case the returned string is not empty
216216
if c.String() != "" {
217217
t.Error(tserr.Empty("code"))

testvar.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ type Testvar struct {
1616
// It returns nil if code is nil or if tv is nil.
1717
// The generated variable declarations are added to code.
1818
// The test variables are generated based on the type, name and value specified in tv. If no test variables are generated, an empty string is returned. The generated code should be validated by go/format or other tools. The test variables are generated in a var block. Each test variable is declared with its name, type and value, followed by a comment indicating the type of the test variable. The generated code can be used for unit tests to provide consistent test variables across different test cases.
19-
func (code *Code) TestvarDecl(tv []Testvar) *Code {
19+
func (code *Code) TestVarDecl(tv []Testvar) *Code {
2020
// Return nil in case code is nil
2121
if code == nil {
2222
return nil

0 commit comments

Comments
 (0)