Add testutils module with assert_eq()

This commit is contained in:
Josh Holtrop 2023-07-14 15:48:44 -04:00
parent 5ce562cbc3
commit 653b4e00f6
2 changed files with 11 additions and 1 deletions

View File

@ -27,7 +27,7 @@ describe Propane do
parsers = options[:parsers].map do |name|
"spec/run/testparser#{name}.d"
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
end

10
spec/testutils.d Normal file
View 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);
}
}