Skip to content

Commit

Permalink
Used unit namespaces, removed all efforts to support earlier than XE2…
Browse files Browse the repository at this point in the history
… (pointless).
  • Loading branch information
vincentparrett committed Jun 9, 2021
1 parent e9c32de commit f29d2c0
Show file tree
Hide file tree
Showing 27 changed files with 1,534 additions and 243 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Delphi Mocks

Delphi Mocks is a simple mocking framework for Delphi XE2 or later. It makes use of RTTI features that are only available in Delphi XE2, however I do hope to be able to get it working with earlier versions of Delphi (2010 or later) at some stage.
Delphi Mocks is a simple mocking framework for Delphi XE2 or later. It makes use of RTTI features that are only available in Delphi XE2.

# Example

Expand Down Expand Up @@ -43,7 +43,7 @@ type
implementation
uses
Rtti;
System.Rtti;
{ TMockObjectTests }
Expand Down
2 changes: 1 addition & 1 deletion Source/Delphi.Mocks.AutoMock.pas
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
interface

uses
TypInfo,
System.TypInfo,
System.Generics.Collections,
Delphi.Mocks,
Delphi.Mocks.WeakReference;
Expand Down
4 changes: 2 additions & 2 deletions Source/Delphi.Mocks.Behavior.pas
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
interface

uses
Rtti,
SysUtils,
System.Rtti,
System.SysUtils,
Delphi.Mocks,
Delphi.Mocks.Interfaces,
Delphi.Mocks.ParamMatcher;
Expand Down
4 changes: 2 additions & 2 deletions Source/Delphi.Mocks.Expectation.pas
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ interface


uses
Rtti,
System.Rtti,
Delphi.Mocks,
Delphi.Mocks.ParamMatcher,
Delphi.Mocks.Interfaces,
Expand Down Expand Up @@ -96,7 +96,7 @@ TExpectation = class(TInterfacedObject,IExpectation)
implementation

uses
SysUtils,
System.SysUtils,
Delphi.Mocks.Helpers;

{ TExpectation }
Expand Down
18 changes: 9 additions & 9 deletions Source/Delphi.Mocks.Helpers.pas
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
interface

uses
Rtti;
System.Rtti;

type
//TValue really needs to have an Equals operator overload!
Expand Down Expand Up @@ -85,11 +85,11 @@ function SameValue(const Left, Right: TValue): Boolean;
implementation

uses
SysUtils,
Math,
TypInfo,
Variants,
StrUtils;
System.SysUtils,
System.Math,
System.TypInfo,
System.Variants,
System.StrUtils;

var
Context : TRttiContext;
Expand All @@ -107,11 +107,11 @@ function CompareValue(const Left, Right: TValue): Integer;
if leftIsEmpty or rightIsEmpty then
Result := EmptyResults[leftIsEmpty, rightIsEmpty]
else if left.IsOrdinal and right.IsOrdinal then
Result := Math.CompareValue(left.AsOrdinal, right.AsOrdinal)
Result := System.Math.CompareValue(left.AsOrdinal, right.AsOrdinal)
else if left.IsFloat and right.IsFloat then
Result := Math.CompareValue(left.AsExtended, right.AsExtended)
Result := System.Math.CompareValue(left.AsExtended, right.AsExtended)
else if left.IsString and right.IsString then
Result := SysUtils.AnsiCompareStr(left.AsString, right.AsString)
Result := System.SysUtils.AnsiCompareStr(left.AsString, right.AsString)
else if left.IsObject and right.IsObject then
Result := NativeInt(left.AsObject) - NativeInt(right.AsObject) // TODO: instance comparer
else if Left.IsInterface and Right.IsInterface then
Expand Down
10 changes: 5 additions & 5 deletions Source/Delphi.Mocks.Interfaces.pas
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@
interface

uses
SysUtils,
TypInfo,
Generics.Collections,
System.SysUtils,
System.TypInfo,
System.Rtti,
System.Generics.Collections,
Delphi.Mocks,
Delphi.Mocks.ParamMatcher,
Rtti;
Delphi.Mocks.ParamMatcher;

