Add testutils module with assert_eq()
This commit is contained in:
parent
5ce562cbc3
commit
653b4e00f6
@ -27,7 +27,7 @@ describe Propane do
|
|||||||
parsers = options[:parsers].map do |name|
|
parsers = options[:parsers].map do |name|
|
||||||
"spec/run/testparser#{name}.d"
|
"spec/run/testparser#{name}.d"
|
||||||
end
|
end
|
||||||
result = system(*%w[ldc2 --unittest -of spec/run/testparser -Ispec], *parsers, *test_files)
|
result = system(*%w[ldc2 --unittest -of spec/run/testparser -Ispec], *parsers, *test_files, "spec/testutils.d")
|
||||||
expect(result).to be_truthy
|
expect(result).to be_truthy
|
||||||
end
|
end
|
||||||
|
|
||||||
|
10
spec/testutils.d
Normal file
10
spec/testutils.d
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
import std.stdio;
|
||||||
|
|
||||||
|
void assert_eq(T)(T expected, T actual, string file = __FILE__, size_t line = __LINE__)
|
||||||
|
{
|
||||||
|
if (expected != actual)
|
||||||
|
{
|
||||||
|
stderr.writeln(file, ":", line, ": expected ", expected, ", got ", actual);
|
||||||
|
assert(false);
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user