[ 
https://issues.apache.org/jira/browse/PROTON-2357?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17320863#comment-17320863
 ] 

ASF GitHub Bot commented on PROTON-2357:
----------------------------------------

DreamPearl commented on a change in pull request #303:
URL: https://github.com/apache/qpid-proton/pull/303#discussion_r613104415



##########
File path: cpp/src/url.cpp
##########
@@ -274,14 +274,10 @@ std::string to_string(const url& u) {
 std::istream& operator>>(std::istream& i, url& u) {
     std::string s;
     i >> s;
-    if (!i.fail() && !i.bad()) {
-        if (!s.empty()) {
-            url::impl* p = new url::impl(s);
-            p->defaults();
-            u.impl_.reset(p);
-        } else {
-            i.clear(std::ios::failbit);
-        }
+    if (!i.fail()) {

Review comment:
       @astitcher @jiridanek I tried to investigate more into it and that leads 
me to think that `end-of-file sets the failbit.`
   I tried to run this sample code: http://cpp.sh/3gsgh
   
   And below are some references. Please let me know what do you think of this?
   
   `“If no characters are extracted then std::ios::failbit is set.”`
   Link: https://en.cppreference.com/w/cpp/string/basic_string/operator_ltltgtgt
   
   `“Operations that attempt to read at the End-of-File fail, and thus both the 
eofbit and the failbit end up set. This function can be used to check whether 
the failure is due to reaching the End-of-File or to some other reason.”`
   LInk: http://www.cplusplus.com/reference/ios/ios/eof/
   
   `“Reaching the End-of-File sets the eofbit. But note that operations that 
reach the End-of-File may also set the failbit if this makes them fail (thus 
setting both eofbit and failbit).”`
   Link: http://www.cplusplus.com/reference/ios/ios/fail/




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> [cpp] Improve test coverage in url.cpp
> --------------------------------------
>
>                 Key: PROTON-2357
>                 URL: https://issues.apache.org/jira/browse/PROTON-2357
>             Project: Qpid Proton
>          Issue Type: Test
>          Components: cpp-binding
>            Reporter: Justin Ross
>            Assignee: Justin Ross
>            Priority: Major
>              Labels: starter
>
> *Assignee: Rakhi Kumari*
> Url.cpp currently has 76% line coverage after running the tests.  Increase 
> the coverage to 100% or as close as is practical.  To do this, add or modify 
> tests in url_test.cpp.
> To set up coverage builds:
>  # Install lcov, the code coverage tool
>  # Configure the build for coverage analysis: cmake 
> -DCMAKE_BUILD_TYPE=Coverage [...]
>  # Build the code: make build
>  # Run the tests: make test
>  # Generate coverage results: make coverage
>  # View the results at <build>/coverage_results



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@qpid.apache.org
For additional commands, e-mail: dev-h...@qpid.apache.org

Reply via email to