type
TBehaviorType = (WillReturn,ReturnDefault,WillRaise,WillRaiseAlways,WillExecute,WillExecuteWhen);
Expand Down
6 changes: 3 additions & 3 deletions Source/Delphi.Mocks.MethodData.pas
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@
interface

uses
Rtti,
SysUtils,
Generics.Collections,
System.Rtti,
System.SysUtils,
System.Generics.Collections,
Delphi.Mocks,
Delphi.Mocks.Interfaces,
Delphi.Mocks.ParamMatcher;
Expand Down
11 changes: 5 additions & 6 deletions Source/Delphi.Mocks.ObjectProxy.pas
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,13 @@
interface

uses
Rtti,
SysUtils,
TypInfo,
Generics.Collections,
System.Rtti,
System.SysUtils,
System.TypInfo,
System.Generics.Collections,
Delphi.Mocks,
Delphi.Mocks.Interfaces,
Delphi.Mocks.Proxy,
Delphi.Mocks.VirtualMethodInterceptor;
Delphi.Mocks.Proxy;

type
TObjectProxy<T> = class(TProxy<T>)
Expand Down
12 changes: 6 additions & 6 deletions Source/Delphi.Mocks.ParamMatcher.pas
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@
interface

uses
Generics.Collections,
SysUtils,
TypInfo,
Rtti;
System.Generics.Collections,
System.SysUtils,
System.TypInfo,
System.Rtti;


type
Expand Down Expand Up @@ -67,8 +67,8 @@ TMatcherFactory = class
implementation

uses
Classes,
SyncObjs;
System.Classes,
System.SyncObjs;


{ TMatcherFactory }
Expand Down
8 changes: 4 additions & 4 deletions Source/Delphi.Mocks.Proxy.TypeInfo.pas
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@
interface

uses
Rtti,
SysUtils,
Generics.Collections,
TypInfo,
System.Rtti,
System.SysUtils,
System.Generics.Collections,
System.TypInfo,
Delphi.Mocks,
Delphi.Mocks.Proxy,
Delphi.Mocks.WeakReference,
Expand Down
8 changes: 4 additions & 4 deletions Source/Delphi.Mocks.Proxy.pas
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@
interface

uses
Rtti,
SysUtils,
TypInfo,
Generics.Collections,
System.Rtti,
System.SysUtils,
System.TypInfo,
System.Generics.Collections,
Delphi.Mocks,
Delphi.Mocks.WeakReference,
Delphi.Mocks.Interfaces,
Expand Down
4 changes: 2 additions & 2 deletions Source/Delphi.Mocks.ReturnTypePatch.pas
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ initialization
interface

uses
Rtti,
TypInfo;
System.Rtti,
System.TypInfo;

type
ReturnTypePatchAttribute = class(TCustomAttribute)
Expand Down
8 changes: 4 additions & 4 deletions Source/Delphi.Mocks.Utils.pas
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@
interface

uses
TypInfo,
RTTI;
System.TypInfo,
System.Rtti;

function CheckInterfaceHasRTTI(const info : PTypeInfo) : boolean;

Expand All @@ -45,8 +45,8 @@ function ArgsToString(const Args: TArray<TValue>; OffSet: Integer = 0): string;
implementation

uses
Variants,
SysUtils;
System.Variants,
System.SysUtils;

function CheckInterfaceHasRTTI(const info : PTypeInfo) : boolean;
var
Expand Down
2 changes: 1 addition & 1 deletion Source/Delphi.Mocks.Validation.pas
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
interface

uses
typInfo;
System.TypInfo;

type
TMocksValidation = class(TObject)
Expand Down
61 changes: 0 additions & 61 deletions Source/Delphi.Mocks.VirtualInterface.pas

This file was deleted.

24 changes: 0 additions & 24 deletions Source/Delphi.Mocks.VirtualMethodInterceptor.pas

This file was deleted.

0 comments on commit f29d2c0

Please sign in to comment.