Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
gaoqiong
yaml-cpp
Commits
5b889311
Commit
5b889311
authored
Nov 10, 2013
by
Jesse Beder
Browse files
Fixed bug while reading a single space char
parent
25881c4f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
1 deletion
+9
-1
include/yaml-cpp/node/convert.h
include/yaml-cpp/node/convert.h
+1
-1
test/new-api/nodetests.cpp
test/new-api/nodetests.cpp
+8
-0
No files found.
include/yaml-cpp/node/convert.h
View file @
5b889311
...
@@ -89,7 +89,7 @@ namespace YAML
...
@@ -89,7 +89,7 @@ namespace YAML
const std::string& input = node.Scalar();\
const std::string& input = node.Scalar();\
std::stringstream stream(input);\
std::stringstream stream(input);\
stream.unsetf(std::ios::dec);\
stream.unsetf(std::ios::dec);\
if((stream >> rhs) && (stream >> std::ws).eof())\
if((stream >>
std::noskipws >>
rhs) && (stream >> std::ws).eof())\
return true;\
return true;\
if(std::numeric_limits<type>::has_infinity) {\
if(std::numeric_limits<type>::has_infinity) {\
if(conversion::IsInfinity(input)) {\
if(conversion::IsInfinity(input)) {\
...
...
test/new-api/nodetests.cpp
View file @
5b889311
...
@@ -522,6 +522,13 @@ namespace Test
...
@@ -522,6 +522,13 @@ namespace Test
YAML_ASSERT
(
std
::
string
(
emitter
.
c_str
())
==
""
);
YAML_ASSERT
(
std
::
string
(
emitter
.
c_str
())
==
""
);
return
true
;
return
true
;
}
}
TEST
SpaceChar
()
{
YAML
::
Node
node
=
YAML
::
Node
(
' '
);
YAML_ASSERT
(
node
.
as
<
char
>
()
==
' '
);
return
true
;
}
}
}
void
RunNodeTest
(
TEST
(
*
test
)(),
const
std
::
string
&
name
,
int
&
passed
,
int
&
total
)
{
void
RunNodeTest
(
TEST
(
*
test
)(),
const
std
::
string
&
name
,
int
&
passed
,
int
&
total
)
{
...
@@ -588,6 +595,7 @@ namespace Test
...
@@ -588,6 +595,7 @@ namespace Test
RunNodeTest
(
&
Node
::
DereferenceIteratorError
,
"dereference iterator error"
,
passed
,
total
);
RunNodeTest
(
&
Node
::
DereferenceIteratorError
,
"dereference iterator error"
,
passed
,
total
);
RunNodeTest
(
&
Node
::
FloatingPrecision
,
"floating precision"
,
passed
,
total
);
RunNodeTest
(
&
Node
::
FloatingPrecision
,
"floating precision"
,
passed
,
total
);
RunNodeTest
(
&
Node
::
EmitEmptyNode
,
"emit empty node"
,
passed
,
total
);
RunNodeTest
(
&
Node
::
EmitEmptyNode
,
"emit empty node"
,
passed
,
total
);
RunNodeTest
(
&
Node
::
SpaceChar
,
"space char"
,
passed
,
total
);
std
::
cout
<<
"Node tests: "
<<
passed
<<
"/"
<<
total
<<
" passed
\n
"
;
std
::
cout
<<
"Node tests: "
<<
passed
<<
"/"
<<
total
<<
" passed
\n
"
;
return
passed
==
total
;
return
passed
==
total
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment