diff --git a/pkg/service/expr.go b/pkg/service/expr.go index 8445a25..53c9442 100644 --- a/pkg/service/expr.go +++ b/pkg/service/expr.go @@ -69,7 +69,7 @@ func handleIdentExpr(expr ast.Expr) string { case "uint64": code += "unsigned long long" case "string": - code += "char*" + code += "std::string" default: code += ident.Name } diff --git a/pkg/service/features/app.feature b/pkg/service/features/app.feature index 81aa2ec..2c0b18d 100644 --- a/pkg/service/features/app.feature +++ b/pkg/service/features/app.feature @@ -59,4 +59,23 @@ class device { public: int a,b; }; +``` + + Сценарий: Структура с неск полями, строки - std::string + * Исходник: +``` +package test + +type device struct { + a,b int + c,d,e string +} +``` + * Результат: +``` +class device { +public: + int a,b; + std::string c,d,e; +}; ``` diff --git a/pkg/service/service_ginkgo_test.go b/pkg/service/service_ginkgo_test.go index aff9549..94c52a6 100644 --- a/pkg/service/service_ginkgo_test.go +++ b/pkg/service/service_ginkgo_test.go @@ -49,7 +49,7 @@ var _ = Describe("Go Translator", func() { const foo string = "bar" ` expected := ` - const char* foo = "bar"; + const std::string foo = "bar"; ` Compare(source, expected) }) @@ -83,7 +83,7 @@ var _ = Describe("Go Translator", func() { void foo(); void foo() { - const char* foo = "bar"; + const std::string foo = "bar"; } ` Compare(source, expected) @@ -99,7 +99,7 @@ var _ = Describe("Go Translator", func() { void foo(); void foo() { - char* foo = "bar"; + std::string foo = "bar"; } ` Compare(source, expected)