Commit c876ad1c authored by Christian Kamm's avatar Christian Kamm
Browse files

Add tests for type pretty printer.

Mainly to not have unused functions inside the autotest.

Reviewed-by: Bill King
parent 2f30137b
......@@ -76,6 +76,9 @@ Argument *arg(const QString &name, const FullySpecifiedType &ty)
FullySpecifiedType voidTy()
{ return FullySpecifiedType(new VoidType); }
FullySpecifiedType intTy()
{ return FullySpecifiedType(new IntegerType(IntegerType::Int)); }
FullySpecifiedType fnTy(const QString &name, const FullySpecifiedType &ret)
{
Function *fn = new Function(unit, 0, nameId(name));
......@@ -181,6 +184,17 @@ void tst_TypePrettyPrinter::basic_data()
addRow(ref(arr(arr(voidTy()))), "void (&)[][]");
addRow(ref(arr(ref(voidTy()))), "void &(&)[]");
addRow(arr(ref(arr(voidTy()))), "void (&[])[]");
// rvalue references
addRow(rref(voidTy()), "void &&");
addRow(rref(cnst(voidTy())), "const void &&");
addRow(rref(arr(voidTy())), "void (&&)[]");
addRow(rref(arr(arr(voidTy()))), "void (&&)[][]");
// simple functions
addRow(ptr(fnTy("foo", voidTy(), intTy())), "void (*foo)(int)", "foo");
addRow(ptr(fnTy("foo", voidTy(), ptr(voidTy()))), "void (*foo)(void *)", "foo");
}
void tst_TypePrettyPrinter::basic()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment