forked from HaxeFoundation/haxe
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[php] check string type in TUnop too (closes HaxeFoundation#3263)
- Loading branch information
Showing
2 changed files
with
57 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
package unit.issues; | ||
|
||
class Issue3263 extends Test { | ||
public static function teststrings1 () { | ||
var str1 = 'Test'; | ||
var len = str1.length; | ||
var str2 = str1.substr(0, -(len)-1); | ||
return str2; | ||
} | ||
|
||
public static function teststrings2 () { | ||
var str1 = 'Test'; | ||
var str2 = str1.substr(0, -(str1.length)-1); | ||
return str2; | ||
} | ||
|
||
public static function teststrings3 () { | ||
var str1 = 'Test'; | ||
var str2 = str1.substr(0, (str1.length)-1); | ||
return str2; | ||
} | ||
|
||
public static function teststrings4 () { | ||
var str1 = 'Test'; | ||
var str2 = str1.substr(0, (str1.length)); | ||
return str2; | ||
} | ||
|
||
public static function teststrings5 () { | ||
var str1 = 'Test'; | ||
var str2 = str1.substr(0, str1.length); | ||
return str2; | ||
} | ||
|
||
public static function teststrings6 () { | ||
var str1 = 'Test'; | ||
var str2 = str1.substr(0, -str1.length - 1); | ||
return str2; | ||
} | ||
|
||
public static function teststrings7 () { | ||
var str1 = 'Test'; | ||
var str2 = str1.substr(0, -str1.length); | ||
return str2; | ||
} | ||
|
||
function test() { | ||
//eq("Tes", teststrings1()); | ||
eq("Tes", teststrings3()); | ||
eq("Test", teststrings4()); | ||
eq("Test", teststrings5()); | ||
//eq("Tes", teststrings2()); | ||
//eq("Tes", teststrings6()); | ||
eq("", teststrings7()); | ||
} | ||
} |