From f85c8805669223cadbfc0047e498777b1c99b69d Mon Sep 17 00:00:00 2001 From: "T.Todua" <7117978+ttodua@users.noreply.github.com> Date: Thu, 15 Aug 2024 14:52:51 +0400 Subject: [PATCH] tests --- src/phpTranspiler.ts | 2 +- tests/csharpTranspiler.test.ts | 6 ++++++ tests/phpTranspiler.test.ts | 6 ++++++ tests/pythonTranspiler.test.ts | 6 ++++++ 4 files changed, 19 insertions(+), 1 deletion(-) diff --git a/src/phpTranspiler.ts b/src/phpTranspiler.ts index f713c61..2fd1457 100644 --- a/src/phpTranspiler.ts +++ b/src/phpTranspiler.ts @@ -239,7 +239,7 @@ export class PhpTranspiler extends BaseTranspiler { } printConcatCall(node: any, identation: any, name?: any, parsedArg?: any) { - return `array_merge (${name}, ${parsedArg})`; + return `array_merge(${name}, ${parsedArg})`; } printPadEndCall(node, identation, name, parsedArg, parsedArg2) { diff --git a/tests/csharpTranspiler.test.ts b/tests/csharpTranspiler.test.ts index 5c8e5a6..f2e7f63 100644 --- a/tests/csharpTranspiler.test.ts +++ b/tests/csharpTranspiler.test.ts @@ -902,6 +902,12 @@ describe('csharp transpiling tests', () => { const output = transpiler.transpileCSharp(ts).content; expect(output).toBe(csharp); }); + test('should convert concat', () => { + const ts = "y.concat(z)"; + const result = "y.Concat(x).ToList()"; + const output = transpiler.transpileCSharp(ts).content; + expect(output).toBe(result); + }); test('string literal', () => { const ts = "const x = \"foo, 'single', \\\"double\\\" \\t \\n \\r \\b \\f \";"; const csharp = "object x = \"foo, 'single', \\\"double\\\" \\t \\n \\r \\b \\f \";"; diff --git a/tests/phpTranspiler.test.ts b/tests/phpTranspiler.test.ts index 8d23dfd..9355a0f 100644 --- a/tests/phpTranspiler.test.ts +++ b/tests/phpTranspiler.test.ts @@ -823,6 +823,12 @@ describe('php transpiling tests', () => { const output = transpiler.transpilePhp(ts).content; expect(output).toBe(php); }); + test('should convert concat', () => { + const ts = "y.concat(z)"; + const result = "array_merge($x, $y)"; + const output = transpiler.transpilePhp(ts).content; + expect(output).toBe(result); + }); test('string literal', () => { const ts = "const x = \"foo, 'single', \\\"double\\\" \\t \\n \\r \\b \\f \";"; const php = "$x = 'foo, \\\'single\\\', \"double\" \\t \\n \\r \\b \\f ';"; diff --git a/tests/pythonTranspiler.test.ts b/tests/pythonTranspiler.test.ts index f84298e..1acbe1f 100644 --- a/tests/pythonTranspiler.test.ts +++ b/tests/pythonTranspiler.test.ts @@ -762,6 +762,12 @@ describe('python tests', () => { const output = transpiler.transpilePython(ts).content; expect(output).toBe(python); }); + test('should convert concat', () => { + const ts = "y.concat(z)"; + const result = "y + z"; + const output = transpiler.transpilePython(ts).content; + expect(output).toBe(result); + }); test('string literal', () => { const ts = "const x = \"foo, 'single', \\\"double\\\" \\t \\n \\r \\b \\f \";"; const python = "x = 'foo, \\'single\\', \"double\" \\t \\n \\r \\b \\f '";