1
0
mirror of synced 2024-12-23 01:33:08 +01:00
x2utils/UnitTests/Units/StringsTest.pas

51 lines
886 B
ObjectPascal
Raw Normal View History

unit StringsTest;
interface
uses
TestFramework;
type
TStringsTest = class(TTestCase)
published
procedure TestSplit;
procedure TestSkipEmptyItems;
end;
implementation
uses
System.Types,
X2UtStrings;
{ TStringsTest }
procedure TStringsTest.TestSplit;
var
items: TStringDynArray;
begin
Split('value1/value2', '/', items);
CheckEquals(2, Length(items), 'Length');
CheckEquals('value1', items[0], 'Items[0]');
CheckEquals('value2', items[1], 'Items[1]');
end;
procedure TStringsTest.TestSkipEmptyItems;
var
items: TStringDynArray;
begin
Split('/value1///value2//', '/', items, True);
CheckEquals(2, Length(items), 'Length');
CheckEquals('value1', items[0], 'Items[0]');
CheckEquals('value2', items[1], 'Items[1]');
end;
initialization
RegisterTest('Strings', TStringsTest.Suite);
end.