# HG changeset patch # User Alain Mazy # Date 1557305501 -7200 # Node ID b7fd0471281c9ef9bdfa9468eda18acf8a3da388 # Parent fd9b9d993fc7eee39fae4da20662db5b168bb4cd fix CodeGeneration unit tests diff -r fd9b9d993fc7 -r b7fd0471281c .hgignore --- a/.hgignore Tue May 07 11:15:57 2019 +0200 +++ b/.hgignore Wed May 08 10:51:41 2019 +0200 @@ -16,6 +16,8 @@ Resources/CommandTool/protoc-tests/generated_ts/ Resources/CommandTool/flatc-tests/basic/build/ .vscode/ +Resources/CodeGeneration/.env +Resources/CodeGeneration/.idea Resources/CodeGeneration/__pycache__ Resources/CodeGeneration/build/ Resources/CodeGeneration/build_browser/ diff -r fd9b9d993fc7 -r b7fd0471281c Resources/CodeGeneration/README.md --- a/Resources/CodeGeneration/README.md Tue May 07 11:15:57 2019 +0200 +++ b/Resources/CodeGeneration/README.md Wed May 08 10:51:41 2019 +0200 @@ -14,4 +14,7 @@ 'testWasmIntegrated` contains a small Web app demonstrating the interaction between TypeScript and C++ in WASM. -source ~/apps/emsdk/emsdk_env.sh \ No newline at end of file +source ~/apps/emsdk/emsdk_env.sh + + +Install Python and the following packages `pip install pyyaml jinja2` diff -r fd9b9d993fc7 -r b7fd0471281c Resources/CodeGeneration/stonegentool_test.py --- a/Resources/CodeGeneration/stonegentool_test.py Tue May 07 11:15:57 2019 +0200 +++ b/Resources/CodeGeneration/stonegentool_test.py Wed May 08 10:51:41 2019 +0200 @@ -131,6 +131,7 @@ self.assertDictEqual(message1Struct, { 'name':'Message1', + '__meta__': {'handleInCpp': False, 'handleInTypescript': False}, 'fields': { 'a': 'int32', 'b': 'string', @@ -164,6 +165,12 @@ Barbecue, }; + export enum EnumMonth0 { + January, + February, + March, + }; + """ self.assertEqual(renderedCodeRef,renderedCode) @@ -192,6 +199,12 @@ Barbecue, }; + enum EnumMonth0 { + January, + February, + March, + }; + """ self.assertEqual(renderedCodeRef,renderedCode) @@ -278,9 +291,9 @@ movies:Array; constructor() { - someStrings = new Array(); - someInts2 = new Array(); - movies = new Array(); + this.someStrings = new Array(); + this.someInts2 = new Array(); + this.movies = new Array(); } public StoneSerialize(): string { @@ -296,8 +309,8 @@ someInts:Array; constructor() { - someAs = new Array(); - someInts = new Array(); + this.someAs = new Array(); + this.someInts = new Array(); } public StoneSerialize(): string { @@ -313,8 +326,8 @@ ddd:Array; constructor() { - someBs = new Array(); - ddd = new Array(); + this.someBs = new Array(); + this.ddd = new Array(); } public StoneSerialize(): string { @@ -332,10 +345,10 @@ d:boolean; constructor() { - a = new number(); - b = new string(); - c = new EnumMonth0(); - d = new boolean(); + this.a = new number(); + this.b = new string(); + this.c = new EnumMonth0(); + this.d = new boolean(); } public StoneSerialize(): string { @@ -352,13 +365,15 @@ tutu:Array; titi:Map; lulu:Map; + movieType:MovieType; constructor() { - toto = new string(); - tata = new Array(); - tutu = new Array(); - titi = new Map(); - lulu = new Map(); + this.toto = new string(); + this.tata = new Array(); + this.tutu = new Array(); + this.titi = new Map(); + this.lulu = new Map(); + this.movieType = new MovieType(); } public StoneSerialize(): string {