From 0cb089702140797214374399c259c54393a7635a Mon Sep 17 00:00:00 2001 From: Softonik Date: Sat, 19 Nov 2022 04:38:10 +0300 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=20=D1=82=D0=B5=D1=81=D1=82=20=D1=81=20=D0=B4=D0=B2=D1=83?= =?UTF-8?q?=D0=BC=D1=8F=20=D0=B2=D1=8B=D0=B7=D0=BE=D0=B2=D0=B0=D0=BC=D0=B8?= =?UTF-8?q?=20Go?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- transpile/service_test.go | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/transpile/service_test.go b/transpile/service_test.go index bc87d09..322f8d4 100644 --- a/transpile/service_test.go +++ b/transpile/service_test.go @@ -607,6 +607,41 @@ var _ = Describe("Go Translator", func() { ` Compare(source, expected) }) + It("Go создаёт поток - два раза", func() { + source := `package test + func main() { + go myfunction() + go myfunction2() + } + func myfunction() { + } + func myfunction2() { + } + ` + expected := ` + void main(); + void myfunction(); + void myfunction2(); + void __GoHelper_myfunction(void*) { + myfunction(); + vTaskDelete(NULL); + } + void __GoHelper_myfunction2(void*) { + myfunction2(); + vTaskDelete(NULL); + } + + void main() { + xTaskCreate(__GoHelper_myfunction,"",1024,NULL,1,NULL); + xTaskCreate(__GoHelper_myfunction2,"",1024,NULL,1,NULL); + } + void myfunction() { + } + void myfunction2() { + } + ` + Compare(source, expected) + }) }) Describe("Функции", func() {