* Delete Value/Path must set Modified flag (Bug ID 30907)

git-svn-id: trunk@34870 -
This commit is contained in:
michael 2016-11-11 09:49:44 +00:00
parent 65469ebd4d
commit 66b07b045b
2 changed files with 5 additions and 0 deletions

View File

@ -637,6 +637,7 @@ begin
Node.Delete(L); Node.Delete(L);
end; end;
end; end;
FModified:=True;
end; end;
procedure TJSONConfig.DeleteValue(const APath: UnicodeString); procedure TJSONConfig.DeleteValue(const APath: UnicodeString);

View File

@ -179,7 +179,9 @@ begin
C:=CreateConf('test.json'); C:=CreateConf('test.json');
try try
C.SetValue('a',1); C.SetValue('a',1);
C.Flush;
C.DeleteValue('a'); C.DeleteValue('a');
AssertEquals('Modified set',True,C.Modified);
AssertEquals('Delete value',0,C.GetValue('a',0)); AssertEquals('Delete value',0,C.GetValue('a',0));
C.SetValue('b/a',1); C.SetValue('b/a',1);
C.SetValue('b/c',2); C.SetValue('b/c',2);
@ -187,7 +189,9 @@ begin
AssertEquals('Delete value in subkey',0,C.GetValue('a',0)); AssertEquals('Delete value in subkey',0,C.GetValue('a',0));
AssertEquals('Delete value only clears deleted value',2,C.GetValue('b/c',0)); AssertEquals('Delete value only clears deleted value',2,C.GetValue('b/c',0));
C.SetValue('b/a',1); C.SetValue('b/a',1);
C.Flush;
C.DeletePath('b'); C.DeletePath('b');
AssertEquals('Modified set',True,C.Modified);
AssertEquals('Delete path',0,C.GetValue('b/a',0)); AssertEquals('Delete path',0,C.GetValue('b/a',0));
AssertEquals('Delete path deletes all values',0,C.GetValue('b/c',0)); AssertEquals('Delete path deletes all values',0,C.GetValue('b/c',0));
C.Clear; C.Clear;