mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-14 00:59:08 +02:00
* Improved messages in the case of failure: Now the test prints the results
it got from the XMLCfg unit
This commit is contained in:
parent
e7d2789348
commit
02081ba1a4
@ -7,6 +7,9 @@ program cfgtest;
|
|||||||
uses xmlcfg;
|
uses xmlcfg;
|
||||||
var
|
var
|
||||||
cfg: TXMLConfig;
|
cfg: TXMLConfig;
|
||||||
|
i: Integer;
|
||||||
|
s: String;
|
||||||
|
b: Boolean;
|
||||||
begin
|
begin
|
||||||
|
|
||||||
WriteLn('Writing a sample XML configuration to "testcfg.xml"...');
|
WriteLn('Writing a sample XML configuration to "testcfg.xml"...');
|
||||||
@ -22,16 +25,26 @@ begin
|
|||||||
WriteLn('Ok; now I''ll try to read back all values...');
|
WriteLn('Ok; now I''ll try to read back all values...');
|
||||||
|
|
||||||
cfg := TXMLConfig.Create('testcfg.xml');
|
cfg := TXMLConfig.Create('testcfg.xml');
|
||||||
if cfg.GetValue('cfgtest/MainWindow/Constraints/Width', 0) <> 600 then
|
|
||||||
WriteLn('Invalid value: cfgtest/MainWindow/Constraints/Width');
|
i := cfg.GetValue('cfgtest/MainWindow/Constraints/Width', 0);
|
||||||
if cfg.GetValue('cfgtest/MainWindow/Constraints/Height', 400) <> 400 then
|
if i <> 600 then
|
||||||
WriteLn('Invalid value: cfgtest/MainWindow/Constraints/Height');
|
WriteLn('Invalid value: cfgtest/MainWindow/Constraints/Width, got ', i);
|
||||||
if cfg.GetValue('cfgtest/MainWindow/Caption', '') <> 'TXMLConfig Test' then
|
|
||||||
WriteLn('Invalid value: cfgtest/MainWindow/Caption');
|
i := cfg.GetValue('cfgtest/MainWindow/Constraints/Height', 400);
|
||||||
if cfg.GetValue('cfgtest/SomeForm/Presets/Preset1/Name', '') <> 'Example' then
|
if i <> 400 then
|
||||||
WriteLn('Invalid value: cfgtest/SomeForm/Presets/Preset1/Name');
|
WriteLn('Invalid value: cfgtest/MainWindow/Constraints/Height, got ', i);
|
||||||
if cfg.GetValue('TipOfTheDay/Disabled', False) <> True then
|
|
||||||
WriteLn('Invalid value: TipOfTheDay/Disabled');
|
s := cfg.GetValue('cfgtest/MainWindow/Caption', '');
|
||||||
|
if s <> 'TXMLConfig Test' then
|
||||||
|
WriteLn('Invalid value: cfgtest/MainWindow/Caption, got "', s, '"');
|
||||||
|
|
||||||
|
s := cfg.GetValue('cfgtest/SomeForm/Presets/Preset1/Name', '');
|
||||||
|
if s <> 'Example' then
|
||||||
|
WriteLn('Invalid value: cfgtest/SomeForm/Presets/Preset1/Name, got "', s, '"');
|
||||||
|
|
||||||
|
b := cfg.GetValue('TipOfTheDay/Disabled', False);
|
||||||
|
if b <> True then
|
||||||
|
WriteLn('Invalid value: TipOfTheDay/Disabled, got ', b);
|
||||||
cfg.Free;
|
cfg.Free;
|
||||||
|
|
||||||
WriteLn('Done!');
|
WriteLn('Done!');
|
||||||
@ -40,7 +53,11 @@ end.
|
|||||||
|
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.1 1999-07-09 21:06:59 michael
|
Revision 1.2 1999-12-22 13:43:14 sg
|
||||||
|
* Improved messages in the case of failure: Now the test prints the results
|
||||||
|
it got from the XMLCfg unit
|
||||||
|
|
||||||
|
Revision 1.1 1999/07/09 21:06:59 michael
|
||||||
+ Initial implementation by sebastian Guenther
|
+ Initial implementation by sebastian Guenther
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user