Breaking changes in Visual C++ 2015
Jacob Carlborg via Digitalmars-d
digitalmars-d at puremagic.com
Mon May 11 01:15:52 PDT 2015
On 2015-05-08 21:45, Walter Bright wrote:
> This is an interesting problem, one that I faced with Warp.
>
> The solution was to make the function being tested a function template.
> Then, in the unit test I replace the 'file' argument to the function
> with a static array of test data.
I don't really like that approach. The need to change something to a
template just to make it testable. That's the beaut of dynamic typing
and especially Ruby.
In Ruby I can replace a given method on any object very easily, even on
just one instance.
obj = Object.new
def obj.to_s
'foo'
end
obj.to_s == 'foo'
Object.new.to_s != 'foo'
This is perfect for mocking and stubbing.
--
/Jacob Carlborg
More information about the Digitalmars-d
mailing list