Skip to content

Commit

Permalink
bdljsn_numberutil: disable output on usage except when verbose (#4730)
Browse files Browse the repository at this point in the history
* bdljsn_numberutil: disable output on usage except when verbose
  • Loading branch information
lalawawa authored and GitHub Enterprise committed May 6, 2024
1 parent bc33501 commit 97c35be
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions groups/bdl/bdljsn/bdljsn_numberutil.t.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1124,14 +1124,9 @@ int main(int argc, char *argv[])
"\n=============" << bsl::endl;
}

if (!verbose) {
// Usage examples are supposed to use ASSERT to make their point,
// not direct printouts as a test driver is not supposed to print
// anything but the test case number executed when no verbosity was
// requested on the command line. Therefore we do not execute this
// usage example unless output was requested.
break; // BREAK
}
bsl::ostringstream oss;
bsl::streambuf *savedStreambuf_p = bsl::cout.rdbuf();
bsl::cout.rdbuf(oss.rdbuf());

///Usage
///-----
Expand Down Expand Up @@ -1219,6 +1214,10 @@ int main(int argc, char *argv[])
// * value: 9223372036854775807 (overflow)
//..

bsl::cout.rdbuf(savedStreambuf_p);
if (verbose) {
bsl::cout << oss.str();
}
} break;

case 12: {
Expand Down

0 comments on commit 97c35be

Please sign in to comment.