Skip to content

Commit 44d58e3

Browse files
committed
use literals
Signed-off-by: Robert Landers <landers.robert@gmail.com>
1 parent 36cdb72 commit 44d58e3

File tree

1 file changed

+20
-7
lines changed

1 file changed

+20
-7
lines changed

internal/extgen/gofile_test.go

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,9 @@ func test() {
103103
{
104104
Name: "test",
105105
ReturnType: phpVoid,
106-
GoFunction: "func test() {\n\t// simple function\n}",
106+
GoFunction: `func test() {
107+
// simple function
108+
}`,
107109
},
108110
},
109111
contains: []string{
@@ -213,7 +215,9 @@ func TestGoFileGenerator_PackageNameSanitization(t *testing.T) {
213215

214216
for _, tt := range tests {
215217
t.Run(tt.baseName, func(t *testing.T) {
216-
sourceFile := createTempSourceFile(t, "package main\n//export_php: test(): void\nfunc test() {}")
218+
sourceFile := createTempSourceFile(t, `package main
219+
//export_php: test(): void
220+
func test() {}`)
217221

218222
generator := &Generator{
219223
BaseName: tt.baseName,
@@ -251,7 +255,8 @@ func TestGoFileGenerator_ErrorHandling(t *testing.T) {
251255
},
252256
{
253257
name: "valid file",
254-
sourceFile: createTempSourceFile(t, "package main\nfunc test() {}"),
258+
sourceFile: createTempSourceFile(t, `package main
259+
func test() {}`),
255260
expectErr: false,
256261
},
257262
}
@@ -756,7 +761,9 @@ func simpleFunc() {
756761
{
757762
Name: "simpleFunc",
758763
ReturnType: phpVoid,
759-
GoFunction: "func simpleFunc() {\n\t// simple function\n}",
764+
GoFunction: `func simpleFunc() {
765+
// simple function
766+
}`,
760767
},
761768
},
762769
classes: nil,
@@ -790,7 +797,9 @@ func (ts *TestStruct) GetName() string {
790797
Signature: "getName(): string",
791798
ReturnType: phpString,
792799
Params: []phpParameter{},
793-
GoFunction: "func (ts *TestStruct) GetName() string {\n\treturn ts.name\n}",
800+
GoFunction: `func (ts *TestStruct) GetName() string {
801+
return ts.name
802+
}`,
794803
},
795804
},
796805
},
@@ -821,7 +830,9 @@ func (ms *MixedStruct) GetValue() int {
821830
{
822831
Name: "utilFunc",
823832
ReturnType: phpString,
824-
GoFunction: "func utilFunc() string {\n\treturn \"utility\"\n}",
833+
GoFunction: `func utilFunc() string {
834+
return "utility"
835+
}`,
825836
},
826837
},
827838
classes: []phpClass{
@@ -836,7 +847,9 @@ func (ms *MixedStruct) GetValue() int {
836847
Signature: "getValue(): int",
837848
ReturnType: phpInt,
838849
Params: []phpParameter{},
839-
GoFunction: "func (ms *MixedStruct) GetValue() int {\n\treturn ms.value\n}",
850+
GoFunction: `func (ms *MixedStruct) GetValue() int {
851+
return ms.value
852+
}`,
840853
},
841854
},
842855
},

0 commit comments

Comments
 (0)