Skip to content
This repository was archived by the owner on Oct 12, 2022. It is now read-only.

Commit 9d205bc

Browse files
Geod24dlang-bot
authored andcommitted
Put attributes on core.time : Duration.toString unittest
The original changes to toString, to support sink delegates, did not make toString templated, hence the need to check the GC usage at run time (and the lack of attributes). However, now that toString is templated, this is no longer needed, and putting nogc on the unittest is much better.
1 parent f6ffde2 commit 9d205bc

File tree

1 file changed

+1
-6
lines changed

1 file changed

+1
-6
lines changed

src/core/time.d

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1748,11 +1748,8 @@ unittest
17481748
}
17491749

17501750
// Ensure `toString` doesn't allocate if the sink doesn't
1751-
version (CoreUnittest) @system unittest
1751+
version (CoreUnittest) @safe pure nothrow @nogc unittest
17521752
{
1753-
import core.memory : GC;
1754-
1755-
const before = GC.stats();
17561753
char[256] buffer; size_t len;
17571754
scope sink = (in char[] data) {
17581755
assert(data.length + len <= buffer.length);
@@ -1762,8 +1759,6 @@ version (CoreUnittest) @system unittest
17621759
auto dur = Duration(-12_096_020_900_003);
17631760
dur.toString(sink);
17641761
assert(buffer[0 .. len] == "-2 weeks, -2 secs, -90 ms, and -3 hnsecs");
1765-
const after = GC.stats();
1766-
assert(before == after);
17671762
}
17681763

17691764
/++

0 commit comments

Comments
 (0)