Skip to content

Commit

Permalink
Add test for cyrillic; fix funcs with no real chars
Browse files Browse the repository at this point in the history
  • Loading branch information
PabstMirror committed Jan 12, 2018
1 parent e8488a4 commit fa245be
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion addons/strings/fnc_leftTrim.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ if (_trim == "") then {
};

// We have to process the string in array form because it could differ in length (if there are non-ASCII characters)
private _trimIndex = 0;
private _trimIndex = _numChars;
{
if !(_x in _trim) exitWith { _trimIndex = _forEachIndex; };
} forEach _chars;
Expand Down
2 changes: 1 addition & 1 deletion addons/strings/fnc_rightTrim.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ if (_trim == "") then {
};

// We have to process the string in array form because it could differ in length (if there are non-ASCII characters)
private _trimIndex = 0;
private _trimIndex = _numChars;
{
if !(_x in _trim) exitWith { _trimIndex = _forEachIndex; };
} forEach _chars;
Expand Down
4 changes: 4 additions & 0 deletions addons/strings/test_strings.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,10 @@ TEST_OP(_str,==,"",_fn);
_str = [" x "] call CBA_fnc_trim;
TEST_OP(_str,==,"x",_fn);

// Cyrillic letters (count "РґРµР" = 10)
_str = ["РґРµР", "Р"] call CBA_fnc_trim;
TEST_OP(_str,==,"ґРµ",_fn);

// ----------------------------------------------------------------------------
// UNIT TESTS (capitalize)
_fn = "CBA_fnc_capitalize";
Expand Down

0 comments on commit fa245be

Please sign in to comment.