Add typeid formatting tests

This commit is contained in:
Eugen Wissner 2018-01-16 17:44:09 +01:00
parent 904451ccaa
commit b69d737845

View File

@ -935,7 +935,7 @@ package(tanya) String format(string fmt, Args...)(auto ref Args args)
{
}
auto instance = defaultAllocator.unique!A();
assert(format!"{}"(instance.get()) == instance.get.toString());
assert(format!"{}"(instance.get()) == instance.get().toString());
assert(format!"{}"(cast(I) instance.get()) == I.classinfo.name);
assert(format!"{}"(cast(A) null) == "null");
}
@ -965,6 +965,17 @@ package(tanya) String format(string fmt, Args...)(auto ref Args args)
assert(format!"{}"(Stringish()) == "Some content");
}
// Typeid.
nothrow pure @safe unittest
{
assert(format!"{}"(typeid(int[])) == "int[]");
class C
{
}
assert(format!"{}"(typeid(C)) == typeid(C).toString());
}
private struct FormatSpec
{
}