Bug in refactoring in XE5.
Bug in refactoring in XE5.
Can someone check this in XE6 and report if still an issue?
Use refactoring to rename constant CreateStoragePos to f.x. CreateStorage.
Result: reference in attribute
[TestCase('Create', CreateStoragePos, NoSep)]
will not be renamed.
{code}
unit DUnitX_PSDStorage;
interface
uses
DUnitX_PSDBase, PSDConstants, PSDStorage,
DUnitX.TestFramework;
const
CreateStoragePos = String('something');
ModifyStoragePos = String('something');
type
[TestFixture]
TestTPSDStorageArea= class(TTestClass)
public
[Setup]
procedure Setup; override;
[TearDown]
procedure TearDown; override;
[Test]
[TestCase('Create', CreateStoragePos, NoSep)]
procedure CreateFromJSON(const aJSON: String); override;
[Test]
function SaveToDB:TPSDResult; override;
[Test]
function ReadFromDb:TPSDResult; override;
[Test]
[TestCase('Modify', ModifyStoragePos, NoSep)]
function ChangeAndSave(const aJSON: String):TPSDResult; override;
[Test]
function DeleteFromDb:TPSDResult; override;
end;
{code}
Can someone check this in XE6 and report if still an issue?
Use refactoring to rename constant CreateStoragePos to f.x. CreateStorage.
Result: reference in attribute
[TestCase('Create', CreateStoragePos, NoSep)]
will not be renamed.
{code}
unit DUnitX_PSDStorage;
interface
uses
DUnitX_PSDBase, PSDConstants, PSDStorage,
DUnitX.TestFramework;
const
CreateStoragePos = String('something');
ModifyStoragePos = String('something');
type
[TestFixture]
TestTPSDStorageArea= class(TTestClass
public
[Setup]
procedure Setup; override;
[TearDown]
procedure TearDown; override;
[Test]
[TestCase('Create', CreateStoragePos, NoSep)]
procedure CreateFromJSON(const aJSON: String); override;
[Test]
function SaveToDB:TPSDResult; override;
[Test]
function ReadFromDb:TPSDResult; override;
[Test]
[TestCase('Modify', ModifyStoragePos, NoSep)]
function ChangeAndSave(const aJSON: String):TPSDResult; override;
[Test]
function DeleteFromDb:TPSDResult; override;
end;
{code}
XE6: the attribute isn't changed. (Note my refactoring may be affected by not having the DUnitX code installed & available, so the unit won't compile. That tends to affect Delphi's refactoring.)
ReplyDeleteClean unit
ReplyDelete{code}
unit AttribParamRefactoring;
interface
const
// Use refactoring to rename aStrConst
aStrConst = String('Some constant');
type
MyAttrib = class(TCustomAttribute)
private
FParam: String;
public
constructor Create(const aParam: String);
end;
type
TMyObject = class
private
FSomeProperty: Integer;
procedure SetSomeProperty(const Value: Integer);
public
// aStrConst reference in attribute is not renamed
[MyAttrib(aStrConst)]
property SomeProperty:Integer read FSomeProperty write SetSomeProperty;
end;
implementation
{ MyAttrib }
constructor MyAttrib.Create(const aParam: String);
begin
FParam := aParam;
end;
{ TMyObject }
procedure TMyObject.SetSomeProperty(const Value: Integer);
begin
FSomeProperty := Value;
end;
end.
{code}
Same behavior in XE6.
ReplyDeletehttp://qc.embarcadero.com/wc/qcmain.aspx?d=124982
ReplyDeleteLars Fosdal rename `aStrConst` fails in XE6.
ReplyDelete