diff options
| author | Eugen Wissner <belka@caraus.de> | 2018-01-16 17:44:09 +0100 |
|---|---|---|
| committer | Eugen Wissner <belka@caraus.de> | 2018-01-16 17:44:09 +0100 |
| commit | b69d73784502dadbef1cb791bee67dd929d0287f (patch) | |
| tree | e22d82bfdfd6a56322bf8e03535151986209fd1d /source | |
| parent | 904451ccaafb09ff253f0d772e83711278466e15 (diff) | |
| download | tanya-b69d73784502dadbef1cb791bee67dd929d0287f.tar.gz | |
Add typeid formatting tests
Diffstat (limited to 'source')
| -rw-r--r-- | source/tanya/format.d | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/source/tanya/format.d b/source/tanya/format.d index 46e0add..a42719f 100644 --- a/source/tanya/format.d +++ b/source/tanya/format.d @@ -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 { } |
