Skip to content

Commit

Permalink
tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ttodua committed Aug 15, 2024
1 parent dbe5ff9 commit f85c880
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/phpTranspiler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
6 changes: 6 additions & 0 deletions tests/csharpTranspiler.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 \";";
Expand Down
6 changes: 6 additions & 0 deletions tests/phpTranspiler.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 ';";
Expand Down
6 changes: 6 additions & 0 deletions tests/pythonTranspiler.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 '";
Expand Down

0 comments on commit f85c880

Please sign in to comment.