Mercurial > hg > orthanc-stone
changeset 627:b7fd0471281c am-dev
fix CodeGeneration unit tests
author | Alain Mazy <alain@mazy.be> |
---|---|
date | Wed, 08 May 2019 10:51:41 +0200 |
parents | fd9b9d993fc7 |
children | 84af39146e76 |
files | .hgignore Resources/CodeGeneration/README.md Resources/CodeGeneration/stonegentool_test.py |
diffstat | 3 files changed, 37 insertions(+), 17 deletions(-) [+] |
line wrap: on
line diff
--- 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/
--- 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`
--- 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<MovieType>; constructor() { - someStrings = new Array<string>(); - someInts2 = new Array<number>(); - movies = new Array<MovieType>(); + this.someStrings = new Array<string>(); + this.someInts2 = new Array<number>(); + this.movies = new Array<MovieType>(); } public StoneSerialize(): string { @@ -296,8 +309,8 @@ someInts:Array<number>; constructor() { - someAs = new Array<A>(); - someInts = new Array<number>(); + this.someAs = new Array<A>(); + this.someInts = new Array<number>(); } public StoneSerialize(): string { @@ -313,8 +326,8 @@ ddd:Array<string>; constructor() { - someBs = new Array<B>(); - ddd = new Array<string>(); + this.someBs = new Array<B>(); + this.ddd = new Array<string>(); } 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<string>; titi:Map<string, string>; lulu:Map<string, Message1>; + movieType:MovieType; constructor() { - toto = new string(); - tata = new Array<Message1>(); - tutu = new Array<string>(); - titi = new Map<string, string>(); - lulu = new Map<string, Message1>(); + this.toto = new string(); + this.tata = new Array<Message1>(); + this.tutu = new Array<string>(); + this.titi = new Map<string, string>(); + this.lulu = new Map<string, Message1>(); + this.movieType = new MovieType(); } public StoneSerialize(): string {