@@ -42,10 +42,30 @@ export class StringTests {
4242 Expect ( result ) . toBe ( inp . replace ( searchValue , replaceValue ) ) ;
4343 }
4444
45+ @TestCase ( [ "" , "" ] , "" )
46+ @TestCase ( [ "hello" , "test" ] , "hellotest" )
47+ @TestCase ( [ "hello" , "test" , "bye" ] , "hellotestbye" )
48+ @TestCase ( [ "hello" , 42 ] , "hello42" )
49+ @TestCase ( [ 42 , "hello" ] , "42hello" )
50+ @Test ( "string.concat[+]" )
51+ public concat ( inp : any [ ] , expected : string ) {
52+ // Transpile
53+ let lua = util . transpileString (
54+ `return '${ inp . join ( "' + '" ) } '` ,
55+ util . dummyTypes . String
56+ ) ;
57+
58+ // Execute
59+ let result = util . executeLua ( lua ) ;
60+
61+ // Assert
62+ Expect ( result ) . toBe ( expected ) ;
63+ }
64+
4565 @TestCase ( "hello test" , new RegExp ( "123" , "g" ) , "" )
4666 @IgnoreTest ( )
4767 @Test ( "string.replace[Regex]" )
48- public replaceRegex < T > ( inp : string , searchValue : string , replaceValue : string ) {
68+ public replaceRegex ( inp : string , searchValue : string , replaceValue : string ) {
4969 // Transpile
5070 let lua = util . transpileString (
5171 `return "${ inp } ".replace("${ searchValue } ", "${ replaceValue } ")` ,
@@ -63,7 +83,7 @@ export class StringTests {
6383 @TestCase ( "hello test" , "t" )
6484 @TestCase ( "hello test" , "h" )
6585 @Test ( "string.indexOf" )
66- public indexOf < T > ( inp : string , searchValue : string ) {
86+ public indexOf ( inp : string , searchValue : string ) {
6787 // Transpile
6888 let lua = util . transpileString (
6989 `return "${ inp } ".indexOf("${ searchValue } ")` ,
@@ -82,7 +102,7 @@ export class StringTests {
82102 @TestCase ( "hello test" , 1 , 2 )
83103 @TestCase ( "hello test" , 1 , 5 )
84104 @Test ( "string.substring" )
85- public substring < T > ( inp : string , start : number , end ?: number ) {
105+ public substring ( inp : string , start : number , end ?: number ) {
86106 // Transpile
87107 let paramStr = end ? `${ start } , ${ end } ` : `${ start } ` ;
88108 let lua = util . transpileString (
0 commit comments