File tree Expand file tree Collapse file tree 1 file changed +17
-0
lines changed
Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -296,6 +296,8 @@ if (is(Unqual!Char == Char))
296296 }
297297
298298 width = 0 ;
299+ indexStart = 0 ;
300+ indexEnd = 0 ;
299301 precision = UNSPECIFIED ;
300302 nested = null ;
301303 // Parse the spec (we assume we're past '%' already)
@@ -834,6 +836,21 @@ if (is(Unqual!Char == Char))
834836 == " $ expected after '*10' in format string" );
835837}
836838
839+ // https://github.com/dlang/phobos/issues/10713
840+ @safe pure unittest
841+ {
842+ import std.array : appender;
843+ auto f = FormatSpec! char (" %3$d%d" );
844+
845+ auto w = appender! (char [])();
846+ f.writeUpToNextSpec(w);
847+ assert (f.indexStart == 3 );
848+
849+ f.writeUpToNextSpec(w);
850+ assert (w.data.length == 0 );
851+ assert (f.indexStart == 0 );
852+ }
853+
837854/**
838855Helper function that returns a `FormatSpec` for a single format specifier.
839856
You can’t perform that action at this time.
0 commit comments