blob: aa24bf8e5ddc693b0dca0c68ffaeda5c947ab614 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
|
{$mode delphi}
uses
Variants
;
type
// TMockMethod
//
TMockMethod = class
private
FReturnValue: variant;
public
//: Set return value
procedure Returns(AValue: Variant); overload;
procedure Returns(AValue: Pointer); overload; // if i change this from type Pointer to Double it works
procedure Returns(AValue: Integer); overload;
end;
function Failure: TMockMethod;
begin
Result := TMockMethod.Create;
{ TODO: Free Pascal Compiler version 2.2.0 [2007/08/30] for i386 crash with Internal error 2006122804 on this line
using fpc -Sd PascalMockBug.pas or fpc -S2 PascalMockBug.pas
}
Result.Returns(Result.FReturnValue);
end;
{ TMockMethod }
procedure TMockMethod.Returns(AValue: Integer);
begin
halt(1);
end;
procedure TMockMethod.Returns(AValue: Pointer);
begin
halt(1);
end;
procedure TMockMethod.Returns(AValue: Variant);
begin
writeln('ok');
end;
var
c: tmockmethod;
begin
c:=Failure;
c.free;
end.
|