From c876ad1cad8ac4ab8e2c2b0b0e72268eb04a3f67 Mon Sep 17 00:00:00 2001 From: Christian Kamm <christian.d.kamm@nokia.com> Date: Wed, 2 Mar 2011 16:41:58 +0100 Subject: [PATCH] Add tests for type pretty printer. Mainly to not have unused functions inside the autotest. Reviewed-by: Bill King --- .../typeprettyprinter/tst_typeprettyprinter.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/tests/auto/cplusplus/typeprettyprinter/tst_typeprettyprinter.cpp b/tests/auto/cplusplus/typeprettyprinter/tst_typeprettyprinter.cpp index acb11eddaf0..50ba94ddbe9 100644 --- a/tests/auto/cplusplus/typeprettyprinter/tst_typeprettyprinter.cpp +++ b/tests/auto/cplusplus/typeprettyprinter/tst_typeprettyprinter.cpp @@ -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() -- GitLab