@@ -69,6 +69,26 @@ describe('RubyGenerator', () => {
6969 id4 : {
7070 name : 'List2' ,
7171 type : LIST_TYPE
72+ } ,
73+ id2_1 : {
74+ name : 'Avg(Total / Count)' ,
75+ type : SCALAR_TYPE
76+ } ,
77+ id2_2 : {
78+ name : 'List of Symbols.' ,
79+ type : LIST_TYPE
80+ } ,
81+ id2_3 : {
82+ name : ' !"#$%&\'()*+,-./:;<=>?@[\\]^`{|}~]' ,
83+ type : SCALAR_TYPE
84+ } ,
85+ id2_4 : {
86+ name : '平均(合計 / 件数)' ,
87+ type : SCALAR_TYPE
88+ } ,
89+ id2_5 : {
90+ name : 'シンボル 配列。' ,
91+ type : LIST_TYPE
7292 }
7393 } ,
7494 runtime : {
@@ -126,6 +146,26 @@ describe('RubyGenerator', () => {
126146 expect ( Ruby . variableName ( 'id5' ) ) . toEqual ( null ) ;
127147 expect ( Ruby . listName ( 'id6' ) ) . toEqual ( null ) ;
128148 } ) ;
149+
150+ test ( 'escape except alphabet, number and _ to _' , ( ) => {
151+ expect ( Ruby . variableName ( 'id2_1' ) ) . toEqual ( '@Avg_Total___Count_' ) ;
152+ expect ( Ruby . listName ( 'id2_2' ) ) . toEqual ( '@List_of_Symbols_' ) ;
153+ expect ( Ruby . variableName ( 'id2_3' ) ) . toEqual ( '@_________________________________' ) ;
154+
155+ renderedTarget . isStage = true ;
156+ expect ( Ruby . variableName ( 'id2_1' ) ) . toEqual ( '$Avg_Total___Count_' ) ;
157+ expect ( Ruby . listName ( 'id2_2' ) ) . toEqual ( '$List_of_Symbols_' ) ;
158+ expect ( Ruby . variableName ( 'id2_3' ) ) . toEqual ( '$_________________________________' ) ;
159+ } ) ;
160+
161+ test ( 'do not escape multibyte character like Japanese' , ( ) => {
162+ expect ( Ruby . variableName ( 'id2_4' ) ) . toEqual ( '@平均_合計___件数_' ) ;
163+ expect ( Ruby . listName ( 'id2_5' ) ) . toEqual ( '@シンボル 配列。' ) ;
164+
165+ renderedTarget . isStage = true ;
166+ expect ( Ruby . variableName ( 'id2_4' ) ) . toEqual ( '$平均_合計___件数_' ) ;
167+ expect ( Ruby . listName ( 'id2_5' ) ) . toEqual ( '$シンボル 配列。' ) ;
168+ } ) ;
129169 } ) ;
130170
131171 describe ( 'spriteNew' , ( ) => {
0 commit comments