mirror of
https://github.com/HowardHinnant/date.git
synced 2024-12-27 00:14:07 +08:00
Reset command, width and modified for %n and %t in from_stream.
This commit is contained in:
parent
f57432d7b4
commit
cf0481b9af
3
date.h
3
date.h
@ -5805,6 +5805,9 @@ from_stream(std::basic_istream<CharT, Traits>& is, const CharT* fmt,
|
||||
for (++fmt; *fmt == 'n' || *fmt == 't'; ++fmt)
|
||||
;
|
||||
--fmt;
|
||||
command = nullptr;
|
||||
width = -1;
|
||||
modified = CharT{};
|
||||
}
|
||||
else
|
||||
read(is, *fmt);
|
||||
|
@ -728,6 +728,18 @@ test_trailing_Z()
|
||||
assert(input.eof());
|
||||
}
|
||||
|
||||
void
|
||||
test_leading_ws()
|
||||
{
|
||||
using namespace std;
|
||||
using namespace date;
|
||||
istringstream in{"05/04/17 5/4/17"};
|
||||
year_month_day d1, d2;
|
||||
in >> parse("%D", d1) >> parse("%n%D", d2);
|
||||
assert(d1 == may/4/2017);
|
||||
assert(d2 == may/4/2017);
|
||||
}
|
||||
|
||||
int
|
||||
main()
|
||||
{
|
||||
@ -756,4 +768,5 @@ main()
|
||||
test_z();
|
||||
test_Z();
|
||||
test_trailing_Z();
|
||||
test_leading_ws();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user