summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormichael <michael@3ad0048d-3df7-0310-abae-a5850022a9f2>2015-03-25 17:53:14 +0000
committermichael <michael@3ad0048d-3df7-0310-abae-a5850022a9f2>2015-03-25 17:53:14 +0000
commit95a287d02965c7451c0af378242cdeb16f082164 (patch)
treed0a8214ac32b86f64fe27a3e988bea57e8fe5cfc
parenta1775a0e275fc588c6e581385b41a9ce25b2ca16 (diff)
downloadfpc-95a287d02965c7451c0af378242cdeb16f082164.tar.gz
* Small test program for xmlconf
git-svn-id: http://svn.freepascal.org/svn/fpc/trunk@30324 3ad0048d-3df7-0310-abae-a5850022a9f2
-rw-r--r--packages/fcl-xml/tests/testxmlconf.lpi64
-rw-r--r--packages/fcl-xml/tests/testxmlconf.lpr31
2 files changed, 95 insertions, 0 deletions
diff --git a/packages/fcl-xml/tests/testxmlconf.lpi b/packages/fcl-xml/tests/testxmlconf.lpi
new file mode 100644
index 0000000000..c2daccfe37
--- /dev/null
+++ b/packages/fcl-xml/tests/testxmlconf.lpi
@@ -0,0 +1,64 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<CONFIG>
+ <ProjectOptions>
+ <Version Value="9"/>
+ <General>
+ <Flags>
+ <MainUnitHasCreateFormStatements Value="False"/>
+ <MainUnitHasTitleStatement Value="False"/>
+ </Flags>
+ <SessionStorage Value="InProjectDir"/>
+ <MainUnit Value="0"/>
+ <Title Value="testxmlconf"/>
+ <UseAppBundle Value="False"/>
+ <ResourceType Value="res"/>
+ </General>
+ <i18n>
+ <EnableI18N LFM="False"/>
+ </i18n>
+ <VersionInfo>
+ <StringTable ProductVersion=""/>
+ </VersionInfo>
+ <BuildModes Count="1">
+ <Item1 Name="Default" Default="True"/>
+ </BuildModes>
+ <PublishOptions>
+ <Version Value="2"/>
+ </PublishOptions>
+ <RunParams>
+ <local>
+ <FormatVersion Value="1"/>
+ </local>
+ </RunParams>
+ <Units Count="1">
+ <Unit0>
+ <Filename Value="testxmlconf.lpr"/>
+ <IsPartOfProject Value="True"/>
+ <UnitName Value="testxmlconf"/>
+ </Unit0>
+ </Units>
+ </ProjectOptions>
+ <CompilerOptions>
+ <Version Value="11"/>
+ <Target>
+ <Filename Value="testxmlconf"/>
+ </Target>
+ <SearchPaths>
+ <IncludeFiles Value="$(ProjOutDir)"/>
+ <UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)"/>
+ </SearchPaths>
+ </CompilerOptions>
+ <Debugging>
+ <Exceptions Count="3">
+ <Item1>
+ <Name Value="EAbort"/>
+ </Item1>
+ <Item2>
+ <Name Value="ECodetoolError"/>
+ </Item2>
+ <Item3>
+ <Name Value="EFOpenError"/>
+ </Item3>
+ </Exceptions>
+ </Debugging>
+</CONFIG>
diff --git a/packages/fcl-xml/tests/testxmlconf.lpr b/packages/fcl-xml/tests/testxmlconf.lpr
new file mode 100644
index 0000000000..e934f8d11f
--- /dev/null
+++ b/packages/fcl-xml/tests/testxmlconf.lpr
@@ -0,0 +1,31 @@
+program testxmlconf;
+
+uses xmlconf;
+
+begin
+ With TXMLConfig.Create(Nil) do
+ try
+ FileName:='test.xml';
+ OpenKey('General');
+ SetValue('one',1);
+ SetValue('two',2);
+ SetValue('extra/name','michael');
+ Flush;
+ finally
+ Free;
+ end;
+ With TXMLConfig.Create(Nil) do
+ try
+ FileName:='test.xml';
+ OpenKey('General');
+ If GetValue('one',0)<>1 then
+ Writeln('One does not match');
+ If GetValue('two',0)<>2 then
+ Writeln('Two does not match');
+ if GetValue('extra/name','')<>'michael' then
+ Writeln('Name does not match');
+ finally
+ Free;
+ end;
+end.
+