Fixed: WideString compatibility for Split function
This commit is contained in:
parent
ec2536d09a
commit
64eb0b252f
37
UnitTests/Units/StringsTest.pas
Normal file
37
UnitTests/Units/StringsTest.pas
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
unit StringsTest;
|
||||||
|
|
||||||
|
interface
|
||||||
|
uses
|
||||||
|
TestFramework;
|
||||||
|
|
||||||
|
|
||||||
|
type
|
||||||
|
TStringsTest = class(TTestCase)
|
||||||
|
published
|
||||||
|
procedure TestSplit;
|
||||||
|
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;
|
||||||
|
|
||||||
|
initialization
|
||||||
|
RegisterTest('Strings', TStringsTest.Suite);
|
||||||
|
|
||||||
|
end.
|
@ -10,7 +10,8 @@ uses
|
|||||||
X2UtSingleInstance in '..\X2UtSingleInstance.pas',
|
X2UtSingleInstance in '..\X2UtSingleInstance.pas',
|
||||||
X2UtHashes in '..\X2UtHashes.pas',
|
X2UtHashes in '..\X2UtHashes.pas',
|
||||||
X2UtHashesVariants in '..\X2UtHashesVariants.pas',
|
X2UtHashesVariants in '..\X2UtHashesVariants.pas',
|
||||||
NamedFormatTest in 'Units\NamedFormatTest.pas';
|
NamedFormatTest in 'Units\NamedFormatTest.pas',
|
||||||
|
StringsTest in 'Units\StringsTest.pas';
|
||||||
|
|
||||||
//SettingsTest in 'Units\SettingsTest.pas',
|
//SettingsTest in 'Units\SettingsTest.pas',
|
||||||
//IniParserTest in 'Units\IniParserTest.pas';
|
//IniParserTest in 'Units\IniParserTest.pas';
|
||||||
|
@ -1,13 +1,48 @@
|
|||||||
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<ProjectGuid>{8bee0e67-704c-4611-9014-0f8cc2fb0289}</ProjectGuid>
|
<ProjectGuid>{8bee0e67-704c-4611-9014-0f8cc2fb0289}</ProjectGuid>
|
||||||
<MainSource>X2UtUnitTests.dpr</MainSource>
|
<MainSource>X2UtUnitTests.dpr</MainSource>
|
||||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
|
||||||
<DCC_DCCCompiler>DCC32</DCC_DCCCompiler>
|
<DCC_DCCCompiler>DCC32</DCC_DCCCompiler>
|
||||||
<DCC_DependencyCheckOutputName>X2UtUnitTests.exe</DCC_DependencyCheckOutputName>
|
<DCC_DependencyCheckOutputName>X2UtUnitTests.exe</DCC_DependencyCheckOutputName>
|
||||||
|
<FrameworkType>None</FrameworkType>
|
||||||
|
<ProjectVersion>13.4</ProjectVersion>
|
||||||
|
<Base>True</Base>
|
||||||
|
<Config Condition="'$(Config)'==''">Debug</Config>
|
||||||
|
<Platform Condition="'$(Platform)'==''">Win32</Platform>
|
||||||
|
<TargetedPlatforms>1</TargetedPlatforms>
|
||||||
|
<AppType>Console</AppType>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
<PropertyGroup Condition="'$(Config)'=='Base' or '$(Base)'!=''">
|
||||||
|
<Base>true</Base>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="('$(Platform)'=='Win32' and '$(Base)'=='true') or '$(Base_Win32)'!=''">
|
||||||
|
<Base_Win32>true</Base_Win32>
|
||||||
|
<CfgParent>Base</CfgParent>
|
||||||
|
<Base>true</Base>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Config)'=='Release' or '$(Cfg_1)'!=''">
|
||||||
|
<Cfg_1>true</Cfg_1>
|
||||||
|
<CfgParent>Base</CfgParent>
|
||||||
|
<Base>true</Base>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Config)'=='Debug' or '$(Cfg_2)'!=''">
|
||||||
|
<Cfg_2>true</Cfg_2>
|
||||||
|
<CfgParent>Base</CfgParent>
|
||||||
|
<Base>true</Base>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Base)'!=''">
|
||||||
|
<DCC_Namespace>System;Xml;Data;Datasnap;Web;Soap;Winapi;$(DCC_Namespace)</DCC_Namespace>
|
||||||
|
<VerInfo_Keys>CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments=</VerInfo_Keys>
|
||||||
|
<VerInfo_Locale>1043</VerInfo_Locale>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Base_Win32)'!=''">
|
||||||
|
<Debugger_RunParams>ip-to-country.csv countries.csv geo.db</Debugger_RunParams>
|
||||||
|
<DCC_Namespace>Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace)</DCC_Namespace>
|
||||||
|
<VerInfo_Locale>1033</VerInfo_Locale>
|
||||||
|
<VerInfo_Keys>CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments=</VerInfo_Keys>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Cfg_1)'!=''">
|
||||||
<Version>7.0</Version>
|
<Version>7.0</Version>
|
||||||
<DCC_DebugInformation>False</DCC_DebugInformation>
|
<DCC_DebugInformation>False</DCC_DebugInformation>
|
||||||
<DCC_WriteableConstants>True</DCC_WriteableConstants>
|
<DCC_WriteableConstants>True</DCC_WriteableConstants>
|
||||||
@ -16,45 +51,102 @@
|
|||||||
<DCC_SymbolReferenceInfo>0</DCC_SymbolReferenceInfo>
|
<DCC_SymbolReferenceInfo>0</DCC_SymbolReferenceInfo>
|
||||||
<DCC_DebugInfoInExe>True</DCC_DebugInfoInExe>
|
<DCC_DebugInfoInExe>True</DCC_DebugInfoInExe>
|
||||||
<DCC_DebugVN>True</DCC_DebugVN>
|
<DCC_DebugVN>True</DCC_DebugVN>
|
||||||
<DCC_UnitSearchPath>..\</DCC_UnitSearchPath>
|
<DCC_UnitSearchPath>..\;$(DCC_UnitSearchPath)</DCC_UnitSearchPath>
|
||||||
<DCC_ResourcePath>..\</DCC_ResourcePath>
|
<DCC_ResourcePath>..\;$(DCC_ResourcePath)</DCC_ResourcePath>
|
||||||
<DCC_ObjPath>..\</DCC_ObjPath>
|
<DCC_ObjPath>..\;$(DCC_ObjPath)</DCC_ObjPath>
|
||||||
<DCC_IncludePath>..\</DCC_IncludePath>
|
<DCC_IncludePath>..\;$(DCC_IncludePath)</DCC_IncludePath>
|
||||||
<DCC_Define>RELEASE</DCC_Define>
|
<DCC_Define>RELEASE;$(DCC_Define)</DCC_Define>
|
||||||
<DCC_SYMBOL_PLATFORM>False</DCC_SYMBOL_PLATFORM>
|
<DCC_SYMBOL_PLATFORM>False</DCC_SYMBOL_PLATFORM>
|
||||||
<DCC_UNIT_PLATFORM>False</DCC_UNIT_PLATFORM>
|
<DCC_UNIT_PLATFORM>False</DCC_UNIT_PLATFORM>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
<PropertyGroup Condition="'$(Cfg_2)'!=''">
|
||||||
<Version>7.0</Version>
|
<Version>7.0</Version>
|
||||||
<DCC_WriteableConstants>True</DCC_WriteableConstants>
|
<DCC_WriteableConstants>True</DCC_WriteableConstants>
|
||||||
<DCC_GenerateStackFrames>True</DCC_GenerateStackFrames>
|
<DCC_GenerateStackFrames>True</DCC_GenerateStackFrames>
|
||||||
<DCC_DebugInfoInExe>True</DCC_DebugInfoInExe>
|
<DCC_DebugInfoInExe>True</DCC_DebugInfoInExe>
|
||||||
<DCC_DebugVN>True</DCC_DebugVN>
|
<DCC_DebugVN>True</DCC_DebugVN>
|
||||||
<DCC_UnitSearchPath>..\</DCC_UnitSearchPath>
|
<DCC_UnitSearchPath>..\;$(DCC_UnitSearchPath)</DCC_UnitSearchPath>
|
||||||
<DCC_ResourcePath>..\</DCC_ResourcePath>
|
<DCC_ResourcePath>..\;$(DCC_ResourcePath)</DCC_ResourcePath>
|
||||||
<DCC_ObjPath>..\</DCC_ObjPath>
|
<DCC_ObjPath>..\;$(DCC_ObjPath)</DCC_ObjPath>
|
||||||
<DCC_IncludePath>..\</DCC_IncludePath>
|
<DCC_IncludePath>..\;$(DCC_IncludePath)</DCC_IncludePath>
|
||||||
<DCC_Define>DEBUG</DCC_Define>
|
<DCC_Define>DEBUG;$(DCC_Define)</DCC_Define>
|
||||||
<DCC_SYMBOL_PLATFORM>False</DCC_SYMBOL_PLATFORM>
|
<DCC_SYMBOL_PLATFORM>False</DCC_SYMBOL_PLATFORM>
|
||||||
<DCC_UNIT_PLATFORM>False</DCC_UNIT_PLATFORM>
|
<DCC_UNIT_PLATFORM>False</DCC_UNIT_PLATFORM>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ProjectExtensions>
|
<ProjectExtensions>
|
||||||
<Borland.Personality>Delphi.Personality</Borland.Personality>
|
<Borland.Personality>Delphi.Personality.12</Borland.Personality>
|
||||||
<Borland.ProjectType>VCLApplication</Borland.ProjectType>
|
<Borland.ProjectType>VCLApplication</Borland.ProjectType>
|
||||||
<BorlandProject>
|
<BorlandProject>
|
||||||
<BorlandProject><Delphi.Personality><Parameters><Parameters Name="RunParams">ip-to-country.csv countries.csv geo.db</Parameters><Parameters Name="UseLauncher">False</Parameters><Parameters Name="LoadAllSymbols">True</Parameters><Parameters Name="LoadUnspecifiedSymbols">False</Parameters></Parameters><VersionInfo><VersionInfo Name="IncludeVerInfo">False</VersionInfo><VersionInfo Name="AutoIncBuild">False</VersionInfo><VersionInfo Name="MajorVer">1</VersionInfo><VersionInfo Name="MinorVer">0</VersionInfo><VersionInfo Name="Release">0</VersionInfo><VersionInfo Name="Build">0</VersionInfo><VersionInfo Name="Debug">False</VersionInfo><VersionInfo Name="PreRelease">False</VersionInfo><VersionInfo Name="Special">False</VersionInfo><VersionInfo Name="Private">False</VersionInfo><VersionInfo Name="DLL">False</VersionInfo><VersionInfo Name="Locale">1043</VersionInfo><VersionInfo Name="CodePage">1252</VersionInfo></VersionInfo><VersionInfoKeys><VersionInfoKeys Name="CompanyName"></VersionInfoKeys><VersionInfoKeys Name="FileDescription"></VersionInfoKeys><VersionInfoKeys Name="FileVersion">1.0.0.0</VersionInfoKeys><VersionInfoKeys Name="InternalName"></VersionInfoKeys><VersionInfoKeys Name="LegalCopyright"></VersionInfoKeys><VersionInfoKeys Name="LegalTrademarks"></VersionInfoKeys><VersionInfoKeys Name="OriginalFilename"></VersionInfoKeys><VersionInfoKeys Name="ProductName"></VersionInfoKeys><VersionInfoKeys Name="ProductVersion">1.0.0.0</VersionInfoKeys><VersionInfoKeys Name="Comments"></VersionInfoKeys></VersionInfoKeys><Source><Source Name="MainSource">X2UtUnitTests.dpr</Source></Source></Delphi.Personality></BorlandProject></BorlandProject>
|
<Delphi.Personality>
|
||||||
|
<Parameters>
|
||||||
|
<Parameters Name="RunParams">ip-to-country.csv countries.csv geo.db</Parameters>
|
||||||
|
<Parameters Name="UseLauncher">False</Parameters>
|
||||||
|
<Parameters Name="LoadAllSymbols">True</Parameters>
|
||||||
|
<Parameters Name="LoadUnspecifiedSymbols">False</Parameters>
|
||||||
|
</Parameters>
|
||||||
|
<VersionInfo>
|
||||||
|
<VersionInfo Name="IncludeVerInfo">False</VersionInfo>
|
||||||
|
<VersionInfo Name="AutoIncBuild">False</VersionInfo>
|
||||||
|
<VersionInfo Name="MajorVer">1</VersionInfo>
|
||||||
|
<VersionInfo Name="MinorVer">0</VersionInfo>
|
||||||
|
<VersionInfo Name="Release">0</VersionInfo>
|
||||||
|
<VersionInfo Name="Build">0</VersionInfo>
|
||||||
|
<VersionInfo Name="Debug">False</VersionInfo>
|
||||||
|
<VersionInfo Name="PreRelease">False</VersionInfo>
|
||||||
|
<VersionInfo Name="Special">False</VersionInfo>
|
||||||
|
<VersionInfo Name="Private">False</VersionInfo>
|
||||||
|
<VersionInfo Name="DLL">False</VersionInfo>
|
||||||
|
<VersionInfo Name="Locale">1043</VersionInfo>
|
||||||
|
<VersionInfo Name="CodePage">1252</VersionInfo>
|
||||||
|
</VersionInfo>
|
||||||
|
<VersionInfoKeys>
|
||||||
|
<VersionInfoKeys Name="CompanyName"/>
|
||||||
|
<VersionInfoKeys Name="FileDescription"/>
|
||||||
|
<VersionInfoKeys Name="FileVersion">1.0.0.0</VersionInfoKeys>
|
||||||
|
<VersionInfoKeys Name="InternalName"/>
|
||||||
|
<VersionInfoKeys Name="LegalCopyright"/>
|
||||||
|
<VersionInfoKeys Name="LegalTrademarks"/>
|
||||||
|
<VersionInfoKeys Name="OriginalFilename"/>
|
||||||
|
<VersionInfoKeys Name="ProductName"/>
|
||||||
|
<VersionInfoKeys Name="ProductVersion">1.0.0.0</VersionInfoKeys>
|
||||||
|
<VersionInfoKeys Name="Comments"/>
|
||||||
|
</VersionInfoKeys>
|
||||||
|
<Source>
|
||||||
|
<Source Name="MainSource">X2UtUnitTests.dpr</Source>
|
||||||
|
</Source>
|
||||||
|
</Delphi.Personality>
|
||||||
|
<Platforms>
|
||||||
|
<Platform value="Win64">False</Platform>
|
||||||
|
<Platform value="OSX32">False</Platform>
|
||||||
|
<Platform value="Win32">True</Platform>
|
||||||
|
</Platforms>
|
||||||
|
</BorlandProject>
|
||||||
|
<ProjectFileVersion>12</ProjectFileVersion>
|
||||||
</ProjectExtensions>
|
</ProjectExtensions>
|
||||||
<Import Project="$(MSBuildBinPath)\Borland.Delphi.Targets" />
|
<Import Project="$(BDS)\Bin\CodeGear.Delphi.Targets"/>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<DelphiCompile Include="X2UtUnitTests.dpr">
|
<DelphiCompile Include="$(MainSource)">
|
||||||
<MainSource>MainSource</MainSource>
|
<MainSource>MainSource</MainSource>
|
||||||
</DelphiCompile>
|
</DelphiCompile>
|
||||||
<DCCReference Include="..\X2UtHashes.pas" />
|
<DCCReference Include="Units\BitsTest.pas"/>
|
||||||
<DCCReference Include="..\X2UtHashesVariants.pas" />
|
<DCCReference Include="Units\HashesTest.pas"/>
|
||||||
<DCCReference Include="..\X2UtSingleInstance.pas" />
|
<DCCReference Include="Units\PersistTest.pas"/>
|
||||||
<DCCReference Include="Units\BitsTest.pas" />
|
<DCCReference Include="..\X2UtSingleInstance.pas"/>
|
||||||
<DCCReference Include="Units\HashesTest.pas" />
|
<DCCReference Include="..\X2UtHashes.pas"/>
|
||||||
<DCCReference Include="Units\NamedFormatTest.pas" />
|
<DCCReference Include="..\X2UtHashesVariants.pas"/>
|
||||||
<DCCReference Include="Units\PersistTest.pas" />
|
<DCCReference Include="Units\NamedFormatTest.pas"/>
|
||||||
|
<DCCReference Include="Units\StringsTest.pas"/>
|
||||||
|
<BuildConfiguration Include="Debug">
|
||||||
|
<Key>Cfg_2</Key>
|
||||||
|
<CfgParent>Base</CfgParent>
|
||||||
|
</BuildConfiguration>
|
||||||
|
<BuildConfiguration Include="Base">
|
||||||
|
<Key>Base</Key>
|
||||||
|
</BuildConfiguration>
|
||||||
|
<BuildConfiguration Include="Release">
|
||||||
|
<Key>Cfg_1</Key>
|
||||||
|
<CfgParent>Base</CfgParent>
|
||||||
|
</BuildConfiguration>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
<Import Condition="Exists('$(APPDATA)\Embarcadero\$(BDSAPPDATABASEDIR)\$(PRODUCTVERSION)\UserTools.proj')" Project="$(APPDATA)\Embarcadero\$(BDSAPPDATABASEDIR)\$(PRODUCTVERSION)\UserTools.proj"/>
|
||||||
|
</Project>
|
||||||
|
@ -295,7 +295,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
// Copy substring
|
// Copy substring
|
||||||
iSize := Integer(pPos) - Integer(pLast);
|
iSize := (Integer(pPos) - Integer(pLast)) div SizeOf(Char);
|
||||||
SetString(ADest[iCount - 1], pLast, iSize);
|
SetString(ADest[iCount - 1], pLast, iSize);
|
||||||
|
|
||||||
// Move pointer
|
// Move pointer
|
||||||
|
Loading…
Reference in New Issue
Block a user