lshal: fix output streams for testing.
ListCommand does not keep a reference to output
and err streams (for easier mock in testing). Instead,
ListCommand uses out() and err() that calls into
Lshal::out() and err().
Test: lshal
Test: lshal_test
Change-Id: Ie6720833ad513ba5cb1246e34ef96afed5d4373c
diff --git a/cmds/lshal/Lshal.cpp b/cmds/lshal/Lshal.cpp
index ac74775..da45d65 100644
--- a/cmds/lshal/Lshal.cpp
+++ b/cmds/lshal/Lshal.cpp
@@ -109,15 +109,15 @@
" Print help message for debug\n";
if (command == "list") {
- mErr << list;
+ err() << list;
return;
}
if (command == "debug") {
- mErr << debug;
+ err() << debug;
return;
}
- mErr << helpSummary << "\n" << list << "\n" << debug << "\n" << help;
+ err() << helpSummary << "\n" << list << "\n" << debug << "\n" << help;
}
// A unique_ptr type using a custom deleter function.
@@ -206,7 +206,7 @@
return OK;
}
- mErr << arg.argv[0] << ": unrecognized option `" << arg.argv[optind] << "`" << std::endl;
+ err() << arg.argv[0] << ": unrecognized option `" << arg.argv[optind] << "`" << std::endl;
usage();
return USAGE;
}