mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-07-18 03:26:00 +02:00
50 lines
1.1 KiB
ObjectPascal
50 lines
1.1 KiB
ObjectPascal
{
|
|
Test all with:
|
|
./runtests --format=plain --suite=TTestLazXML
|
|
|
|
Test specific with:
|
|
./runtests --format=plain --suite=TestStrToXMLValue
|
|
}
|
|
unit TestLazXML;
|
|
|
|
{$mode objfpc}{$H+}
|
|
|
|
interface
|
|
|
|
uses
|
|
Classes, SysUtils, fpcunit, testglobals, laz2_DOM;
|
|
|
|
type
|
|
|
|
{ TTestLazXML }
|
|
|
|
TTestLazXML = class(TTestCase)
|
|
public
|
|
published
|
|
procedure TestStrToXMLValue;
|
|
end;
|
|
|
|
implementation
|
|
|
|
{ TTestLazXML }
|
|
|
|
procedure TTestLazXML.TestStrToXMLValue;
|
|
begin
|
|
AssertEquals('Empty string','',StrToXMLValue(''));
|
|
AssertEquals('Short string','a',StrToXMLValue('a'));
|
|
AssertEquals('String with #0','',StrToXMLValue(#0));
|
|
AssertEquals('String with &','&',StrToXMLValue('&'));
|
|
AssertEquals('String with <','<',StrToXMLValue('<'));
|
|
AssertEquals('String with >','>',StrToXMLValue('>'));
|
|
AssertEquals('String with ''',''',StrToXMLValue(''''));
|
|
AssertEquals('String with "','"',StrToXMLValue('"'));
|
|
AssertEquals('String mix 1','<a>"',StrToXMLValue('<a>'#0'"'));
|
|
AssertEquals('String mix 1','abc',StrToXMLValue('abc'));
|
|
end;
|
|
|
|
initialization
|
|
AddToLazUtilsTestSuite(TTestLazXML);
|
|
|
|
end.
|
|
|