From b6cb81fc11e6fa3c71669fd103e064e1e4749601 Mon Sep 17 00:00:00 2001 From: Softonik Date: Mon, 22 Jan 2024 04:19:33 +0300 Subject: [PATCH] =?UTF-8?q?=D0=A1=D1=86=D0=B5=D0=BD=D0=B0=D1=80=D0=B8?= =?UTF-8?q?=D0=B9:=20=D0=A1=D1=82=D1=80=D1=83=D0=BA=D1=82=D1=83=D1=80?= =?UTF-8?q?=D0=B0=20=D1=81=20=D0=BD=D0=B5=D1=81=D0=BA=20=D0=BF=D0=BE=D0=BB?= =?UTF-8?q?=D1=8F=D0=BC=D0=B8,=20=D1=81=D1=82=D1=80=D0=BE=D0=BA=D0=B8=20-?= =?UTF-8?q?=20std::string?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pkg/service/expr.go | 2 +- pkg/service/features/app.feature | 19 +++++++++++++++++++ pkg/service/service_ginkgo_test.go | 6 +++--- 3 files changed, 23 insertions(+), 4 deletions(-) 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)