Add typeid formatting tests
This commit is contained in:
parent
904451ccaa
commit
b69d737845
@ -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
|
||||
{
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user